diff --git a/core/modules/locale/lib/Drupal/locale/Form/LocaleSettingsForm.php b/core/modules/locale/lib/Drupal/locale/Form/LocaleSettingsForm.php
new file mode 100644
index 0000000000000000000000000000000000000000..4236bf2fab8b3212409abb1d92fa9c53b31d76a7
--- /dev/null
+++ b/core/modules/locale/lib/Drupal/locale/Form/LocaleSettingsForm.php
@@ -0,0 +1,142 @@
+configFactory->get('locale.settings');
+
+ $form['update_interval_days'] = array(
+ '#type' => 'radios',
+ '#title' => t('Check for updates'),
+ '#default_value' => $config->get('translation.update_interval_days'),
+ '#options' => array(
+ '0' => t('Never (manually)'),
+ '1' => t('Daily'),
+ '7' => t('Weekly'),
+ ),
+ '#description' => t('Select how frequently you want to check for new interface translations for your currently installed modules and themes. Check updates now.', array('@url' => url('admin/reports/translations/check'))),
+ );
+
+ $form['check_disabled_modules'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Check for updates of disabled modules and themes'),
+ '#default_value' => $config->get('translation.check_disabled_modules'),
+ );
+
+ if ($directory =config('locale.settings')->get('translation.path')) {
+ $description = t('Translation files are stored locally in the %path directory. You can change this directory on the File system configuration page.', array('%path' => $directory, '@url' => url('admin/config/media/file-system')));
+ }
+ else {
+ $description = t('Translation files will not be stored locally. Change the Interface translation directory on the File system configuration page.', array('@url' => url('admin/config/media/file-system')));
+ }
+ $form['#translation_directory'] = $directory;
+ $form['use_source'] = array(
+ '#type' => 'radios',
+ '#title' => t('Translation source'),
+ '#default_value' => $config->get('translation.use_source'),
+ '#options' => array(
+ LOCALE_TRANSLATION_USE_SOURCE_REMOTE_AND_LOCAL => t('Drupal translation server and local files'),
+ LOCALE_TRANSLATION_USE_SOURCE_LOCAL => t('Local files only'),
+ ),
+ '#description' => t('The source of translation files for automatic interface translation.') . ' ' . $description,
+ );
+
+ if ($config->get('translation.overwrite_not_customized') == FALSE) {
+ $default = LOCALE_TRANSLATION_OVERWRITE_NONE;
+ }
+ elseif ($config->get('translation.overwrite_customized') == TRUE) {
+ $default = LOCALE_TRANSLATION_OVERWRITE_ALL;
+ }
+ else {
+ $default = LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED;
+ }
+ $form['overwrite'] = array(
+ '#type' => 'radios',
+ '#title' => t('Import behaviour'),
+ '#default_value' => $default,
+ '#options' => array(
+ LOCALE_TRANSLATION_OVERWRITE_NONE => t("Don't overwrite existing translations."),
+ LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED => t('Only overwrite imported translations, customized translations are kept.'),
+ LOCALE_TRANSLATION_OVERWRITE_ALL => t('Overwrite existing translations.'),
+ ),
+ '#description' => t('How to treat existing translations when automatically updating the interface translations.'),
+ );
+
+ return parent::buildForm($form, $form_state);
+ }
+
+ /**
+ * Implements \Drupal\Core\Form\FormInterface::validateForm().
+ */
+ public function validateForm(array &$form, array &$form_state) {
+ parent::validateForm($form, $form_state);
+
+ if (empty($form['#translation_directory']) && $form_state['values']['use_source'] == LOCALE_TRANSLATION_USE_SOURCE_LOCAL) {
+ form_set_error('use_source', t('You have selected local translation source, but no Interface translation directory was configured.', array('@url' => url('admin/config/media/file-system'))));
+ }
+ }
+
+ /**
+ * Implements \Drupal\Core\Form\FormInterface::submitForm().
+ */
+ public function submitForm(array &$form, array &$form_state) {
+ $values = $form_state['values'];
+
+ $config = $this->configFactory->get('locale.settings');
+ $config->set('translation.update_interval_days', $values['update_interval_days'])->save();
+ $config->set('translation.use_source', $values['use_source'])->save();
+
+ switch ($values['overwrite']) {
+ case LOCALE_TRANSLATION_OVERWRITE_ALL:
+ $config
+ ->set('translation.overwrite_customized', TRUE)
+ ->set('translation.overwrite_not_customized', TRUE);
+ break;
+ case LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED:
+ $config
+ ->set('translation.overwrite_customized', FALSE)
+ ->set('translation.overwrite_not_customized', TRUE);
+ break;
+ case LOCALE_TRANSLATION_OVERWRITE_NONE:
+ $config
+ ->set('translation.overwrite_customized', FALSE)
+ ->set('translation.overwrite_not_customized', FALSE);
+ break;
+ }
+
+ $config
+ ->set('translation.check_disabled_modules', $values['check_disabled_modules'])
+ ->save();
+
+ // Invalidate the cached translation status when the configuration setting of
+ // 'use_source' and 'check_disabled_modules' change.
+ if ($form['use_source']['#default_value'] != $form_state['values']['use_source'] ||
+ $form['check_disabled_modules']['#default_value'] != $form_state['values']['check_disabled_modules']) {
+ locale_translation_clear_status();
+ }
+
+ parent::submitForm($form, $form_state);
+ }
+
+}
diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index fb72927e85977094f8d7a3347e2b931161eabb29..880e3357cc8fe49aa17155fa5804d4acda9e167c 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -215,12 +215,10 @@ function locale_menu() {
);
$items['admin/config/regional/translate/settings'] = array(
'title' => 'Settings',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('locale_translate_settings'),
+ 'route_name' => 'locale_settings',
'access arguments' => array('translate interface'),
'weight' => 100,
'type' => MENU_LOCAL_TASK,
- 'file' => 'locale.pages.inc',
);
$items['admin/reports/translations'] = array(
'title' => 'Available translation updates',
diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc
index 43668716d962648c409d963883544d159c0bf2c9..fc68a51c0b2d1b6df4f1c5e4d36d538df01a7a3f 100644
--- a/core/modules/locale/locale.pages.inc
+++ b/core/modules/locale/locale.pages.inc
@@ -482,127 +482,6 @@ function locale_translation_manual_status() {
drupal_goto('admin/reports/translations');
}
-/**
- * Page callback: Configuration for interface translation.
- *
- * @see locale_menu()
- */
-function locale_translate_settings($form, &$form_state) {
- $config = config('locale.settings');
-
- $form['update_interval_days'] = array(
- '#type' => 'radios',
- '#title' => t('Check for updates'),
- '#default_value' => $config->get('translation.update_interval_days'),
- '#options' => array(
- '0' => t('Never (manually)'),
- '1' => t('Daily'),
- '7' => t('Weekly'),
- ),
- '#description' => t('Select how frequently you want to check for new interface translations for your currently installed modules and themes. Check updates now.', array('@url' => url('admin/reports/translations/check'))),
- );
-
- $form['check_disabled_modules'] = array(
- '#type' => 'checkbox',
- '#title' => t('Check for updates of disabled modules and themes'),
- '#default_value' => $config->get('translation.check_disabled_modules'),
- );
-
- if ($directory =config('locale.settings')->get('translation.path')) {
- $description = t('Translation files are stored locally in the %path directory. You can change this directory on the File system configuration page.', array('%path' => $directory, '@url' => url('admin/config/media/file-system')));
- }
- else {
- $description = t('Translation files will not be stored locally. Change the Interface translation directory on the File system configuration page.', array('@url' => url('admin/config/media/file-system')));
- }
- $form['#translation_directory'] = $directory;
- $form['use_source'] = array(
- '#type' => 'radios',
- '#title' => t('Translation source'),
- '#default_value' => $config->get('translation.use_source'),
- '#options' => array(
- LOCALE_TRANSLATION_USE_SOURCE_REMOTE_AND_LOCAL => t('Drupal translation server and local files'),
- LOCALE_TRANSLATION_USE_SOURCE_LOCAL => t('Local files only'),
- ),
- '#description' => t('The source of translation files for automatic interface translation.') . ' ' . $description,
- );
-
- if ($config->get('translation.overwrite_not_customized') == FALSE) {
- $default = LOCALE_TRANSLATION_OVERWRITE_NONE;
- }
- elseif ($config->get('translation.overwrite_customized') == TRUE) {
- $default = LOCALE_TRANSLATION_OVERWRITE_ALL;
- }
- else {
- $default = LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED;
- }
- $form['overwrite'] = array(
- '#type' => 'radios',
- '#title' => t('Import behaviour'),
- '#default_value' => $default,
- '#options' => array(
- LOCALE_TRANSLATION_OVERWRITE_NONE => t("Don't overwrite existing translations."),
- LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED => t('Only overwrite imported translations, customized translations are kept.'),
- LOCALE_TRANSLATION_OVERWRITE_ALL => t('Overwrite existing translations.'),
- ),
- '#description' => t('How to treat existing translations when automatically updating the interface translations.'),
- );
-
- return system_config_form($form, $form_state);
-}
-
-/**
- * Form validation handler for locale_translate_settings().
- *
- * @see locale_translate_settings()
- */
-function locale_translate_settings_validate($form, &$form_state) {
- if (empty($form['#translation_directory']) && $form_state['values']['use_source'] == LOCALE_TRANSLATION_USE_SOURCE_LOCAL) {
- form_set_error('use_source', t('You have selected local translation source, but no Interface translation directory was configured.', array('@url' => url('admin/config/media/file-system'))));
- }
-}
-
-/**
- * Form submission handler for locale_translate_settings().
- *
- * @see locale_translate_settings()
- */
-function locale_translate_settings_submit($form, &$form_state) {
- $values = $form_state['values'];
-
- $config = config('locale.settings');
- $config->set('translation.update_interval_days', $values['update_interval_days'])->save();
- $config->set('translation.use_source', $values['use_source'])->save();
-
- switch ($values['overwrite']) {
- case LOCALE_TRANSLATION_OVERWRITE_ALL:
- $config
- ->set('translation.overwrite_customized', TRUE)
- ->set('translation.overwrite_not_customized', TRUE);
- break;
- case LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED:
- $config
- ->set('translation.overwrite_customized', FALSE)
- ->set('translation.overwrite_not_customized', TRUE);
- break;
- case LOCALE_TRANSLATION_OVERWRITE_NONE:
- $config
- ->set('translation.overwrite_customized', FALSE)
- ->set('translation.overwrite_not_customized', FALSE);
- break;
- }
-
- $config
- ->set('translation.check_disabled_modules', $values['check_disabled_modules'])
- ->save();
-
- // Invalidate the cached translation status when the configuration setting of
- // 'use_source' and 'check_disabled_modules' change.
- if ($form['use_source']['#default_value'] != $form_state['values']['use_source'] ||
- $form['check_disabled_modules']['#default_value'] != $form_state['values']['check_disabled_modules']) {
- locale_translation_clear_status();
- }
-}
-
/**
* Page callback: Display the current translation status.
*
diff --git a/core/modules/locale/locale.routing.yml b/core/modules/locale/locale.routing.yml
new file mode 100644
index 0000000000000000000000000000000000000000..a2a58209ad2dd64c027ed0097bbcf6e93b6a07af
--- /dev/null
+++ b/core/modules/locale/locale.routing.yml
@@ -0,0 +1,6 @@
+locale_settings:
+ pattern: '/admin/config/regional/translate/settings'
+ defaults:
+ _form: 'Drupal\locale\Form\LocaleSettingsForm'
+ requirements:
+ _permission: 'translate interface'