@@ -98,9 +98,11 @@ export const useLanguagePicker = (
98
98
const targetName = i18nConfigTarget || fallbackTarget
99
99
100
100
if ( ! sourceName || ! targetName ) {
101
- throw new Error (
102
- "Missing language display name, locale: " + localeOption
103
- )
101
+ console . warn ( "Missing language display name:" , {
102
+ localeOption,
103
+ sourceName,
104
+ targetName,
105
+ } )
104
106
}
105
107
106
108
// English will not have a dataItem
@@ -116,10 +118,24 @@ export const useLanguagePicker = (
116
118
( dataItem ! . words . approved / dataItem ! . words . total ) * 100
117
119
) || 0
118
120
119
- if ( progressData . length === 0 )
120
- throw new Error (
121
- "Missing translation progress data; check GitHub action"
122
- )
121
+ const isBrowserDefault = browserLocales . includes ( localeOption )
122
+
123
+ const returnData : Partial < LocaleDisplayInfo > = {
124
+ localeOption,
125
+ sourceName : sourceName ?? localeOption ,
126
+ targetName : targetName ?? localeOption ,
127
+ englishName,
128
+ isBrowserDefault,
129
+ }
130
+
131
+ if ( progressData . length < 1 ) {
132
+ console . warn ( `Missing translation progress data; check GitHub action` )
133
+ return {
134
+ ...returnData ,
135
+ approvalProgress : 0 ,
136
+ wordsApproved : 0 ,
137
+ } as LocaleDisplayInfo
138
+ }
123
139
124
140
const totalWords = progressData [ 0 ] . words . total
125
141
@@ -128,17 +144,11 @@ export const useLanguagePicker = (
128
144
? totalWords || 0
129
145
: dataItem ?. words . approved || 0
130
146
131
- const isBrowserDefault = browserLocales . includes ( localeOption )
132
-
133
147
return {
134
- localeOption ,
148
+ ... returnData ,
135
149
approvalProgress,
136
- sourceName,
137
- targetName,
138
- englishName,
139
150
wordsApproved,
140
- isBrowserDefault,
141
- }
151
+ } as LocaleDisplayInfo
142
152
}
143
153
144
154
const displayNames : LocaleDisplayInfo [ ] =
0 commit comments