Skip to content

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
@samuelhwilliams samuelhwilliams mentioned this pull request Jul 20, 2024
19 tasks
@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