-
Notifications
You must be signed in to change notification settings - Fork 9
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
Backend Localization #218
Backend Localization #218
Conversation
- Adds starlette_context so we can safely have per-request data - Adds a middleware to read accept-language and load fluent - Adds a `l10n` helper function to localize a given key - Adjusts the health check to return a distinct string between locales (we use this for tests...) - A couple of string -> fluent conversions
This requires a local `-e` build for tests to work.
800f24e
to
41ea857
Compare
1e5d03b
to
4de96c1
Compare
…hat in the dependency. Also re-org the exception to a separate file.
|
||
# Should indicate application wellness. | ||
# (This was google translated, sorry.) | ||
health-ok = Das System ist betriebsbereit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha it's alright 👍🏻 I'll look over German translation when this PR is out of draft state
And it should be good! Feel free to wait until the new year 😅. |
…tabase url for docker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. I added small bug fixes and the German translation. Although _()
would have been shorter an cleaner, I quickly got used to l10n()
. Thank you, Mel!
Localization! I hear it's neat. Here's the initial pass at adding fluent-based localization to backend. Feel free to be opinionated on this stuff. If you think strings need to be pulled into separate files based on category let me know! Also let me know if I missed any strings.
Breaking Changes:
cd backend && pip install -e .
/backend
instead of/backend/test
Additions:
l10n
helper that accepts a msg-id and optionally a dictionary of data for that message.main.ftl
andemail.ftl
Notes:
_
as the localization helper to avoid association with gettext (as the call is a bit different.)