function LocaleLookupTest::providerFixOldPluralTranslationProvider

Same name in other branches
  1. 9 core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::providerFixOldPluralTranslationProvider()
  2. 8.9.x core/modules/locale/tests/src/Unit/LocaleLookupTest.php \Drupal\Tests\locale\Unit\LocaleLookupTest::providerFixOldPluralTranslationProvider()
  3. 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 328

Class

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

Namespace

Drupal\Tests\locale\Unit

Code

public static 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,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.