function TranslationManagerTest::providerTestTranslatePlaceholder

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

Provides test data for translate().

Return value

array An array of test data for translate().

File

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

Class

TranslationManagerTest
Tests Drupal\Core\StringTranslation\TranslationManager.

Namespace

Drupal\Tests\Core\StringTranslation

Code

public static function providerTestTranslatePlaceholder() : array {
  return [
    [
      'foo @bar',
      [
        '@bar' => 'bar',
      ],
      'foo bar',
    ],
    [
      'bar %baz',
      [
        '%baz' => 'baz',
      ],
      'bar <em class="placeholder">baz</em>',
    ],
    [
      'bar @bar %baz',
      [
        '@bar' => 'bar',
        '%baz' => 'baz',
      ],
      'bar bar <em class="placeholder">baz</em>',
    ],
    [
      'bar %baz @bar',
      [
        '%baz' => 'baz',
        '@bar' => 'bar',
      ],
      'bar <em class="placeholder">baz</em> bar',
    ],
  ];
}

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