potx_test_8.module in Translation template extractor 7.2
File used purely to test the parser in potx.
File
tests/potx_test_8.module
View source
<?php
function potx_test_8_example() {
$a = new TranslationWrapper('TranslationWrapper string');
$b = new TranslationWrapper('TranslationWrapper string with context', array(), array(
'context' => 'With context',
));
$a
->debug('Debug message');
$b
->info('Info message');
$c
->notice('Notice message');
$d
->warning('Warning message');
$e
->error('Error message');
$f
->critical('Critical message');
$g
->alert('Alert message');
$h
->emergency('Emergency message');
$i
->log(1, 'Log message');
$j
->log('false positive');
$k
->log($boo, 'Log message 2');
$l
->log($another_false_positive);
$m
->log(potx_test_8_sample(), 'Log message 3');
$n
->log();
}
function potx_test_8_sample() {
}
function potx_test_8_empty() {
}
class PotxTestD8 {
function test_func() {
$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');
}
}
Functions
Name |
Description |
potx_test_8_empty |
Empty annotations are not allowed either. |
potx_test_8_example |
Plugin annotation
@TestAnnotation(
id = "test_annotation",
test_label = @Translation("Good translation annotation"),
test_label_context = @Translation("Translation in good context", context="Translation test")
) |
potx_test_8_sample |
Let's see if we catch errors in
Plugin annotation
@Translation() annotation.
@TestAnnotation2(
test_1 = @Translation("Bad translation annotation),
test_2 = @Translation("Another good translation annotation"),
test_3 = @Translation Even… |
Classes
Name |
Description |
PotxTestD8 |
Test parsing Drupal 8 $this->t and formatPlural function calls. |