From c396124bc9fa6ae162f9634869e16a694c8d2525 Mon Sep 17 00:00:00 2001 From: tomasz1986 Date: Tue, 8 Feb 2022 07:07:22 +0100 Subject: [PATCH] gui: Don't use italic text for CJK languages (#8172) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even though technically possible, CJK languages normally don't use italic text at all, as not only does it make the characters/letters look unnatural, but also, in the case of complex characters, unreadable too. For these reasons, it is usually recommended not to use the italic font style at all [1][2]. This commit changes the default font-style of the i element for Chinese, Japanese, and Korean langauge to "normal" instead of "italic". In order to do so, the HTML lang attribute is also changed following each change of the GUI language. [1] https://bobtung.medium.com/best-practice-in-chinese-layout-f933aff1728f [2] https://devblogs.microsoft.com/oldnewthing/20060914-02/?p=29743 Signed-off-by: Tomasz WilczyƄski --- gui/default/assets/css/overrides.css | 7 +++++++ gui/default/syncthing/core/localeService.js | 1 + 2 files changed, 8 insertions(+) diff --git a/gui/default/assets/css/overrides.css b/gui/default/assets/css/overrides.css index 410e59733..b2d93950a 100644 --- a/gui/default/assets/css/overrides.css +++ b/gui/default/assets/css/overrides.css @@ -506,3 +506,10 @@ ul.three-columns li, ul.two-columns li { padding-top: 6px; padding-bottom: 6px; } + +/* CJK languages don't use italic at all, hence don't force it on them. */ +html[lang|="zh"] i, +html[lang="ja"] i, +html[lang|="ko"] i { + font-style: normal; +} diff --git a/gui/default/syncthing/core/localeService.js b/gui/default/syncthing/core/localeService.js index 868f400a3..8486df768 100644 --- a/gui/default/syncthing/core/localeService.js +++ b/gui/default/syncthing/core/localeService.js @@ -99,6 +99,7 @@ angular.module('syncthing.core') function useLocale(language, save2Storage) { if (language) { $translate.use(language).then(function () { + document.documentElement.setAttribute("lang", language); if (save2Storage && _localStorage) _localStorage[_SYNLANG] = language; });