-
Notifications
You must be signed in to change notification settings - Fork 15
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
Internationalization/localization (i18n/l10n) #208
Comments
No discussion about it yet. I never used i18n/l10n so I don't know what API users expect, etc. Maybe @Kijewski has some ideas already? In any case, if you have suggestions, it's very welcome. |
The problem I have is that I don't quite like any of the existing i18n libraries. Fluent-bundle is very useful, but it's evaluated at runtime, which is not a good fit for rinja, IMO. Also, any solution should be "HTML-aware", so any variables get escaped, but only variables, not the whole string. And mentioning "string", the result should not be collected into a "String" first, but be rendered into its destination directly. The crazy idea I had was to use |
Sure, I can definitely expand on this. In my case, I maintain a large foss Laravel application (framework docs are here: https://laravel.com/docs/localization) containing ~49k lines of html templates across 400 files. The way it works is the following:
There are a few things done here that aren't really idiomatic to rust:
I have tried a few rust i18n libraries in the past, and haven't yet found one that stuck with me that offers a similar level of convenience, but that also offers the compile-time guarantee of rust. |
Askama had numerous i18n pull requests over time, none of which were ever merged. They might be some source of inspiration – they all are based on Fluent templates, I think, so not necessarily what rinja is looking for.
There's also a discussion here: From my side, this feature would be great to have – I'm also willing to contribute when we know what we're looking for. |
Is there any possibility of adding internationalization support to rinja?
In the blog post https://blog.guillaume-gomez.fr/articles/2024-07-31+docs.rs+switching+jinja+template+framework+from+tera+to+rinja, I noticed:
I'd be delighted in seeing such support added. Has there been any discussion yet as to the desired syntax and api for it to be implemented?
The text was updated successfully, but these errors were encountered: