Skip to content

Commit

Permalink
Merge pull request #2271 from sensei-hacker/language_specific_font
Browse files Browse the repository at this point in the history
support per-language CSS / fonts (for Japanese etc)
  • Loading branch information
mmosca authored Dec 13, 2024
2 parents 56e5656 + 3078249 commit f454d6e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html i18n_lang="currentLanguage">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Expand Down
12 changes: 12 additions & 0 deletions js/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions locale/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6156,5 +6156,8 @@
},
"adsbHeartbeatTotalMessages": {
"message": "Heartbeat msgs"
},
"currentLanguage": {
"message": "en"
}
}
3 changes: 3 additions & 0 deletions locale/uk/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6122,5 +6122,8 @@
},
"adsbHeartbeatTotalMessages": {
"message": "Повід. сигналів перевірки"
},
"currentLanguage": {
"message": "uk"
}
}
3 changes: 3 additions & 0 deletions locale/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6156,5 +6156,8 @@
},
"adsbHeartbeatTotalMessages": {
"message": "心跳消息"
},
"currentLanguage": {
"message": "zh-CN"
}
}
6 changes: 5 additions & 1 deletion src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2332,4 +2332,8 @@ ol li {

.bold {
font-weight: bold;
}
}

*:lang(ja) {
font-family:"ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro",Osaka, "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif;
}

0 comments on commit f454d6e

Please sign in to comment.