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 = new TranslatableMarkup('TranslatableMarkup string');
$b = new TranslatableMarkup('TranslatableMarkup 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');
$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',
));
}
}
function potx_test_inline_templates() {
$render_array = array(
'#type' => 'inline_template',
'#template' => "Here is a {% trans 'Test translatable string inside an inline template' %}.",
);
$render_array['#template'] = 'Here is {% trans %}Another test translatable string inside an inline template{% endtrans %}';
$render_array["#template"] = 'Here is {% trans %}A translatable string inside an inline template, with double-quoted "#template" key{% endtrans %}';
}