mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
create an helper + twig filter to show translatable string in current locale.
The twig filter is localize_translatable_string Example : {{ person.nationality|localize_translatable_string }} The helper may be called with $container->get('chill.main.helper.translatable_string'). The main function is ->localize(array $strings) Example: $container->get('chill.main.helper.translatable_string')->localize($country->getName()); #return the name in current locale close #299
This commit is contained in:
@@ -25,10 +25,19 @@ services:
|
||||
- "%locale%"
|
||||
tags:
|
||||
- { name: form.type, alias: translatable_string }
|
||||
|
||||
|
||||
chill.main.helper.translatable_string:
|
||||
class: Chill\MainBundle\Templating\TranslatableStringHelper
|
||||
arguments:
|
||||
- "@request_stack"
|
||||
|
||||
chill.main.twig.translatable_string:
|
||||
class: Chill\MainBundle\Templating\TranslatableStringTwig
|
||||
calls:
|
||||
- [ setContainer, ["@service_container"]]
|
||||
tags:
|
||||
- { name: twig.extension }
|
||||
|
||||
chill.main.form.type.select2choice:
|
||||
class: Chill\MainBundle\Form\Type\Select2ChoiceType
|
||||
|
Reference in New Issue
Block a user