From fc792d6411a4980b8ef1d4e441a8d7ebd40cf506 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 15 Jan 2024 18:15:06 +0100 Subject: [PATCH] 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 --- src/Utils.js | 5 ++++- src/window/LanguageEdit.js | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Utils.js b/src/Utils.js index 0a6d263..009e222 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -77,7 +77,7 @@ utilities: { it: `Italiano - ${gettext("Italian")}`, ja: `日本語 - ${gettext("Japanese")}`, ka: `ქართული - ${gettext("Georgian")}`, - kr: `한국어 - ${gettext("Korean")}`, + ko: `한국어 - ${gettext("Korean")}`, nb: `Bokmål - ${gettext("Norwegian (Bokmal)")}`, nl: `Nederlands - ${gettext("Dutch")}`, nn: `Nynorsk - ${gettext("Norwegian (Nynorsk)")}`, @@ -96,6 +96,9 @@ utilities: { if (!value || value === '__default__') { 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]; if (text) { return text + ' (' + value + ')'; diff --git a/src/window/LanguageEdit.js b/src/window/LanguageEdit.js index 2269a45..adbda9a 100644 --- a/src/window/LanguageEdit.js +++ b/src/window/LanguageEdit.js @@ -12,6 +12,12 @@ Ext.define('Proxmox.window.LanguageEditWindow', { xclass: 'Ext.app.ViewController', init: function(view) { 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); }, applyLanguage: function(button) {