JavaScript-enabled Translation
Translations directly imported in JavaScript
Write & manage your translations like you always do. Then use them just as easily in JS.
composer require symfony/ux-translator
hello: 'Hello!'
say_hello: 'Hello {name}!'
# Select
invitation_title: >-
{organizer_gender, select,
female {{organizer_name} has invited you to her party!}
male {{organizer_name} has invited you to his party!}
multiple {{organizer_name} have invited you to their party!}
other {{organizer_name} has invited you to their party!}
}
# Pluralization
num_of_apples: >-
{apples, plural,
=0 {There are no apples}
=1 {There is one apple...}
other {There are # apples!}
}
# Ordinal
finish_place: >-
You finished {place, selectordinal,
one {#st}
two {#nd}
few {#rd}
other {#th}
}!
# Date and Time
published_at: 'Published at {publication_date, date} - {publication_date, time, short}'
# Numbers
progress: '{progress, number, percent} of the work is done'
value_of_object: 'This artifact is worth {value, number, ::currency/EUR}'
hello: 'Bonjour !'
say_hello: 'Bonjour {name} !'
# Select
invitation_title: >-
{organizer_gender, select,
female {{organizer_name} t'a invité à sa fête !}
male {{organizer_name} t'a invité à sa fête !}
multiple {{organizer_name} t'a invité à sa fête !}
other {{organizer_name} t'a invité à sa fête !}
}
# Pluralization
num_of_apples: >-
{apples, plural,
=0 {Il n'y a pas de pommes}
=1 {Il y a une pomme...}
other {Il y a # pommes !}
}
# Ordinal
finish_place: >-
Tu as terminé {place, selectordinal,
one {#er}
other {#e}
} !
# Date and Time
published_at: 'Publié le {publication_date, date} - {publication_date, time, short}'
# Numbers
progress: '{progress, number, percent} du travail est fait'
value_of_object: "Cet artéfact vaut {value, number, ::currency/EUR}"

UX Translator
Code
Result
Parameters
Install It
$ composer require symfony/ux-translator
$ npm install --force
$ npm run watch