@uniweb/core 0.5.9 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/website.js +6 -6
package/package.json
CHANGED
package/src/website.js
CHANGED
|
@@ -74,7 +74,7 @@ export default class Website {
|
|
|
74
74
|
|
|
75
75
|
// Legacy language support (for editor multilingual)
|
|
76
76
|
this.activeLang = this.activeLocale
|
|
77
|
-
this.langs =
|
|
77
|
+
this.langs = this.locales.map(l => ({
|
|
78
78
|
label: l.label || l.code,
|
|
79
79
|
value: l.code
|
|
80
80
|
}))
|
|
@@ -107,7 +107,7 @@ export default class Website {
|
|
|
107
107
|
*/
|
|
108
108
|
buildLocalesList(config) {
|
|
109
109
|
const defaultLocale = config.defaultLanguage || 'en'
|
|
110
|
-
const
|
|
110
|
+
const languages = config.languages || []
|
|
111
111
|
|
|
112
112
|
// Normalize input: convert strings to objects, keep objects as-is
|
|
113
113
|
const normalizeLocale = (locale) => {
|
|
@@ -118,14 +118,14 @@ export default class Website {
|
|
|
118
118
|
return { code: locale.code, ...(locale.label && { label: locale.label }) }
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
// Start with default locale (may not be in
|
|
121
|
+
// Start with default locale (may not be in languages list)
|
|
122
122
|
const localeMap = new Map()
|
|
123
123
|
localeMap.set(defaultLocale, { code: defaultLocale })
|
|
124
124
|
|
|
125
|
-
// Add
|
|
126
|
-
for (const locale of
|
|
125
|
+
// Add configured languages (may include objects with labels)
|
|
126
|
+
for (const locale of languages) {
|
|
127
127
|
const normalized = normalizeLocale(locale)
|
|
128
|
-
// Merge with existing (to preserve labels if default locale also in
|
|
128
|
+
// Merge with existing (to preserve labels if default locale also in languages with label)
|
|
129
129
|
if (localeMap.has(normalized.code)) {
|
|
130
130
|
const existing = localeMap.get(normalized.code)
|
|
131
131
|
localeMap.set(normalized.code, { ...existing, ...normalized })
|