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

Using lazy_gettext in boot-time translations #1241

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mesemus
Copy link
Contributor

@mesemus mesemus commented Oct 23, 2024

Description

This pull request fixes premature evaluation of i18n strings inside static fields. gettext call, that causes
the evaluation to be performed at boot time, was replaced with gettext_lazy that is performed at
request time. This fixes facet labels not being translated when language is changed.

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@mesemus
Copy link
Contributor Author

mesemus commented Oct 23, 2024

Please backport this change to RDM 12

@Samk13 Samk13 added the i18n translation label Oct 23, 2024
* the problem was that with gettext the translations for facets
  have been only calculated on boot time.

* using lazy_gettext instead fixes that, because it calculates
  the translation at the request level

Co-authored-by: Mirek Simek <miroslav.simek@cesnet.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n translation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants