You are here

public function LocaleLookupTest::providerFixOldPluralTranslationProvider in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::providerFixOldPluralTranslationProvider()
  2. 10 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::providerFixOldPluralTranslationProvider()

Provides test data for testResolveCacheMissWithFallback().

File

core/modules/locale/tests/src/Unit/LocaleLookupTest.php, line 324

Class

LocaleLookupTest
@coversDefaultClass \Drupal\locale\LocaleLookup @group locale

Namespace

Drupal\Tests\locale\Unit

Code

public function providerFixOldPluralTranslationProvider() {
  $translations = [
    'by' => [
      'word1' => '@count[2] word-by',
      'word2' => implode(PoItem::DELIMITER, [
        'word-by',
        '@count[2] word-by',
      ]),
    ],
    'ru' => [
      'word3' => '@count[2] word-ru',
      'word4' => implode(PoItem::DELIMITER, [
        'word-ru',
        '@count[2] word-ru',
      ]),
    ],
  ];
  return [
    'no-plural' => [
      $translations,
      'by',
      'word1',
      FALSE,
    ],
    'no-plural from other language' => [
      $translations,
      'by',
      'word3',
      FALSE,
    ],
    'plural' => [
      $translations,
      'by',
      'word2',
      TRUE,
    ],
    'plural from other language' => [
      $translations,
      'by',
      'word4',
      TRUE,
    ],
  ];
}