You are here

public function TranslationManagerTest::providerTestFormatPlural in Drupal 9

Same name and namespace in other branches
  1. 8 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
Contains \Drupal\Tests\Core\StringTranslation\TranslationManagerTest.

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