File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
src/components/LanguagePicker Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,23 @@ export const useLanguagePicker = (
108
108
( dataItem ! . words . approved / dataItem ! . words . total ) * 100
109
109
) || 0
110
110
111
- if ( progressData . length === 0 ) {
112
- console . warn ( "Missing translation progress data; check GitHub action" )
111
+ const isBrowserDefault = browserLocales . includes ( localeOption )
112
+
113
+ const returnData : Partial < LocaleDisplayInfo > = {
114
+ localeOption,
115
+ sourceName : sourceName ?? localeOption ,
116
+ targetName : targetName ?? localeOption ,
117
+ englishName,
118
+ isBrowserDefault,
119
+ }
120
+
121
+ if ( progressData . length < 1 ) {
122
+ console . warn ( `Missing translation progress data; check GitHub action` )
123
+ return {
124
+ ...returnData ,
125
+ approvalProgress : 0 ,
126
+ wordsApproved : 0 ,
127
+ } as LocaleDisplayInfo
113
128
}
114
129
115
130
const totalWords = progressData [ 0 ] . words . total
@@ -119,17 +134,11 @@ export const useLanguagePicker = (
119
134
? totalWords || 0
120
135
: dataItem ?. words . approved || 0
121
136
122
- const isBrowserDefault = browserLocales . includes ( localeOption )
123
-
124
137
return {
125
- localeOption ,
138
+ ... returnData ,
126
139
approvalProgress,
127
- sourceName : sourceName ?? "" ,
128
- targetName : targetName ?? "" ,
129
- englishName,
130
140
wordsApproved,
131
- isBrowserDefault,
132
- }
141
+ } as LocaleDisplayInfo
133
142
}
134
143
135
144
const displayNames : LocaleDisplayInfo [ ] =
You can’t perform that action at this time.
0 commit comments