mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 21:24:35 +04:00
luci-base: dispatcher.uc: ensure usage of dashes in language tags
The LuCI uci configuration requires language tags with underscores due limitations of uci option names but the language catalogs themselves are designated with dash separated language tags. Make sure to substitute underscores with dashes when determining the desired request language in order to fix loading of languages such as `pt-br` or `zh-cn`. Ref: https://github.com/openwrt/luci/pull/5976#issuecomment-1290352951 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
@@ -103,6 +103,8 @@ function determine_request_language() {
|
|||||||
|
|
||||||
if (lang == 'auto')
|
if (lang == 'auto')
|
||||||
lang = 'en';
|
lang = 'en';
|
||||||
|
else
|
||||||
|
lang = replace(lang, '_', '-');
|
||||||
|
|
||||||
if (load_catalog(lang, '/usr/lib/lua/luci/i18n'))
|
if (load_catalog(lang, '/usr/lib/lua/luci/i18n'))
|
||||||
change_catalog(lang);
|
change_catalog(lang);
|
||||||
|
|||||||
Reference in New Issue
Block a user