mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Change CSS font-family by language preference
Fixes https://github.com/jellyfin/jellyfin-web/issues/913. - Update `lang` attribute of `html` element on user preference change. - Choose appropriate `font-family` depending on `lang` attribute using attribute selectors in CSS. - Add `Noto Sans TC`, the Traditional Chinese (Taiwan variant). - Fix event listener registration in `globalize.js`.
This commit is contained in:
parent
0895163344
commit
88e129f793
9 changed files with 1564 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
import { Events } from 'jellyfin-apiclient';
|
||||
import isEmpty from 'lodash-es/isEmpty';
|
||||
|
||||
import * as userSettings from './settings/userSettings';
|
||||
import { currentSettings as userSettings } from './settings/userSettings';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
|
|
@ -274,11 +274,24 @@ async function onAppReady() {
|
|||
}
|
||||
};
|
||||
|
||||
Events.on(ServerConnections, 'localusersignedin', handleStyleChange);
|
||||
Events.on(ServerConnections, 'localusersignedout', handleStyleChange);
|
||||
const handleLanguageChange = () => {
|
||||
const locale = globalize.getCurrentLocale();
|
||||
|
||||
document.documentElement.setAttribute('lang', locale);
|
||||
};
|
||||
|
||||
const handleUserChange = () => {
|
||||
handleStyleChange();
|
||||
handleLanguageChange();
|
||||
};
|
||||
|
||||
Events.on(ServerConnections, 'localusersignedin', handleUserChange);
|
||||
Events.on(ServerConnections, 'localusersignedout', handleUserChange);
|
||||
Events.on(currentSettings, 'change', (e, prop) => {
|
||||
if (prop == 'disableCustomCss' || prop == 'customCss') {
|
||||
handleStyleChange();
|
||||
} else if (prop == 'language') {
|
||||
handleLanguageChange();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue