-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
I18N support in jooby. #755
Comments
i18n is/should-be a template engine concern. which template engine are you? |
Yes you are right, mostly it is a template engine concern. I am going to choose one from Freemarker and Pebble. I haven't seen information about i18n in Freemarker's documentation. Pebble provides a function i18n(basename, key, args...), which works well. But I don't like to specify the resource bundle basename for every i18n function call in template. I prefer it like i18n(key, args...) because I hope:
That's why I post this issue/request. If Jooby doesn't provide this support on framework level, I would have to implement it on application level, or maybe in the form of an jooby extension module. Would appreciate to have your suggestion. Thanks. |
Good points. I implemented an i18n application with handlebars.java and jooby. It was a mix of request local variable and cookie. A generic module which expose locale to request local variable will be a good addition. Locale might come from cookie, accept-lang header, etc.. |
Hi @jknack, So, I proposal that Jooby should provide some built-in support for i18n. Briefly it can dynamically parse locale information from client-side request, store it as a request or session variable, and pass it to the view engine(not limited to Pebble) before rendering. With this supoport we can easily make i18n extensions for all kind of template engines. |
Going to update pebble (and any other engine with built-in support for locale object). This is how will works:
If you do nothing locale is resolved against the If none of those works for you, you can set a req local attribute:
Will send a pull request shortly, so you can review it |
Perfect. Looking forward to use it in the coming release. |
Hi @jknack ,
I searched the whole online documentation of Jooby and didn't find content about i18n. Is there any built-in support for i18n in Jooby? Could you please provide some hints or suggestion path to do i18n in my jooby application? Thanks.
The text was updated successfully, but these errors were encountered: