-
Notifications
You must be signed in to change notification settings - Fork 177
Support for ICU-based message formatting, close #256 #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
what should happen is that the domain filter accepts both |
How Symfony handle |
yes it is. The opt-in is per file thanks to the suffix in the domain. The handling in Symfony is done at the translator level (and in a few other places like the commands dealing with catalogues with support for a domain filtering): https://github.com/symfony/symfony/blob/669b3dfd42e382c61a2f540ca518d1ccb5a6ebee/src/Symfony/Component/Translation/Translator.php#L217-L221 |
Nice, thanks. |
I think this PR is ready to be reviewed. The final user should have nothing to change to use translations from ICU domains, except to make library Given the following translations files: # translations/messages.en.yaml
hello: Hello!
# translations/messages+intl-icu.en.yaml
hello_name: Hello {name}! This HTTP call will return translations for <script src="{{ url('bazinga_jstranslation_js', { 'domain': 'messages' }) }}"></script> And there is nothing to change with Translator.trans('hello', {}, 'messages'); // Hello!
Translator.trans('hello_name', { name: 'John' }, 'messages'); // Hello John! Like Symfony's Translator, ICU translations have an higher priority than "classic" translations. Note that ICU support has not been implemented in
I've also did some improvments to the Travis show some failing tests, but I don't think this is related to this PR:
What do you think? |
Sorry for the late reply. Looks good to me. I need to fix the Travis tests. |
Is there any chance, that this is going to be merged anytime soon? |
PR under development, I need to update the JS part to support ICU templates.Close #256.
I'm thinking about using intl-messageformat dependency, it provides a simple API to format one message (and not a whole catalogs like other librairies).
Example:
EDIT: See #288 (comment)