Skip to content

Commit fe7f7e5

Browse files
more explicit support for default languages. construct template translation
1 parent 90138e9 commit fe7f7e5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

web/index.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ document.addEventListener('DOMContentLoaded', function () {
6464
locales[langcode] = { langcode, nativeName };
6565
});
6666

67-
Object.entries(template.translations).forEach(
67+
const template_translations = {
68+
...template.translations,
69+
'default': template.default
70+
}
71+
72+
Object.entries(template_translations).forEach(
6873
([langcode, translation]) => {
69-
console.log(langcode, translation);
7074
const schema_resource = consolidate(
7175
translation.schema.slots,
7276
(acc, [slot_symbol, { name }]) => ({
@@ -89,15 +93,15 @@ document.addEventListener('DOMContentLoaded', function () {
8993
);
9094
/* eslint-enable */
9195
const translated_sections = consolidate(
92-
translation.schema.classes[template.default.schema.name].slot_usage,
96+
translation.schema.classes[template.default.schema.name.replace('_', ' ')].slot_usage,
9397
(acc, [translation_slot_name, { slot_group }]) => ({
9498
...acc,
9599
[translation_slot_name]: slot_group,
96100
})
97101
);
98102

99103
const default_sections = consolidate(
100-
template.default.schema.classes[template.default.schema.name]
104+
template.default.schema.classes[template.default.schema.name.replace('_', ' ')]
101105
.slot_usage,
102106
(acc, [default_slot_name, { slot_group }]) => ({
103107
...acc,
@@ -122,6 +126,7 @@ document.addEventListener('DOMContentLoaded', function () {
122126
}
123127
);
124128

129+
125130
return locales;
126131
},
127132
getSchema: async (schema) => {

0 commit comments

Comments
 (0)