File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,17 @@ const LocaleProvider = props => {
19
19
fetchPolicy : 'cache-and-network' ,
20
20
nextFetchPolicy : 'cache-first'
21
21
} ) ;
22
+ let locale = data !== undefined ? data . storeConfig . locale : DEFAULT_LOCALE ;
23
+ if ( locale === 'zh_Hant_TW' ) {
24
+ locale = 'zh_TW' ;
25
+ }
26
+ if ( locale === 'zh_Hant_TW' ) {
27
+ locale = 'zh_TW' ;
28
+ }
22
29
23
30
const language = useMemo ( ( ) => {
24
31
return data && data . storeConfig . locale
25
- ? toReactIntl ( data . storeConfig . locale )
32
+ ? toReactIntl ( locale )
26
33
: DEFAULT_LOCALE ;
27
34
} , [ data ] ) ;
28
35
Original file line number Diff line number Diff line change 5
5
* @returns {string } A locale string (e.g. `fr_FR`).
6
6
*/
7
7
export const fromReactIntl = string => {
8
- return string . replace ( '-' , '_' ) ;
8
+ return string . replace ( / - / g , '_' ) ;
9
9
} ;
10
10
11
11
/**
@@ -15,5 +15,5 @@ export const fromReactIntl = string => {
15
15
* @returns {string } A string (e.g. `fr-FR`).
16
16
*/
17
17
export const toReactIntl = string => {
18
- return string . replace ( '_' , '-' ) ;
18
+ return string . replace ( / _ / g , '-' ) ;
19
19
} ;
You can’t perform that action at this time.
0 commit comments