i18n: use correct ISO 639-1 code for Korean with backward compat

recently the proxmox-i18n repo got a fix where we moved the files for
Korean to the correct language code, i.e., from previously wrong used
kr (Kanuri) to the correct ko (Korean).

This loads the correct ExtJS locale and is less confusing for our
Korean speakers, but we still want a clean transition for those that
have still the 'kr' value set in their language cookie.
Note that this transition only happens when the user opens the
language selector, as otherwise we do not have the product-specific
cookie name available, so a better transition would need to happen in
the per-product UIs.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-01-15 18:15:06 +01:00
parent 905528a28d
commit fc792d6411
2 changed files with 10 additions and 1 deletions

View File

@ -77,7 +77,7 @@ utilities: {
it: `Italiano - ${gettext("Italian")}`, it: `Italiano - ${gettext("Italian")}`,
ja: `日本語 - ${gettext("Japanese")}`, ja: `日本語 - ${gettext("Japanese")}`,
ka: `ქართული - ${gettext("Georgian")}`, ka: `ქართული - ${gettext("Georgian")}`,
kr: `한국어 - ${gettext("Korean")}`, ko: `한국어 - ${gettext("Korean")}`,
nb: `Bokmål - ${gettext("Norwegian (Bokmal)")}`, nb: `Bokmål - ${gettext("Norwegian (Bokmal)")}`,
nl: `Nederlands - ${gettext("Dutch")}`, nl: `Nederlands - ${gettext("Dutch")}`,
nn: `Nynorsk - ${gettext("Norwegian (Nynorsk)")}`, nn: `Nynorsk - ${gettext("Norwegian (Nynorsk)")}`,
@ -96,6 +96,9 @@ utilities: {
if (!value || value === '__default__') { if (!value || value === '__default__') {
return Proxmox.Utils.defaultText + ' (English)'; return Proxmox.Utils.defaultText + ' (English)';
} }
if (value === 'kr') {
value = 'ko'; // fix-up wrongly used Korean code. FIXME: remove with trixie releases
}
let text = Proxmox.Utils.language_map[value]; let text = Proxmox.Utils.language_map[value];
if (text) { if (text) {
return text + ' (' + value + ')'; return text + ' (' + value + ')';

View File

@ -12,6 +12,12 @@ Ext.define('Proxmox.window.LanguageEditWindow', {
xclass: 'Ext.app.ViewController', xclass: 'Ext.app.ViewController',
init: function(view) { init: function(view) {
let language = Ext.util.Cookies.get(view.cookieName) || '__default__'; let language = Ext.util.Cookies.get(view.cookieName) || '__default__';
if (language === 'kr') {
// fix-up wrongly used Korean code before FIXME: remove with trixie releases
language = 'ko';
let expire = Ext.Date.add(new Date(), Ext.Date.YEAR, 10);
Ext.util.Cookies.set(view.cookieName, language, expire);
}
this.getViewModel().set('language', language); this.getViewModel().set('language', language);
}, },
applyLanguage: function(button) { applyLanguage: function(button) {