@uipkge/nuxt 0.1.6 → 0.1.8
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
|
@@ -4,10 +4,10 @@ export function useI18n(options) {
|
|
|
4
4
|
const i18n = _useI18n({ useScope: "global", ...options });
|
|
5
5
|
const nuxtApp = useNuxtApp();
|
|
6
6
|
const originalT = i18n.t.bind(i18n);
|
|
7
|
-
const patchedT = (key, defaultValue,
|
|
8
|
-
const result = originalT(key,
|
|
7
|
+
const patchedT = (key, defaultValue, namedParams) => {
|
|
8
|
+
const result = namedParams ? originalT(key, namedParams) : originalT(key);
|
|
9
9
|
const sync = nuxtApp.$i18nowSync;
|
|
10
|
-
if (sync && !sync.existingKeys.has(key) &&
|
|
10
|
+
if (sync && !sync.existingKeys.has(key) && defaultValue !== void 0) {
|
|
11
11
|
sync.syncKey(key, defaultValue);
|
|
12
12
|
}
|
|
13
13
|
return result;
|
|
@@ -35,9 +35,9 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
35
35
|
await loadLocale(locale);
|
|
36
36
|
const originalGlobalT = nuxtApp.vueApp.config.globalProperties.$t;
|
|
37
37
|
if (originalGlobalT) {
|
|
38
|
-
nuxtApp.vueApp.config.globalProperties.$t = function(key, defaultValue,
|
|
39
|
-
const result = originalGlobalT.call(this, key,
|
|
40
|
-
if (!syncer.existingKeys.has(key) &&
|
|
38
|
+
nuxtApp.vueApp.config.globalProperties.$t = function(key, defaultValue, namedParams) {
|
|
39
|
+
const result = namedParams ? originalGlobalT.call(this, key, namedParams) : originalGlobalT.call(this, key);
|
|
40
|
+
if (!syncer.existingKeys.has(key) && defaultValue !== void 0) {
|
|
41
41
|
syncer.syncKey(key, defaultValue);
|
|
42
42
|
}
|
|
43
43
|
return result;
|