public function InterfaceTranslationTestController::content in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 4.0.x tests/modules/lingotek_interface_translation_test/src/Controller/InterfaceTranslationTestController.php \Drupal\lingotek_interface_translation_test\Controller\InterfaceTranslationTestController::content()
- 3.3.x tests/modules/lingotek_interface_translation_test/src/Controller/InterfaceTranslationTestController.php \Drupal\lingotek_interface_translation_test\Controller\InterfaceTranslationTestController::content()
- 3.4.x tests/modules/lingotek_interface_translation_test/src/Controller/InterfaceTranslationTestController.php \Drupal\lingotek_interface_translation_test\Controller\InterfaceTranslationTestController::content()
- 3.5.x tests/modules/lingotek_interface_translation_test/src/Controller/InterfaceTranslationTestController.php \Drupal\lingotek_interface_translation_test\Controller\InterfaceTranslationTestController::content()
- 3.6.x tests/modules/lingotek_interface_translation_test/src/Controller/InterfaceTranslationTestController.php \Drupal\lingotek_interface_translation_test\Controller\InterfaceTranslationTestController::content()
- 3.7.x tests/modules/lingotek_interface_translation_test/src/Controller/InterfaceTranslationTestController.php \Drupal\lingotek_interface_translation_test\Controller\InterfaceTranslationTestController::content()
- 3.8.x tests/modules/lingotek_interface_translation_test/src/Controller/InterfaceTranslationTestController.php \Drupal\lingotek_interface_translation_test\Controller\InterfaceTranslationTestController::content()
1 string reference to 'InterfaceTranslationTestController::content'
- lingotek_interface_translation_test.routing.yml in tests/
modules/ lingotek_interface_translation_test/ lingotek_interface_translation_test.routing.yml - tests/modules/lingotek_interface_translation_test/lingotek_interface_translation_test.routing.yml
File
- tests/
modules/ lingotek_interface_translation_test/ src/ Controller/ InterfaceTranslationTestController.php, line 13
Class
Namespace
Drupal\lingotek_interface_translation_test\ControllerCode
public function content(Request $request) {
$build = [];
// Context management.
$build['context_test']['one context'] = [
'#prefix' => '<p>',
'#suffix' => '</p>',
'#markup' => $this
->t('This is test of context', [], [
'context' => 'multiple p',
]),
];
$build['context_test']['another context'] = [
'#prefix' => '<p>',
'#suffix' => '</p>',
'#markup' => $this
->t('This is test of context', [], [
'context' => 'multiple t',
]),
];
$build['context_test']['no context'] = [
'#prefix' => '<p>',
'#suffix' => '</p>',
'#markup' => $this
->t('This is test of context'),
];
// Plurals management.
$count = $request->query
->get('count') ?: 1;
$build['plurals'] = [
'#prefix' => '<p>',
'#suffix' => '</p>',
'#markup' => $this
->formatPlural($count, 'This is a singular example', 'This is a plural @count example'),
'#cache' => [
'max-age' => 0,
],
];
return $build;
}