diff --git a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php index 824ca30..f4b4bd3 100644 --- a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php +++ b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php @@ -76,8 +76,8 @@ protected function formatPluralTranslated($count, $translated, array $args = arr * @see \Drupal\locale\PluralFormulaInterface::getNumberOfPlurals() */ protected function getNumberOfPlurals($langcode = NULL) { - if (\Drupal::hasService('locale.plural.forumla')) { - return \Drupal::service('locale.plural.forumla')->getNumberOfPlurals($langcode); + if (\Drupal::hasService('locale.plural.formula')) { + return \Drupal::service('locale.plural.formula')->getNumberOfPlurals($langcode); } // We assume 2 plurals if Locale's services are not available. return 2; diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index c6ad9d3..a41d708 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -284,7 +284,7 @@ function locale_get_plural($count, $langcode = NULL) { if (!isset($plural_indexes[$langcode][$count])) { // Retrieve and statically cache the plural formulas for all languages. - $plural_formulas = \Drupal::service('locale.plural.forumla')->getFormula($langcode); + $plural_formulas = \Drupal::service('locale.plural.formula')->getFormula($langcode); // If there is a plural formula for the language, evaluate it for the given // $count and statically cache the result for the combination of language @@ -1269,7 +1269,7 @@ function _locale_rebuild_js($langcode = NULL) { 'strings' => $translations, ); - $locale_plurals = \Drupal::service('locale.plural.forumla')->getFormula($language->getId()); + $locale_plurals = \Drupal::service('locale.plural.formula')->getFormula($language->getId()); if ($locale_plurals) { $data['pluralFormula'] = $locale_plurals; } diff --git a/core/modules/locale/locale.services.yml b/core/modules/locale/locale.services.yml index 00c836f..29603ee 100644 --- a/core/modules/locale/locale.services.yml +++ b/core/modules/locale/locale.services.yml @@ -14,7 +14,7 @@ services: locale.project: class: Drupal\locale\LocaleProjectStorage arguments: ['@keyvalue'] - locale.plural.forumla: + locale.plural.formula: class: Drupal\locale\PluralFormula arguments: ['@language_manager', '@state'] string_translator.locale.lookup: diff --git a/core/modules/locale/src/PoDatabaseWriter.php b/core/modules/locale/src/PoDatabaseWriter.php index c21c91e..27b9b78 100644 --- a/core/modules/locale/src/PoDatabaseWriter.php +++ b/core/modules/locale/src/PoDatabaseWriter.php @@ -175,7 +175,7 @@ public function setHeader(PoHeader $header) { $plural = $header->getPluralForms(); if (isset($plural) && $p = $header->parsePluralForms($plural)) { list($nplurals, $formula) = $p; - \Drupal::service('locale.plural.forumla')->setPluralFormula($langcode, $nplurals, $formula); + \Drupal::service('locale.plural.formula')->setPluralFormula($langcode, $nplurals, $formula); } } } diff --git a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php index 6bec4a5..ca8254c 100644 --- a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php +++ b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php @@ -76,7 +76,7 @@ public function testStandalonePoFile() { $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 8, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.'); // This import should have saved plural forms to have 2 variants. - $locale_plurals = \Drupal::service('locale.plural.forumla')->getNumberOfPlurals('fr'); + $locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr'); $this->assertEqual(2, $locale_plurals, 'Plural number initialized.'); // Ensure we were redirected correctly. @@ -151,7 +151,7 @@ public function testStandalonePoFile() { $this->assertText(t('No strings available.'), 'String not overwritten by imported string.'); // This import should not have changed number of plural forms. - $locale_plurals = \Drupal::service('locale.plural.forumla')->getNumberOfPlurals('fr'); + $locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr'); $this->assertEqual(2, $locale_plurals, 'Plural numbers untouched.'); // Try importing a .po file with overriding strings, and ensure existing @@ -172,7 +172,7 @@ public function testStandalonePoFile() { $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $this->assertNoText(t('No strings available.'), 'String overwritten by imported string.'); // This import should have changed number of plural forms. - $locale_plurals = \Drupal::service('locale.plural.forumla')->reset()->getNumberOfPlurals('fr'); + $locale_plurals = \Drupal::service('locale.plural.formula')->reset()->getNumberOfPlurals('fr'); $this->assertEqual(3, $locale_plurals, 'Plural numbers changed.'); // Importing a .po file and mark its strings as customized strings. diff --git a/core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php b/core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php index d6aefa3..8e75e4d 100644 --- a/core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php +++ b/core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php @@ -86,7 +86,7 @@ function testNumericFormatPlural() { $formula = 'nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);'; $header = new PoHeader(); list($nplurals, $formula) = $header->parsePluralForms($formula); - \Drupal::service('locale.plural.forumla')->setPluralFormula('sl', $nplurals, $formula); + \Drupal::service('locale.plural.formula')->setPluralFormula('sl', $nplurals, $formula); // Change the view to Slovenian. $config = $this->config('views.view.numeric_test');