From 1e2da772774f1cd4e1410adb99b421aa996fdf77 Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Fri, 13 Dec 2024 13:39:26 -0600 Subject: [PATCH 1/2] support per-language fonts (for Japanese etc) --- index.html | 2 +- js/localization.js | 12 ++++++++++++ locale/en/messages.json | 3 +++ locale/uk/messages.json | 3 +++ src/css/main.css | 6 +++++- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 6a5cfddce..d7681ca2d 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + diff --git a/js/localization.js b/js/localization.js index 2c7e49cd6..6da7a92ad 100644 --- a/js/localization.js +++ b/js/localization.js @@ -173,6 +173,11 @@ i18n.localize = function (reTranslate = false) { const element = $(this); element.attr('placeholder', translate(element.attr('i18n_placeholder'))); }); + + $('[i18n_lang]').each(function() { + const element = $(this); + element.attr('lang', translate(element.attr('i18n_lang'))); + }); } else { $('[i18n]:not(.i18n-replaced)').each(function() { @@ -234,6 +239,13 @@ i18n.localize = function (reTranslate = false) { element.attr('placeholder', translate(element.attr('i18n_placeholder'))); element.addClass('i18n_placeholder-replaced'); }); + + $('[i18n_lang]:not(.i18n_lang-replaced)').each(function() { + const element = $(this); + element.attr('lang', translate(element.attr('i18n_lang'))); + element.addClass('i18n_lang-replaced'); + }); + } return localized; diff --git a/locale/en/messages.json b/locale/en/messages.json index e0d9c2847..afef64449 100644 --- a/locale/en/messages.json +++ b/locale/en/messages.json @@ -6152,5 +6152,8 @@ }, "adsbHeartbeatTotalMessages": { "message": "Heartbeat msgs" + }, + "currentLanguage": { + "message": "en" } } diff --git a/locale/uk/messages.json b/locale/uk/messages.json index 74b236e97..bb0ab4a84 100644 --- a/locale/uk/messages.json +++ b/locale/uk/messages.json @@ -5926,5 +5926,8 @@ }, "adsbHeartbeatTotalMessages": { "message": "Повід. сигналів перевірки" + }, + "currentLanguage": { + "message": "uk" } } diff --git a/src/css/main.css b/src/css/main.css index 6a011d8eb..9dec4129e 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -2332,4 +2332,8 @@ ol li { .bold { font-weight: bold; -} \ No newline at end of file +} + +*:lang(ja) { + font-family:"ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro",Osaka, "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif; +} From 665bf19fb19fc1f61be5486bf2af502038788c0e Mon Sep 17 00:00:00 2001 From: Sensei Date: Fri, 13 Dec 2024 13:47:47 -0600 Subject: [PATCH 2/2] dd currentLanguage to zh_CN/messages.json --- locale/zh_CN/messages.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locale/zh_CN/messages.json b/locale/zh_CN/messages.json index 49debeeb2..9b2f7b4b2 100644 --- a/locale/zh_CN/messages.json +++ b/locale/zh_CN/messages.json @@ -6156,5 +6156,8 @@ }, "adsbHeartbeatTotalMessages": { "message": "心跳消息" + }, + "currentLanguage": { + "message": "zh-CN" } }