diff --git a/packages/mana-l10n/src/l10n/index.ts b/packages/mana-l10n/src/l10n/index.ts index de681db..bc578f8 100644 --- a/packages/mana-l10n/src/l10n/index.ts +++ b/packages/mana-l10n/src/l10n/index.ts @@ -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;