Skip to content

Commit

Permalink
Fix: compat with the navigator language return with underslash (#6907)
Browse files Browse the repository at this point in the history
* fix: compat with the naviator language return with underslash

* Update CHANGELOG.md
  • Loading branch information
ClarkXia authored Jun 5, 2024
1 parent 69c0f5a commit 8780bc8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/plugin-intl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @ice/plugin-intl

## 1.0.2

fix: compat with the navigator language return with underslash.

## 1.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-intl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/plugin-intl",
"version": "1.0.1",
"version": "1.0.2",
"description": "react intl plugin for ice.js 3.",
"files": [
"esm",
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-intl/src/runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ const cache = createIntlCache();

const getDefaultLocale = () => {
// @ts-ignore
return (typeof window !== 'undefined' && window.__ICE_DEFAULT_LOCALE__) ||
const defaultLocale = (typeof window !== 'undefined' && window.__ICE_DEFAULT_LOCALE__) ||
(typeof navigator !== 'undefined' && navigator.language) ||
'zh-CN';
return defaultLocale.replace('_', '-');
};

const getLocaleMessages = () => {
Expand Down

0 comments on commit 8780bc8

Please sign in to comment.