You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside SearchOptions class the sort_options are a static member. As such they are evaluated the first time the module is loaded.
Translations of the title there use from invenio_i18n import gettext as _ which is applied at the load time, and translates the string using the initial locale.
When this member is accessed during the request under a different locale, no translation is performed and English text
is always used regardless of user's locale.
Steps to Reproduce
Spin up a repository and go to its search page. Switch locale to a different language and the sort options will
keep in English, will not change the translation.
Expected behavior
sort_options.title should be lazy translated, i.e. just replacing import from invenio_i18n import gettext as _ with from invenio_i18n import lazy_gettext as _ gets it working.
The text was updated successfully, but these errors were encountered:
mesemus
changed the title
Sort options are not translated as they are static and do not use lazy translations
Sort options are not translated as they do not use lazy translations
Oct 18, 2023
mesemus
changed the title
Sort options are not translated as they do not use lazy translations
Sort options are not translated
Oct 18, 2023
Package version (if known): all
Describe the bug
Inside SearchOptions class the
sort_options
are a static member. As such they are evaluated the first time the module is loaded.Translations of the title there use
from invenio_i18n import gettext as _
which is applied at the load time, and translates the string using the initial locale.When this member is accessed during the request under a different locale, no translation is performed and English text
is always used regardless of user's locale.
Steps to Reproduce
Spin up a repository and go to its search page. Switch locale to a different language and the sort options will
keep in English, will not change the translation.
Expected behavior
sort_options.title
should be lazy translated, i.e. just replacing importfrom invenio_i18n import gettext as _
withfrom invenio_i18n import lazy_gettext as _
gets it working.The text was updated successfully, but these errors were encountered: