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 import from invenio_i18n import gettext as _ with from invenio_i18n import lazy_gettext as _ gets it working.
Package version (if known): all
Describe the bug
Inside SearchOptions class the
sort_optionsare 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.titleshould be lazy translated, i.e. just replacing importfrom invenio_i18n import gettext as _withfrom invenio_i18n import lazy_gettext as _gets it working.