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

Fix already exists translation #2464

Merged
merged 2 commits into from
Jul 20, 2024
Merged

Fix already exists translation #2464

merged 2 commits into from
Jul 20, 2024

Conversation

samuelhwilliams
Copy link
Contributor

There are two problems with the translation of this string:

  1. We use WTForm's translation rather than Flask-Admin's, so the translation isn't found.
  2. We cache the result of the first translation for the lifetime of the app. This means that if the user changes language dynamically, the message is not re-translated. By using lazy_gettext we can force the message to be translated every time the unique constraint is called.

fix: #2108

There are two problems with the translation of this string:

1) We use WTForm's translation rather than Flask-Admin's, so the
translation isn't found.
2) We cache the result of the first translation for the lifetime of the
app. This means that if the user changes language dynamically, the
message is not re-translated. By using `lazy_gettext` we can force the
message to be translated every time the unique constraint is called.
@samuelhwilliams samuelhwilliams merged commit 6e7ecfd into pallets-eco:master Jul 20, 2024
8 checks passed
@samuelhwilliams samuelhwilliams deleted the fix-already-exists-translation branch July 23, 2024 18:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

There might be a bug when localizing with Flask-Babelex
1 participant