LOCALE_PATH causes message mo files not found
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Dashboard (Horizon) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Current default LOCALE_PATH is defined in openstack_
LOCALE_PATHS = [
'horizon/
'openstack_
]
They work fine in the development environment. However if Horizon path installed in production is like
/opt/stack/
/opt/stack/
when reset locale in the settings, the selected settings won't get saved and the translation won't happen.
because of the relative locale path in settings.py, without overwriting the path in local_settings.py.
/openstack_
check_for_language returns false
if lang_code and translation.
updated settings.py seem to fix the problem, however, still not clear what to do with horizon/locale
Change LOCALE_PATHS = [
'horizon/
# 'openstack_
os.
]
Changed in horizon: | |
assignee: | nobody → Gloria Gu (gloria-gu) |
As described in the django document [1], Django looks for and uses if it exists a locale directory in each of the installed apps listed in INSTALLED_APPS. Horizon plugin translations already depend on this mechanism. "horizon", "openstack_ dashboard" and "openstack_auth" are all specified in INSTALL_APPS, so we don't need to specify LOCALE_PATHS explicitly.
Even when you have horizon and openstack_dashboard in different places, if translations are stored in horizon/locale and openstack_ dashboard/ locale, translation should work.
If you would like to have translations in other places, you need to configure LOCALE_PATHS manually.
From the above reason, I mark this bug as Incomplete.
P.S. Anyway, we can drop LOCALE_PATHS from openstack_ dashboard/ settings. py, but it is just related to this bug.
[1] https:/ /docs.djangopro ject.com/ en/2.1/ topics/ i18n/translatio n/#how- django- discovers- translations