Skip to content

Commit c417ab1

Browse files
committed
fix: convert arrays into keys
1 parent c5c20c2 commit c417ab1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/base/underscript/translation.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ const translations = (async () => {
88
cache: 'default',
99
},
1010
);
11-
return response.json();
11+
const text = await response.text();
12+
return JSON.parse(text, function reviver(key, value) {
13+
if (Array.isArray(value)) {
14+
value.forEach((val, i) => {
15+
this[`${key}.${i + 1}`] = val;
16+
});
17+
return undefined;
18+
}
19+
return value;
20+
});
1221
})();
1322

1423
eventManager.on('translation:loaded', async () => {

0 commit comments

Comments
 (0)