Loading core/modules/locale/config/install/locale.settings.yml +0 −1 Original line number Diff line number Diff line Loading @@ -9,5 +9,4 @@ translation: overwrite_customized: false overwrite_not_customized: true update_interval_days: 0 path: '' import_enabled: true core/modules/locale/config/schema/locale.schema.yml +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ locale.settings: path: type: string label: 'Interface translations directory' deprecated: "The 'translation.path' config is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use the locale_translation_path setting instead. See https://www.drupal.org/node/3571594." import_enabled: type: boolean label: 'Import enabled' core/modules/locale/locale.bulk.inc +2 −1 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use Drupal\file\FileInterface; use Drupal\locale\Gettext; use Drupal\locale\LocaleSource; use Drupal\locale\StreamWrapper\TranslationsStream; /** * Get interface translation files present in the translations directory. Loading @@ -35,7 +36,7 @@ function locale_translate_get_interface_translation_files(array $projects = [], // containing a project name and language code: {project}.{langcode}.po or // {project}-{version}.{langcode}.po. // Only files of known projects and languages will be returned. $directory = \Drupal::config('locale.settings')->get('translation.path'); $directory = TranslationsStream::basePath(); $result = []; if (is_dir($directory)) { $result = \Drupal::service('file_system')->scanDirectory($directory, '![a-z_]+(\-[0-9a-z\.\-\+]+|)\.[^\./]+\.po$!', ['recurse' => FALSE]); Loading core/modules/locale/locale.install +2 −5 Original line number Diff line number Diff line Loading @@ -7,17 +7,14 @@ use Drupal\Core\File\Exception\FileException; use Drupal\Core\File\FileSystemInterface; use Drupal\locale\StreamWrapper\TranslationsStream; /** * Implements hook_install(). */ function locale_install(): void { // Create the interface translations directory and ensure it's writable. if (!$directory = \Drupal::config('locale.settings')->get('translation.path')) { $site_path = \Drupal::getContainer()->getParameter('site.path'); $directory = $site_path . '/files/translations'; \Drupal::configFactory()->getEditable('locale.settings')->set('translation.path', $directory)->save(); } $directory = TranslationsStream::basePath(); \Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); } Loading core/modules/locale/locale.module +6 −0 Original line number Diff line number Diff line Loading @@ -432,8 +432,14 @@ function locale_is_translatable($langcode) { * Clears the translation status when the Interface translations directory * changes. Without a translations directory local po files in the directory * should be ignored. The old translation status is no longer valid. * * @deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no * replacement. * * @see https://www.drupal.org/node/3571594 */ function locale_system_file_system_settings_submit(&$form, FormStateInterface $form_state): void { @trigger_error(__FUNCTION__ . 'is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3571594', E_USER_DEPRECATED); if ($form['translation_path']['#default_value'] != $form_state->getValue('translation_path')) { locale_translation_clear_status(); } Loading Loading
core/modules/locale/config/install/locale.settings.yml +0 −1 Original line number Diff line number Diff line Loading @@ -9,5 +9,4 @@ translation: overwrite_customized: false overwrite_not_customized: true update_interval_days: 0 path: '' import_enabled: true
core/modules/locale/config/schema/locale.schema.yml +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ locale.settings: path: type: string label: 'Interface translations directory' deprecated: "The 'translation.path' config is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use the locale_translation_path setting instead. See https://www.drupal.org/node/3571594." import_enabled: type: boolean label: 'Import enabled'
core/modules/locale/locale.bulk.inc +2 −1 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use Drupal\file\FileInterface; use Drupal\locale\Gettext; use Drupal\locale\LocaleSource; use Drupal\locale\StreamWrapper\TranslationsStream; /** * Get interface translation files present in the translations directory. Loading @@ -35,7 +36,7 @@ function locale_translate_get_interface_translation_files(array $projects = [], // containing a project name and language code: {project}.{langcode}.po or // {project}-{version}.{langcode}.po. // Only files of known projects and languages will be returned. $directory = \Drupal::config('locale.settings')->get('translation.path'); $directory = TranslationsStream::basePath(); $result = []; if (is_dir($directory)) { $result = \Drupal::service('file_system')->scanDirectory($directory, '![a-z_]+(\-[0-9a-z\.\-\+]+|)\.[^\./]+\.po$!', ['recurse' => FALSE]); Loading
core/modules/locale/locale.install +2 −5 Original line number Diff line number Diff line Loading @@ -7,17 +7,14 @@ use Drupal\Core\File\Exception\FileException; use Drupal\Core\File\FileSystemInterface; use Drupal\locale\StreamWrapper\TranslationsStream; /** * Implements hook_install(). */ function locale_install(): void { // Create the interface translations directory and ensure it's writable. if (!$directory = \Drupal::config('locale.settings')->get('translation.path')) { $site_path = \Drupal::getContainer()->getParameter('site.path'); $directory = $site_path . '/files/translations'; \Drupal::configFactory()->getEditable('locale.settings')->set('translation.path', $directory)->save(); } $directory = TranslationsStream::basePath(); \Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); } Loading
core/modules/locale/locale.module +6 −0 Original line number Diff line number Diff line Loading @@ -432,8 +432,14 @@ function locale_is_translatable($langcode) { * Clears the translation status when the Interface translations directory * changes. Without a translations directory local po files in the directory * should be ignored. The old translation status is no longer valid. * * @deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no * replacement. * * @see https://www.drupal.org/node/3571594 */ function locale_system_file_system_settings_submit(&$form, FormStateInterface $form_state): void { @trigger_error(__FUNCTION__ . 'is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3571594', E_USER_DEPRECATED); if ($form['translation_path']['#default_value'] != $form_state->getValue('translation_path')) { locale_translation_clear_status(); } Loading