Skip to content
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

ADX-1014 Add Babel translation #6

Merged
merged 25 commits into from
Aug 1, 2023
Merged

ADX-1014 Add Babel translation #6

merged 25 commits into from
Aug 1, 2023

Conversation

kforenc
Copy link
Collaborator

@kforenc kforenc commented Jul 5, 2023

ADX-1014 Add Babel translation

Add translation feature of all messages in application. Move configuration into Config object pattern.

Dependency Changes (delete if not applicable)

flask-babel has been added in latest version, which changed a bit way of setting up translations comparing to navigator. Namely, the 'locale_selector' is a function passed into babel's init_app().

Testing (delete if not applicable)

Internationalisation and Localisation (delete if not applicable)

Translations to fr and pt_PT done.

Checklist

Put an x in the boxes that apply to this pull request (you can also fill these out after opening the pull request).
You may not need to check all boxes.

  • The Jira ticket for this issue has been updated to "Ready to Review" or equivalent.
  • I have developed these changes in discussion with the appropriate project manager.
  • My code follows the general Fjelltopp documentation (see Confluence).
  • I have made corresponding changes to the Fjelltopp documentation (see Confluence).
  • I have rebased this branch with master.
  • New dependency changes have been committed.
  • I have added automated tests that prove my fix is effective or that my feature works.
  • New and existing tests pass locally with my changes.
  • My changes generate no new warnings.
  • I have performed a self-review of my own code.
  • I have assigned at least one reviewer.

@kforenc kforenc requested a review from tomeksabala July 5, 2023 10:34
@kforenc kforenc marked this pull request as ready for review July 6, 2023 09:35
@@ -1,6 +1,7 @@
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, EmailField
from wtforms.validators import DataRequired, Email
from flask_babel import lazy_gettext as _l
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually we use only underscore as an alias to gettext. Please change to:

from flask_babel import lazy_gettext as _

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use it for lazy_gettext as well? This convention (_l) was suggested by Miguel Grindberg, as it's a different import. I suggest leave it as is, since lazy_gettext is different than gettext and to see this one would need to look at import statement.

config.py Outdated Show resolved Hide resolved
i18n/fr/LC_MESSAGES/messages.po Outdated Show resolved Hide resolved
ape/routes.py Outdated
+ urlencode(
{
"returnTo": url_for("main.home", _external=True),
"client_id": env.get("AUTH0_CLIENT_ID"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AUTH0_CLIENT_ID should be read from config?

ape/logic.py Outdated Show resolved Hide resolved
ape/healthz.py Outdated Show resolved Hide resolved
@kforenc kforenc requested a review from tomeksabala July 17, 2023 09:28
@tomeksabala tomeksabala merged commit 6c9a66c into master Aug 1, 2023
2 checks passed
@tomeksabala tomeksabala deleted the ADX-1014_Babel branch August 1, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants