File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,30 @@ export class ThyI18nService {
19
19
[ ThyI18nLocale . ruRu ] : ruRuLocale . translations
20
20
} ;
21
21
22
- private defaultLocale : ThyI18nLocale = inject ( THY_I18N_DEFAULT_LOCALE_TOKEN , { optional : true } ) || ThyI18nLocale . zhCn ;
22
+ private defaultLocale : ThyI18nLocale = inject ( THY_I18N_DEFAULT_LOCALE_TOKEN , { optional : true } ) || this . getDefaultLocaleId ( ) ;
23
23
24
24
private locale : WritableSignal < ThyI18nTranslation > = signal ( this . locales [ this . defaultLocale ] ) ;
25
25
26
26
private normalizeLocale ( id : string ) {
27
27
return ( id ?. toLowerCase ( ) as ThyI18nLocale ) ?? ThyI18nLocale . zhCn ;
28
28
}
29
29
30
+ private getDefaultLocaleId ( ) : ThyI18nLocale {
31
+ let defaultLocaleId = ThyI18nLocale . zhCn ;
32
+ const allLocales = [
33
+ ThyI18nLocale . zhCn ,
34
+ ThyI18nLocale . zhTw ,
35
+ ThyI18nLocale . enUs ,
36
+ ThyI18nLocale . jaJp ,
37
+ ThyI18nLocale . deDe ,
38
+ ThyI18nLocale . ruRu
39
+ ] ;
40
+ if ( typeof window !== 'undefined' && window ?. navigator ?. language ) {
41
+ defaultLocaleId = window . navigator ?. language ?. toLowerCase ( ) as ThyI18nLocale ;
42
+ }
43
+ return allLocales . includes ( this . normalizeLocale ( defaultLocaleId ) as ThyI18nLocale ) ? defaultLocaleId : ThyI18nLocale . zhCn ;
44
+ }
45
+
30
46
/**
31
47
* 设置语言
32
48
* @param id
Original file line number Diff line number Diff line change @@ -8,11 +8,11 @@ export const enUsLocale: ThyI18nLocaleConfig = {
8
8
count : '' ,
9
9
forbidDropInEntry : 'Cannot reach this entry' ,
10
10
expandedAll : 'Expand all' ,
11
- foldUpAll : 'Fold up all' ,
11
+ foldUpAll : 'Collapse all' ,
12
12
lane : 'Lane' ,
13
- wipLimitStatistics : 'Total {{count}} pcs / WIP limit {{wipLimit}} pcs ' ,
14
- countStatistics : 'Total {{count}} pcs ' ,
15
- foldUp : 'Fold up ' ,
13
+ wipLimitStatistics : 'Total {{count}} / WIP limit {{wipLimit}}' ,
14
+ countStatistics : 'Total {{count}}' ,
15
+ foldUp : 'Collapse ' ,
16
16
expand : 'Expand' ,
17
17
emptyGroup : 'Ungrouped' ,
18
18
@@ -34,9 +34,9 @@ export const enUsLocale: ThyI18nLocaleConfig = {
34
34
setting : 'Settings' ,
35
35
secondaryTitle : 'Secondary title' ,
36
36
37
- speed : 'speed ' ,
38
- audioFormatError : 'This audio is not supported for preview. Please upgrade your browser version or download to view.' ,
37
+ speed : 'Speed ' ,
38
+ audioFormatError : 'This audio is not currently supported for preview, upgrade your browser version or download to view.' ,
39
39
networkError : 'The current network is abnormal. Please refresh and try again.' ,
40
- videoFormatError : 'This video is not supported for preview. Please upgrade your browser version or download to view.'
40
+ videoFormatError : 'This video is not currently supported for preview, upgrade your browser version or download to view.'
41
41
}
42
42
} ;
You can’t perform that action at this time.
0 commit comments