@uipkge/nuxt 0.1.19 → 0.1.21
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/dist/module.json
CHANGED
|
@@ -15,10 +15,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
15
15
|
} catch {
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
if (!ssrKeys || ssrKeys.length === 0) {
|
|
20
|
-
await loadLocale(currentLocale);
|
|
21
|
-
}
|
|
18
|
+
await loadLocale(currentLocale);
|
|
22
19
|
let activeLocale = currentLocale;
|
|
23
20
|
nuxtApp.hook("i18n:beforeLocaleSwitch", async ({ newLocale }) => {
|
|
24
21
|
if (newLocale === activeLocale) return;
|
|
@@ -43,6 +43,10 @@ function createI18nowSyncer(options) {
|
|
|
43
43
|
}
|
|
44
44
|
function syncKey(key, value) {
|
|
45
45
|
if (synced.has(key) || synced.size >= maxTracked) return;
|
|
46
|
+
if (!value || !/^[\w-]+(?:\.[\w-]+)*$/.test(key)) {
|
|
47
|
+
console.error(`[i18now] Invalid key skipped: "${key}" \u2014 keys must be dotted paths (e.g. "common.save")`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
46
50
|
synced.add(key);
|
|
47
51
|
pending.set(key, value);
|
|
48
52
|
if (!flushTimer) flushTimer = setTimeout(flush, 0);
|
|
@@ -108,12 +112,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
let currentLocale = locale;
|
|
111
|
-
|
|
112
|
-
if (ssrKeys && ssrKeys.length > 0) {
|
|
113
|
-
syncer.setExistingKeys(ssrKeys);
|
|
114
|
-
} else {
|
|
115
|
-
await loadLocale(locale);
|
|
116
|
-
}
|
|
115
|
+
await loadLocale(locale);
|
|
117
116
|
const originalGlobalT = nuxtApp.vueApp.config.globalProperties.$t;
|
|
118
117
|
if (originalGlobalT) {
|
|
119
118
|
nuxtApp.vueApp.config.globalProperties.$t = function(key, defaultValue, ...rest) {
|