feat: 国际化语言切换时切换字体

This commit is contained in:
baiqi 2023-06-07 14:22:13 +08:00 committed by rubylliu
parent 6f15741496
commit b8a3ed8ed6
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,13 @@ import type { LocaleType } from '#/global';
export function setHtmlPageLang(locale: LocaleType) { export function setHtmlPageLang(locale: LocaleType) {
document.querySelector('html')?.setAttribute('lang', locale); document.querySelector('html')?.setAttribute('lang', locale);
let fontFamily = '';
if (locale === 'en-US') {
fontFamily = 'Helvetica Neue, Arial';
} else {
fontFamily = 'PingFang SC, Microsoft YaHei';
}
document.body.style.fontFamily = fontFamily;
} }
export const loadLocalePool: LocaleType[] = []; export const loadLocalePool: LocaleType[] = [];