You are here

class PotxTestD8 in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.2 tests/potx_test_8.module \PotxTestD8

Test parsing Drupal 8 $this->t and formatPlural function calls.

Hierarchy

Expanded class hierarchy of PotxTestD8

File

tests/potx_test_8.module, line 64
File used purely to test the parser in potx.

View source
class PotxTestD8 {
  function test_func() {

    // In the real world, we'd also need to define "function t", and inject
    // the translation service. please refer to https://drupal.org/node/2079611
    // for an example.
    $test_translation = $this
      ->t('Using t inside D8 classes ($this->t)');
  }
  function testFormatPlural() {
    $this
      ->formatPlural($count, '1 formatPlural test string', '@count formatPlural test strings');
    $this
      ->formatPlural($count, '1 formatPlural test string in context', '@count formatPlural test strings in context', array(), array(
      'context' => 'Test context',
    ));
    $this
      ->formatPlural($count);
    $this
      ->formatPlural();
    \Drupal::translation()
      ->formatPlural($count, '1 translation->formatPlural test string in context', '@count translation->formatPlural test strings in context', array(), array(
      'context' => 'Test context',
    ));
    \Drupal::translation()
      ->formatPlural($count, '1 translation->formatPlural test string', '@count translation->formatPlural test strings');
    $a = new PluralTranslatableMarkup($count, '1 PluralTranslatableMarkup test string', '@count PluralTranslatableMarkup test strings');
    $b = new PluralTranslatableMarkup($count, '1 PluralTranslatableMarkup test string with context', '@count PluralTranslatableMarkup test strings with context', array(), array(
      'context' => 'Test context',
    ));
  }

}

Members