tbaronnat/translation-bundle

Simple translation bundle system with Symfony integration

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:symfony-bundle

v2.0.0 2022-11-07 08:10 UTC

This package is not auto-updated.

Last update: 2024-05-09 14:53:37 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"