File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 1
1
import en from "./locales/en" ;
2
2
import zhCN from "./locales/zh_CN" ;
3
3
4
-
5
- const lang = window . localStorage . getItem ( 'language' ) ;
4
+ const lang = window . localStorage . getItem ( "language" ) ;
6
5
7
6
const localeMap : { [ k : string ] : Partial < typeof en > } = {
8
7
en,
9
- zh : zhCN ,
8
+ zh : zhCN
10
9
} ;
11
- const userLocale = localeMap [ lang || 'en' ] ;
10
+ const userLocale = localeMap [ lang || "en" ] ;
12
11
13
12
export default function t ( str : keyof typeof en , ...inserts : string [ ] ) : string {
14
- let localeStr = ( userLocale && userLocale [ str ] ) ?? en [ str ] ;
13
+ let localeStr = ( userLocale && userLocale [ str ] ) ?? en [ str ] ?? str ;
15
14
16
15
for ( let i = 0 ; i < inserts . length ; i ++ ) {
17
16
localeStr = localeStr . replace ( `%${ i + 1 } ` , inserts [ i ] ) ;
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ export default {
13
13
"Could not parse GeoJSON file" : "Could not parse GeoJSON file" ,
14
14
"Could not parse overlay radius. Please make sure it is in the format `<length> <unit>`." :
15
15
"Could not parse overlay radius. Please make sure it is in the format `<length> <unit>`." ,
16
- "There was an error with the provided latitude. Using defaults ." :
17
- "There was an error with the provided latitude. Using defaults ." ,
18
- "There was an error with the provided longitude. Using defaults ." :
19
- "There was an error with the provided longitude. Using defaults ." ,
16
+ "There was an error with the provided latitude. Using default ." :
17
+ "There was an error with the provided latitude. Using default ." ,
18
+ "There was an error with the provided longitude. Using default ." :
19
+ "There was an error with the provided longitude. Using default ." ,
20
20
21
21
//loader.ts
22
22
"There was an issue getting the image dimensions." :
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ export default {
13
13
"Could not parse GeoJSON file" : "无法解析 GeoJSON 文件" ,
14
14
"Could not parse overlay radius. Please make sure it is in the format `<length> <unit>`." :
15
15
"无法解析覆盖半径. 请确保格式为 `<长度> <单位>`." ,
16
- "There was an error with the provided latitude. Using defaults ." :
16
+ "There was an error with the provided latitude. Using default ." :
17
17
"提供的纬度有误. 使用默认值." ,
18
- "There was an error with the provided longitude. Using defaults ." :
18
+ "There was an error with the provided longitude. Using default ." :
19
19
"提供的经度有误. 使用默认值." ,
20
20
21
21
//loader.ts
You can’t perform that action at this time.
0 commit comments