gui: Don't use italic text for CJK languages (#8172)

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 <twilczynski@naver.com>
This commit is contained in:
tomasz1986 2022-02-08 07:07:22 +01:00 committed by GitHub
parent d35d7d2360
commit c396124bc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -506,3 +506,10 @@ ul.three-columns li, ul.two-columns li {
padding-top: 6px; padding-top: 6px;
padding-bottom: 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;
}

View File

@ -99,6 +99,7 @@ angular.module('syncthing.core')
function useLocale(language, save2Storage) { function useLocale(language, save2Storage) {
if (language) { if (language) {
$translate.use(language).then(function () { $translate.use(language).then(function () {
document.documentElement.setAttribute("lang", language);
if (save2Storage && _localStorage) if (save2Storage && _localStorage)
_localStorage[_SYNLANG] = language; _localStorage[_SYNLANG] = language;
}); });