Skip to content

Commit

Permalink
fix(l10n): use localStorage in web environment
Browse files Browse the repository at this point in the history
  • Loading branch information
BroKun committed Nov 15, 2024
1 parent 943ae59 commit e14902f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/mana-l10n/src/l10n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export enum L10nLang {
}

function getDefaultlang() {
const localeValue = localStorage?.getItem('locale') || locale;
let localeValue = locale;
if (typeof navigator === 'object') {
localeValue = localStorage?.getItem('locale') || locale;
}
const localeStr = localeValue.toLowerCase();
if (localeStr === 'zh' || localeStr.startsWith('zh-')) {
return L10nLang.zhCN;
Expand Down

0 comments on commit e14902f

Please sign in to comment.