diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 0b0cee0..7d41967 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -111,7 +111,8 @@ function locale_schema() { 'customized' => array( 'type' => 'int', 'not null' => TRUE, - 'default' => 0, // LOCALE_NOT_CUSTOMIZED + // LOCALE_NOT_CUSTOMIZED + 'default' => 0, 'description' => 'Boolean indicating whether the translation is custom to this site.', ), ), diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 55e2835..0900ff2 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -2,7 +2,7 @@ /** * @file - * Enables the translation of the user interface to languages other than English. + * Enables the translation of the UI to languages other than English. * * When enabled, multiple languages can be added. The site interface can be * displayed in different languages, and nodes can have languages assigned. The @@ -98,7 +98,7 @@ const LOCALE_TRANSLATION_DEFAULT_SERVER_PATTERN = 'http://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po'; /** - * The number of seconds that the translations status entry should be considered. + * The number of seconds the translations status entry should be considered. */ const LOCALE_TRANSLATION_STATUS_TTL = 600; @@ -113,7 +113,7 @@ const LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED = 'non_customized'; /** - * UI option for not overwriting existing translations. + * UI option for not overriding existing translations. */ const LOCALE_TRANSLATION_OVERWRITE_NONE = 'none'; @@ -481,7 +481,8 @@ function locale_system_update(array $components) { $projects = array_keys(locale_translation_build_projects()); if ($list = array_intersect($list, $projects)) { module_load_include('fetch.inc', 'locale'); - // Get translation status of the projects, download and update translations. + // Get translation status of the projects, download and update + // translations. $options = _locale_translation_default_update_options(); $batch = locale_translation_batch_update_build($list, array(), $options); batch_set($batch); @@ -514,7 +515,8 @@ function locale_system_remove($components) { \Drupal\locale\Locale::config()->deleteComponentTranslations($components, array_keys($language_list)); // Only when projects are removed, the translation files and records will be - // deleted. Not each disabled module will remove a project. E.g. sub modules. + // deleted. Not each disabled module will remove a project, e.g., sub + // modules. $projects = array_keys(locale_translation_get_projects()); if ($list = array_intersect($list, $projects)) { locale_translation_file_history_delete($list); @@ -694,7 +696,7 @@ function locale_form_language_admin_overview_form_alter(&$form, &$form_state) { } /** - * Implements hook_form_FORM_ID_alter() for language_admin_add_form((). + * Implements hook_form_FORM_ID_alter() for language_admin_add_form(). */ function locale_form_language_admin_add_form_alter(&$form, &$form_state) { $form['predefined_submit']['#submit'][] = 'locale_form_language_admin_add_form_alter_submit'; @@ -800,7 +802,7 @@ function locale_system_file_system_settings_submit(&$form, $form_state) { } /** - * Implements hook_preprocess_HOOK() for node templates. + * Implements hook_preprocess_HOOK() for node.html.twig. */ function locale_preprocess_node(&$variables) { if ($variables['node']->language()->id != LanguageInterface::LANGCODE_NOT_SPECIFIED) { @@ -1111,7 +1113,7 @@ function _locale_strip_quotes($string) { } /** - * Parses a JavaScript file for translatable string and saves them to the database. + * Parses a JavaScript file for translatable strings and stores them. * * @param string $filepath * File name to parse. @@ -1201,7 +1203,8 @@ function _locale_parse_js_file($filepath) { $source = \Drupal::service('locale.storage')->findString($match); if (!$source) { - // We don't have the source string yet, thus we insert it into the database. + // We don't have the source string yet, thus we insert it into the + // database. $source = \Drupal::service('locale.storage')->createString($match); } @@ -1297,7 +1300,8 @@ function _locale_rebuild_js($langcode = NULL) { // There is (on purpose) no front end to edit that variable. $dir = 'public://' . $config->get('javascript.directory'); - // Delete old file, if we have no translations anymore, or a different file to be saved. + // Delete old file, if we have no translations anymore, or a different file to + // be saved. $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array(); $changed_hash = !isset($locale_javascripts[$language->id]) || ($locale_javascripts[$language->id] != $data_hash); if (!empty($locale_javascripts[$language->id]) && (!$data || $changed_hash)) { diff --git a/core/modules/locale/src/Tests/LocaleStringTest.php b/core/modules/locale/src/Tests/LocaleStringTest.php index 138e4a5..5eb2d90 100644 --- a/core/modules/locale/src/Tests/LocaleStringTest.php +++ b/core/modules/locale/src/Tests/LocaleStringTest.php @@ -156,7 +156,8 @@ public function testStringSearchAPI() { $found = $this->storage->findTranslation(array('language' => $langcode, 'source' => $source3->source, 'context' => $source3->context)); $this->assertTrue($found && $found->lid == $source3->lid && !isset($found->translation) && $found->isNew(), 'Translation not found but source string found.'); - // Load all translations. For next queries we'll be loading only translated strings. $only_translated = array('untranslated' => FALSE); + // Load all translations. For next queries we'll be loading only translated + // strings. $only_translated = array('untranslated' => FALSE); $translations = $this->storage->getTranslations(array('translated' => TRUE)); $this->assertEqual(count($translations), 2 * $language_count, 'Created and retrieved all translations for source strings.'); diff --git a/core/modules/locale/src/Tests/LocaleTranslateStringTourTest.php b/core/modules/locale/src/Tests/LocaleTranslateStringTourTest.php index f9770e7..4cf2d85 100644 --- a/core/modules/locale/src/Tests/LocaleTranslateStringTourTest.php +++ b/core/modules/locale/src/Tests/LocaleTranslateStringTourTest.php @@ -52,7 +52,7 @@ protected function setUp() { * Tests locale tour tip availability. */ public function testTranslateStringTourTips() { - // Add Another Language so there is no missing form items. + // Add Another Language so there are no missing form items. $edit = array(); $edit['predefined_langcode'] = 'es'; $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); diff --git a/core/modules/locale/src/TranslationsStream.php b/core/modules/locale/src/TranslationsStream.php index 495f5a7..b00b58b 100644 --- a/core/modules/locale/src/TranslationsStream.php +++ b/core/modules/locale/src/TranslationsStream.php @@ -17,14 +17,14 @@ class TranslationsStream extends LocalStream { /** - * Implements Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath(). + * {@inheritdoc} */ public function getDirectoryPath() { return \Drupal::config('locale.settings')->get('translation.path'); } /** - * Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl(). + * {@inheritdoc} * * @throws \LogicException PO files URL should not be public. */