tbaronnat / translation-bundle
Simple translation bundle system with Symfony integration
v2.0.0
2022-11-07 08:10 UTC
Requires
- php: >=8.1
- symfony/dependency-injection: ^6.0
- symfony/translation: ^6.0
- symfony/twig-bundle: ^6.0
- twig/twig: ^2.0|^3.0
This package is not auto-updated.
Last update: 2025-04-10 18:58:30 UTC
README
First, use twig function in your main template to append all translations for specific domain :
{{ js_translations(app.request.getLocale(), 'messages')|raw }}
Then, to translate any key from this domain, use javascript function :
In messages.en.yml
message.hello: "Hello %name%"
Then, to translate with javascript:
const params = {"%name%": "Theo"};
let translation = TRANSLATIONS.trans('message.hello', params)
translation = "Hello Theo"