function LocaleLookupTest::providerFixOldPluralTranslationProvider

Same name and namespace 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 <a href="/api/drupal/core%21modules%21locale%21src%21LocaleLookup.php/class/LocaleLookup/11.x" title="A cache collector to allow for dynamic building of the locale cache." class="local">\Drupal\locale\LocaleLookup</a> @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.