function TranslationManagerTest::providerTestFormatPlural

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TranslationManagerTest::providerTestFormatPlural()
  2. 10 core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TranslationManagerTest::providerTestFormatPlural()
  3. 11.x core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TranslationManagerTest::providerTestFormatPlural()

Provides some test data for formatPlural()

Return value

array

File

core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php, line 38

Class

TranslationManagerTest
@coversDefaultClass \Drupal\Core\StringTranslation\TranslationManager @group StringTranslation

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function providerTestFormatPlural() {
    return [
        [
            1,
            'Singular',
            '@count plural',
            [],
            [],
            'Singular',
        ],
        [
            2,
            'Singular',
            '@count plural',
            [],
            [],
            '2 plural',
        ],
        // @todo support locale_get_plural
[
            2,
            'Singular',
            '@count @arg',
            [
                '@arg' => '<script>',
            ],
            [],
            '2 &lt;script&gt;',
        ],
        [
            2,
            'Singular',
            '@count %arg',
            [
                '%arg' => '<script>',
            ],
            [],
            '2 <em class="placeholder">&lt;script&gt;</em>',
        ],
        [
            1,
            'Singular',
            '@count plural',
            [],
            [
                'langcode' => NULL,
            ],
            'Singular',
        ],
        [
            1,
            'Singular',
            '@count plural',
            [],
            [
                'langcode' => 'es',
            ],
            'Singular',
        ],
    ];
}

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