preaction / Yancy

The Best Web Framework Deserves the Best Content Management System
http://preaction.me/yancy/
Other
54 stars 21 forks source link

Yancy internationalization #102

Closed pavelsr closed 4 years ago

pavelsr commented 4 years ago

Hi Doug,

Don't you think that we need to add i18n support in Yancy? E.g. if I need to make login form labels in Russian I have to modify them by Javascript, that's is not convenient. My conception is here, I suggest to use Mojolicious::Plugin::I18N plugin. If you like this feature and my realization I can continue to add i18n support for other templates.

preaction commented 4 years ago

Yes, that's a great idea! We absolutely should have some kind of i18n built-in along with other languages supported out-of-the-box. This looks like a great start!

You also have the option of overriding the template: Make a templates/yancy/auth/password directory in your application's directory and add your custom login_form.html.ep template there.

If you're okay with it being experimental until v2.0 is released, I can add i18n to the v2 roadmap (#25) and we can start from here. I imagine this is going to be a bit of work: The templates and code are going to be easy, I think, but making a way to localize the schema's title/description fields so that each user can have their own language in the editor might more difficult... We'll probably have to start a Yancy::I18n namespace and document how to extend one of the Yancy i18n modules with custom strings.

preaction commented 4 years ago

Merged #103 via the command line. Thanks!

preaction commented 4 years ago

I also added the i18n requirements to the v2 roadmap here: https://github.com/preaction/Yancy/issues/25. Does this look complete? In short: User-facing messages are displayed in the user's language, and internal-only messages are displayed in the developer's language.