@i18n-micro/vue 1.3.1 → 1.3.3
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/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +565 -0
- package/dist/index.d.ts +565 -15
- package/dist/index.mjs +140 -135
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -10
- package/dist/components/i18n-group.d.ts +0 -6
- package/dist/components/i18n-link.d.ts +0 -49
- package/dist/components/i18n-switcher.d.ts +0 -146
- package/dist/components/i18n-t.d.ts +0 -94
- package/dist/composables/use-locale-head.d.ts +0 -62
- package/dist/composer.d.ts +0 -38
- package/dist/injection.d.ts +0 -8
- package/dist/plugin.d.ts +0 -22
- package/dist/router/adapter.d.ts +0 -9
- package/dist/router/types.d.ts +0 -43
- package/dist/use-i18n.d.ts +0 -40
- package/dist/vue-shim.d.ts +0 -14
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { BaseI18n as
|
|
3
|
-
import { FormatService as
|
|
4
|
-
import { RouterLink as
|
|
5
|
-
const E = /* @__PURE__ */ Symbol("i18n"),
|
|
1
|
+
import { defineComponent as B, inject as k, h as y, computed as C, ref as q, onMounted as Q, onUnmounted as X, nextTick as Y, shallowRef as K } from "vue";
|
|
2
|
+
import { BaseI18n as ee } from "@i18n-micro/core";
|
|
3
|
+
import { FormatService as me, defaultPlural as ve, interpolate as be } from "@i18n-micro/core";
|
|
4
|
+
import { RouterLink as te } from "vue-router";
|
|
5
|
+
const E = /* @__PURE__ */ Symbol("i18n"), G = /* @__PURE__ */ Symbol("i18n-locales"), Z = /* @__PURE__ */ Symbol("i18n-default-locale"), A = /* @__PURE__ */ Symbol("i18n-router-strategy"), ne = B({
|
|
6
6
|
name: "I18nGroup",
|
|
7
7
|
props: {
|
|
8
8
|
prefix: {
|
|
@@ -15,7 +15,7 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
setup(t, { slots: e }) {
|
|
18
|
-
const a =
|
|
18
|
+
const a = k(E);
|
|
19
19
|
if (!a)
|
|
20
20
|
throw new Error("[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.");
|
|
21
21
|
const r = (c, o) => a.t(`${t.prefix}.${c}`, o, void 0, a.getRoute());
|
|
@@ -27,7 +27,7 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
27
27
|
e.default?.({ prefix: t.prefix, t: r })
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
|
-
}),
|
|
30
|
+
}), ae = B({
|
|
31
31
|
name: "I18nLink",
|
|
32
32
|
props: {
|
|
33
33
|
to: {
|
|
@@ -44,10 +44,10 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
setup(t, { slots: e }) {
|
|
47
|
-
const a =
|
|
47
|
+
const a = k(E), r = k(A, void 0);
|
|
48
48
|
if (!a)
|
|
49
49
|
throw new Error("[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.");
|
|
50
|
-
const c =
|
|
50
|
+
const c = C(() => typeof t.to == "string" ? /^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(t.to) : !1), o = C(() => {
|
|
51
51
|
if (c.value)
|
|
52
52
|
return t.to;
|
|
53
53
|
if (t.localeRoute) {
|
|
@@ -58,12 +58,12 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
58
58
|
return typeof t.to == "string" ? t.to : t.to.path || "/";
|
|
59
59
|
const l = r.resolvePath(t.to, a.locale.value);
|
|
60
60
|
return typeof l == "string" ? l : l.path || "/";
|
|
61
|
-
}), u =
|
|
61
|
+
}), u = C(() => {
|
|
62
62
|
if (c.value || !r)
|
|
63
63
|
return !1;
|
|
64
64
|
const l = r.getCurrentPath().replace(/\/$/, ""), n = o.value.replace(/\/$/, "");
|
|
65
65
|
return l === n;
|
|
66
|
-
}), d =
|
|
66
|
+
}), d = C(() => u.value ? t.activeStyle : {});
|
|
67
67
|
return () => c.value ? y(
|
|
68
68
|
"a",
|
|
69
69
|
{
|
|
@@ -92,7 +92,7 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
92
92
|
e.default?.()
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
|
-
}),
|
|
95
|
+
}), re = B({
|
|
96
96
|
name: "I18nSwitcher",
|
|
97
97
|
props: {
|
|
98
98
|
customLabels: {
|
|
@@ -153,38 +153,38 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
setup(t, { slots: e }) {
|
|
156
|
-
const a =
|
|
156
|
+
const a = k(E), r = k(A, void 0), c = k(G, void 0);
|
|
157
157
|
if (!a)
|
|
158
158
|
throw new Error("[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.");
|
|
159
159
|
if (!c && !t.locales)
|
|
160
160
|
throw new Error(
|
|
161
161
|
"[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop."
|
|
162
162
|
);
|
|
163
|
-
const o =
|
|
163
|
+
const o = C(() => t.locales || c || []), u = C(() => t.currentLocale !== void 0 ? typeof t.currentLocale == "function" ? t.currentLocale() : t.currentLocale : a.locale.value), d = C(() => t.getLocaleName ? t.getLocaleName() || null : o.value.find((p) => p.code === a.locale.value)?.displayName || null), l = q(!1), n = q(null), i = (s) => {
|
|
164
164
|
s && (s.stopPropagation(), s.preventDefault()), l.value = !l.value;
|
|
165
|
-
}, h = (s) => t.customLabels[s.code] || s.displayName || s.code, m =
|
|
165
|
+
}, h = (s) => t.customLabels[s.code] || s.displayName || s.code, m = C(() => {
|
|
166
166
|
const s = o.value.find((p) => p.code === u.value);
|
|
167
167
|
return s ? h(s) : d.value || u.value;
|
|
168
168
|
}), b = async (s) => {
|
|
169
|
-
if (l.value = !1, await
|
|
169
|
+
if (l.value = !1, await Y(), t.switchLocale) {
|
|
170
170
|
t.switchLocale(s);
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
if (a.locale.value = s, !r)
|
|
174
174
|
return;
|
|
175
|
-
const p = r.getCurrentPath(),
|
|
175
|
+
const p = r.getCurrentPath(), v = t.localeRoute ? (() => {
|
|
176
176
|
const g = t.localeRoute(p, s);
|
|
177
177
|
return typeof g == "string" ? g : g.path || "/";
|
|
178
178
|
})() : r?.resolvePath ? (() => {
|
|
179
179
|
const g = r.resolvePath(p, s);
|
|
180
180
|
return typeof g == "string" ? g : g.path || "/";
|
|
181
181
|
})() : p;
|
|
182
|
-
r.push({ path:
|
|
183
|
-
},
|
|
182
|
+
r.push({ path: v });
|
|
183
|
+
}, S = {
|
|
184
184
|
position: "relative",
|
|
185
185
|
display: "inline-block",
|
|
186
186
|
verticalAlign: "middle"
|
|
187
|
-
},
|
|
187
|
+
}, R = {
|
|
188
188
|
padding: "4px 12px",
|
|
189
189
|
fontSize: "16px",
|
|
190
190
|
cursor: "pointer",
|
|
@@ -194,7 +194,7 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
194
194
|
display: "flex",
|
|
195
195
|
alignItems: "center",
|
|
196
196
|
justifyContent: "space-between"
|
|
197
|
-
},
|
|
197
|
+
}, T = {
|
|
198
198
|
position: "absolute",
|
|
199
199
|
top: "100%",
|
|
200
200
|
left: "0",
|
|
@@ -206,47 +206,47 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
206
206
|
margin: "4px 0 0 0",
|
|
207
207
|
minWidth: "150px",
|
|
208
208
|
boxShadow: "0 2px 8px rgba(0,0,0,0.15)"
|
|
209
|
-
},
|
|
209
|
+
}, O = {
|
|
210
210
|
margin: "0",
|
|
211
211
|
padding: "0"
|
|
212
|
-
},
|
|
212
|
+
}, j = {
|
|
213
213
|
display: "block",
|
|
214
214
|
padding: "8px 12px",
|
|
215
215
|
color: "#333",
|
|
216
216
|
textDecoration: "none",
|
|
217
217
|
transition: "background-color 0.3s ease",
|
|
218
218
|
cursor: "pointer"
|
|
219
|
-
},
|
|
219
|
+
}, $ = {
|
|
220
220
|
fontWeight: "bold",
|
|
221
221
|
color: "#007bff"
|
|
222
|
-
},
|
|
222
|
+
}, z = {
|
|
223
223
|
marginLeft: "8px",
|
|
224
224
|
display: "inline-block",
|
|
225
225
|
transition: "transform 0.3s ease"
|
|
226
|
-
},
|
|
226
|
+
}, V = {
|
|
227
227
|
transform: "rotate(180deg)"
|
|
228
|
-
},
|
|
228
|
+
}, L = (s) => s ? Array.isArray(s) ? s : [s] : [], x = (s) => {
|
|
229
229
|
if (!l.value) return;
|
|
230
230
|
const p = s.target;
|
|
231
231
|
if (!p || !n.value) return;
|
|
232
|
-
const
|
|
233
|
-
!
|
|
232
|
+
const v = n.value.contains(p), g = p.closest(".i18n-switcher-button") !== null;
|
|
233
|
+
!v && !g && (l.value = !1);
|
|
234
234
|
};
|
|
235
|
-
return
|
|
236
|
-
document.addEventListener("click",
|
|
237
|
-
}),
|
|
238
|
-
document.removeEventListener("click",
|
|
235
|
+
return Q(() => {
|
|
236
|
+
document.addEventListener("click", x);
|
|
237
|
+
}), X(() => {
|
|
238
|
+
document.removeEventListener("click", x);
|
|
239
239
|
}), () => {
|
|
240
240
|
const s = [];
|
|
241
|
-
e["before-button"] && s.push(...
|
|
241
|
+
e["before-button"] && s.push(...L(e["before-button"]()));
|
|
242
242
|
const p = [];
|
|
243
|
-
if (e["before-selected-locale"] && p.push(...
|
|
243
|
+
if (e["before-selected-locale"] && p.push(...L(e["before-selected-locale"]())), p.push(y("span", m.value)), e["after-selected-locale"] && p.push(...L(e["after-selected-locale"]())), p.push(
|
|
244
244
|
y(
|
|
245
245
|
"span",
|
|
246
246
|
{
|
|
247
247
|
style: {
|
|
248
|
-
...
|
|
249
|
-
...l.value ?
|
|
248
|
+
...z,
|
|
249
|
+
...l.value ? V : {},
|
|
250
250
|
...t.customIconStyle
|
|
251
251
|
}
|
|
252
252
|
},
|
|
@@ -257,9 +257,9 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
257
257
|
"button",
|
|
258
258
|
{
|
|
259
259
|
class: "i18n-switcher-button",
|
|
260
|
-
style: { ...
|
|
261
|
-
onClick: (
|
|
262
|
-
|
|
260
|
+
style: { ...R, ...t.customButtonStyle },
|
|
261
|
+
onClick: (v) => {
|
|
262
|
+
v.preventDefault(), v.stopPropagation(), i(v);
|
|
263
263
|
},
|
|
264
264
|
type: "button",
|
|
265
265
|
ariaHaspopup: !0,
|
|
@@ -267,65 +267,65 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
267
267
|
},
|
|
268
268
|
p
|
|
269
269
|
)
|
|
270
|
-
), e["before-dropdown"] && s.push(...
|
|
271
|
-
const
|
|
272
|
-
e["before-dropdown-items"] &&
|
|
273
|
-
const
|
|
274
|
-
e["before-item"] &&
|
|
275
|
-
const
|
|
276
|
-
e["before-link-content"] &&
|
|
277
|
-
const N = typeof window < "u" ? window.location.pathname : "/",
|
|
278
|
-
|
|
270
|
+
), e["before-dropdown"] && s.push(...L(e["before-dropdown"]())), l.value) {
|
|
271
|
+
const v = [];
|
|
272
|
+
e["before-dropdown-items"] && v.push(...L(e["before-dropdown-items"]())), o.value.forEach((g) => {
|
|
273
|
+
const M = [];
|
|
274
|
+
e["before-item"] && M.push(...L(e["before-item"]({ locale: g })));
|
|
275
|
+
const _ = [];
|
|
276
|
+
e["before-link-content"] && _.push(...L(e["before-link-content"]({ locale: g }))), _.push(h(g)), e["after-link-content"] && _.push(...L(e["after-link-content"]({ locale: g })));
|
|
277
|
+
const N = typeof window < "u" ? window.location.pathname : "/", W = t.localeRoute ? t.localeRoute(N, g.code) : r?.resolvePath ? r.resolvePath(N, g.code) : N, D = typeof W == "string" ? W : W.path || "#", U = g.code === u.value;
|
|
278
|
+
M.push(
|
|
279
279
|
y(
|
|
280
280
|
"a",
|
|
281
281
|
{
|
|
282
282
|
class: `switcher-locale-${g.code}`,
|
|
283
|
-
href: typeof
|
|
283
|
+
href: typeof D == "string" ? D : "#",
|
|
284
284
|
style: {
|
|
285
|
-
...
|
|
286
|
-
...
|
|
285
|
+
...j,
|
|
286
|
+
...U ? $ : {},
|
|
287
287
|
...t.customLinkStyle
|
|
288
288
|
},
|
|
289
289
|
// Prevent default navigation, use only handleSwitchLocale
|
|
290
|
-
onClick: (
|
|
291
|
-
|
|
290
|
+
onClick: (F) => {
|
|
291
|
+
F.preventDefault(), F.stopPropagation(), b(g.code);
|
|
292
292
|
}
|
|
293
293
|
},
|
|
294
|
-
|
|
294
|
+
_
|
|
295
295
|
)
|
|
296
|
-
), e["after-item"] &&
|
|
296
|
+
), e["after-item"] && M.push(...L(e["after-item"]({ locale: g }))), v.push(
|
|
297
297
|
y(
|
|
298
298
|
"li",
|
|
299
299
|
{
|
|
300
300
|
key: g.code,
|
|
301
|
-
style: { ...
|
|
301
|
+
style: { ...O, ...t.customItemStyle }
|
|
302
302
|
},
|
|
303
|
-
|
|
303
|
+
M
|
|
304
304
|
)
|
|
305
305
|
);
|
|
306
|
-
}), e["after-dropdown-items"] &&
|
|
306
|
+
}), e["after-dropdown-items"] && v.push(...L(e["after-dropdown-items"]())), s.push(
|
|
307
307
|
y(
|
|
308
308
|
"ul",
|
|
309
309
|
{
|
|
310
310
|
class: "i18n-switcher-dropdown",
|
|
311
|
-
style: { ...
|
|
311
|
+
style: { ...T, ...t.customDropdownStyle }
|
|
312
312
|
},
|
|
313
|
-
|
|
313
|
+
v
|
|
314
314
|
)
|
|
315
315
|
);
|
|
316
316
|
}
|
|
317
|
-
return e["after-dropdown"] && s.push(...
|
|
317
|
+
return e["after-dropdown"] && s.push(...L(e["after-dropdown"]())), y(
|
|
318
318
|
"div",
|
|
319
319
|
{
|
|
320
320
|
ref: n,
|
|
321
321
|
class: "i18n-switcher-wrapper",
|
|
322
|
-
style: { ...
|
|
322
|
+
style: { ...S, ...t.customWrapperStyle }
|
|
323
323
|
},
|
|
324
324
|
s
|
|
325
325
|
);
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
|
-
}),
|
|
328
|
+
}), oe = B({
|
|
329
329
|
name: "I18nT",
|
|
330
330
|
props: {
|
|
331
331
|
keypath: {
|
|
@@ -370,7 +370,7 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
370
370
|
}
|
|
371
371
|
},
|
|
372
372
|
setup(t, { slots: e, attrs: a }) {
|
|
373
|
-
const r =
|
|
373
|
+
const r = k(E);
|
|
374
374
|
if (!r)
|
|
375
375
|
throw new Error("[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.");
|
|
376
376
|
return () => {
|
|
@@ -421,8 +421,8 @@ const E = /* @__PURE__ */ Symbol("i18n"), z = /* @__PURE__ */ Symbol("i18n-local
|
|
|
421
421
|
};
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
|
-
function
|
|
425
|
-
const e =
|
|
424
|
+
function le(t) {
|
|
425
|
+
const e = k(E), a = k(A, void 0), r = k(G, void 0), c = k(Z, void 0);
|
|
426
426
|
if (!e)
|
|
427
427
|
throw new Error("[i18n-micro] useI18n() must be called after app.use(i18n). Make sure i18n plugin is installed.");
|
|
428
428
|
if (!r)
|
|
@@ -434,7 +434,7 @@ function re(t) {
|
|
|
434
434
|
// Direct access to instance
|
|
435
435
|
instance: e,
|
|
436
436
|
// Locale (reactive)
|
|
437
|
-
locale:
|
|
437
|
+
locale: C({
|
|
438
438
|
get: () => e.locale.value,
|
|
439
439
|
set: (l) => {
|
|
440
440
|
e.locale.value = l;
|
|
@@ -475,93 +475,97 @@ function re(t) {
|
|
|
475
475
|
clearCache: e.clearCache.bind(e)
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
|
-
function
|
|
479
|
-
const { addDirAttribute: e = !0, identifierAttribute: a = "id", addSeoAttributes: r = !0, baseUrl: c = "/" } = t, { getLocale: o, getLocales: u, localeRoute: d } =
|
|
478
|
+
function de(t = {}) {
|
|
479
|
+
const { addDirAttribute: e = !0, identifierAttribute: a = "id", addSeoAttributes: r = !0, baseUrl: c = "/" } = t, { getLocale: o, getLocales: u, localeRoute: d } = le(), l = k(A, void 0), n = q({
|
|
480
480
|
htmlAttrs: {},
|
|
481
481
|
link: [],
|
|
482
482
|
meta: []
|
|
483
483
|
});
|
|
484
484
|
function i(m, b) {
|
|
485
|
-
const
|
|
486
|
-
for (const
|
|
487
|
-
|
|
488
|
-
const
|
|
489
|
-
return
|
|
485
|
+
const S = new URL(m, "http://localhost"), R = new URLSearchParams(S.search), T = {};
|
|
486
|
+
for (const j of b)
|
|
487
|
+
R.has(j) && (T[j] = R.get(j));
|
|
488
|
+
const O = new URLSearchParams(T);
|
|
489
|
+
return O.toString() ? `${S.pathname}?${O.toString()}` : S.pathname;
|
|
490
490
|
}
|
|
491
491
|
function h(m = []) {
|
|
492
492
|
if (!l) {
|
|
493
493
|
n.value = { htmlAttrs: {}, link: [], meta: [] };
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
|
-
const b = o(),
|
|
497
|
-
if (!
|
|
496
|
+
const b = o(), S = u(), R = S.find((f) => f.code === b);
|
|
497
|
+
if (!R)
|
|
498
498
|
return;
|
|
499
|
-
const
|
|
500
|
-
let
|
|
501
|
-
|
|
502
|
-
const
|
|
503
|
-
let
|
|
504
|
-
const
|
|
505
|
-
if (
|
|
506
|
-
|
|
499
|
+
const T = R.iso || b, O = R.og || T, j = R.dir || "auto";
|
|
500
|
+
let $ = l.getCurrentPath();
|
|
501
|
+
$.startsWith("/") || ($ = `/${$}`);
|
|
502
|
+
const z = $.split("/").filter(Boolean), V = S.find((f) => z[0] === f.code);
|
|
503
|
+
let L = $, x, s;
|
|
504
|
+
const p = typeof c == "function" ? c() : c;
|
|
505
|
+
if (V) {
|
|
506
|
+
L = $.slice(V.code.length + 1) || "/", x = i(L, m);
|
|
507
507
|
const f = `/${b}`;
|
|
508
|
-
|
|
508
|
+
s = `${p}${f}${x.startsWith("/") ? "" : "/"}${x}`;
|
|
509
509
|
} else
|
|
510
|
-
|
|
510
|
+
x = i($, m), s = `${p}${x.startsWith("/") ? "" : "/"}${x}`;
|
|
511
511
|
if (n.value = {
|
|
512
512
|
htmlAttrs: {
|
|
513
|
-
lang:
|
|
514
|
-
...e ? { dir:
|
|
513
|
+
lang: T,
|
|
514
|
+
...e ? { dir: j } : {}
|
|
515
515
|
},
|
|
516
516
|
link: [],
|
|
517
517
|
meta: []
|
|
518
518
|
}, !r)
|
|
519
519
|
return;
|
|
520
|
-
const
|
|
520
|
+
const v = S.filter((f) => !f.disabled && f.seo !== !1), g = {
|
|
521
521
|
[a]: "i18n-og",
|
|
522
522
|
property: "og:locale",
|
|
523
|
-
content:
|
|
524
|
-
},
|
|
523
|
+
content: O
|
|
524
|
+
}, M = {
|
|
525
525
|
[a]: "i18n-og-url",
|
|
526
526
|
property: "og:url",
|
|
527
|
-
content:
|
|
528
|
-
},
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
527
|
+
content: s
|
|
528
|
+
}, _ = v.filter((f) => f.code !== b).map((f) => {
|
|
529
|
+
const I = f.og || f.iso || f.code;
|
|
530
|
+
return {
|
|
531
|
+
[a]: `i18n-og-alt-${I}`,
|
|
532
|
+
property: "og:locale:alternate",
|
|
533
|
+
content: I
|
|
534
|
+
};
|
|
535
|
+
}), N = {
|
|
533
536
|
[a]: "i18n-can",
|
|
534
537
|
rel: "canonical",
|
|
535
|
-
href:
|
|
536
|
-
},
|
|
538
|
+
href: s
|
|
539
|
+
}, W = v.flatMap((f) => {
|
|
537
540
|
if (!d || !l)
|
|
538
541
|
return [];
|
|
539
|
-
const
|
|
542
|
+
const I = l.getCurrentPath(), w = d(I, f.code), P = typeof w == "string" ? w : w?.path || "/";
|
|
540
543
|
if (!P)
|
|
541
544
|
return [];
|
|
542
|
-
let
|
|
543
|
-
P.startsWith("http://") || P.startsWith("https://") ?
|
|
544
|
-
const
|
|
545
|
+
let H;
|
|
546
|
+
P.startsWith("http://") || P.startsWith("https://") ? H = P : H = `${typeof c == "function" ? c() : c}${P.startsWith("/") ? "" : "/"}${P}`;
|
|
547
|
+
const J = [
|
|
545
548
|
{
|
|
546
549
|
[a]: `i18n-alternate-${f.code}`,
|
|
547
550
|
rel: "alternate",
|
|
548
|
-
href:
|
|
551
|
+
href: H,
|
|
549
552
|
hreflang: f.code
|
|
550
553
|
}
|
|
551
554
|
];
|
|
552
|
-
return f.iso && f.iso !== f.code &&
|
|
555
|
+
return f.iso && f.iso !== f.code && J.push({
|
|
553
556
|
[a]: `i18n-alternate-${f.iso}`,
|
|
554
557
|
rel: "alternate",
|
|
555
|
-
href:
|
|
558
|
+
href: H,
|
|
556
559
|
hreflang: f.iso
|
|
557
|
-
}),
|
|
558
|
-
}),
|
|
559
|
-
let
|
|
560
|
-
|
|
561
|
-
|
|
560
|
+
}), J;
|
|
561
|
+
}), D = k(Z, void 0);
|
|
562
|
+
let U = null;
|
|
563
|
+
const F = D ? S.find((f) => f.code === D) : void 0;
|
|
564
|
+
if (d && l && D && F?.seo !== !1) {
|
|
565
|
+
const f = l.getCurrentPath(), I = d(f, D), w = typeof I == "string" ? I : I?.path || "/";
|
|
562
566
|
if (w) {
|
|
563
567
|
let P;
|
|
564
|
-
w.startsWith("http://") || w.startsWith("https://") ? P = w : P = `${typeof c == "function" ? c() : c}${w.startsWith("/") ? "" : "/"}${w}`,
|
|
568
|
+
w.startsWith("http://") || w.startsWith("https://") ? P = w : P = `${typeof c == "function" ? c() : c}${w.startsWith("/") ? "" : "/"}${w}`, U = {
|
|
565
569
|
[a]: "i18n-xd",
|
|
566
570
|
rel: "alternate",
|
|
567
571
|
href: P,
|
|
@@ -569,14 +573,14 @@ function ue(t = {}) {
|
|
|
569
573
|
};
|
|
570
574
|
}
|
|
571
575
|
}
|
|
572
|
-
n.value.meta = [
|
|
576
|
+
n.value.meta = [g, M, ..._], n.value.link = [N, ...W, ...U ? [U] : []];
|
|
573
577
|
}
|
|
574
578
|
return {
|
|
575
579
|
metaObject: n,
|
|
576
580
|
updateMeta: h
|
|
577
581
|
};
|
|
578
582
|
}
|
|
579
|
-
class
|
|
583
|
+
class ie extends ee {
|
|
580
584
|
constructor(e) {
|
|
581
585
|
const a = {
|
|
582
586
|
translations: /* @__PURE__ */ new Map()
|
|
@@ -586,7 +590,7 @@ class oe extends X {
|
|
|
586
590
|
plural: e.plural,
|
|
587
591
|
missingWarn: e.missingWarn,
|
|
588
592
|
missingHandler: e.missingHandler
|
|
589
|
-
}), this.listeners = /* @__PURE__ */ new Set(), this.storage = a, this._locale =
|
|
593
|
+
}), this.listeners = /* @__PURE__ */ new Set(), this.storage = a, this._locale = K(e.locale), this._fallbackLocale = K(e.fallbackLocale || e.locale), this._currentRoute = K("index"), this._revision = K(0), e.messages)
|
|
590
594
|
for (const [r, c] of Object.entries(e.messages))
|
|
591
595
|
this.helper.loadTranslations(r, c);
|
|
592
596
|
}
|
|
@@ -656,8 +660,8 @@ class oe extends X {
|
|
|
656
660
|
return e;
|
|
657
661
|
}
|
|
658
662
|
}
|
|
659
|
-
function
|
|
660
|
-
const { routingStrategy: e, locales: a, defaultLocale: r, ...c } = t, o = new
|
|
663
|
+
function he(t) {
|
|
664
|
+
const { routingStrategy: e, locales: a, defaultLocale: r, ...c } = t, o = new ie(c);
|
|
661
665
|
let u = null, d = e || null;
|
|
662
666
|
return {
|
|
663
667
|
global: o,
|
|
@@ -667,11 +671,11 @@ function fe(t) {
|
|
|
667
671
|
},
|
|
668
672
|
// Method for setting adapter after creation
|
|
669
673
|
install(n) {
|
|
670
|
-
u = n, n.provide(E, o), d && n.provide(A, d), a && n.provide(
|
|
674
|
+
u = n, n.provide(E, o), d && n.provide(A, d), a && n.provide(G, a), r && n.provide(Z, r), n.config.globalProperties.$t = (i, h, m, b) => o.t(i, h, m, b), n.config.globalProperties.$ts = (i, h, m, b) => o.ts(i, h, m, b), n.config.globalProperties.$tc = (i, h, m) => o.tc(i, h, m), n.config.globalProperties.$tn = (i, h) => o.tn(i, h), n.config.globalProperties.$td = (i, h) => o.td(i, h), n.config.globalProperties.$tdr = (i, h) => o.tdr(i, h), n.config.globalProperties.$has = (i, h) => o.has(i, h), n.config.globalProperties.$i18n = o, n.component("I18nT", oe), n.component("I18nLink", ae), n.component("I18nGroup", ne), n.component("I18nSwitcher", re);
|
|
671
675
|
}
|
|
672
676
|
};
|
|
673
677
|
}
|
|
674
|
-
function
|
|
678
|
+
function ge(t, e, a) {
|
|
675
679
|
const r = e.map((o) => o.code), c = (o, u) => {
|
|
676
680
|
const l = (typeof o == "string" ? o : o.path || "/").split("/").filter(Boolean), n = l[0];
|
|
677
681
|
n !== void 0 && r.includes(n) && l.shift();
|
|
@@ -679,7 +683,7 @@ function de(t, e, a) {
|
|
|
679
683
|
return u === a ? i : `/${u}${i === "/" ? "" : i}`;
|
|
680
684
|
};
|
|
681
685
|
return {
|
|
682
|
-
linkComponent:
|
|
686
|
+
linkComponent: te,
|
|
683
687
|
getCurrentPath: () => t.currentRoute.value.path,
|
|
684
688
|
push: (o) => {
|
|
685
689
|
t.push(o.path).catch(() => {
|
|
@@ -697,19 +701,20 @@ function de(t, e, a) {
|
|
|
697
701
|
};
|
|
698
702
|
}
|
|
699
703
|
export {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
704
|
+
me as FormatService,
|
|
705
|
+
Z as I18nDefaultLocaleKey,
|
|
706
|
+
ne as I18nGroup,
|
|
703
707
|
E as I18nInjectionKey,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
708
|
+
ae as I18nLink,
|
|
709
|
+
G as I18nLocalesKey,
|
|
710
|
+
re as I18nSwitcher,
|
|
711
|
+
oe as I18nT,
|
|
712
|
+
ie as VueI18n,
|
|
713
|
+
he as createI18n,
|
|
714
|
+
ge as createVueRouterAdapter,
|
|
715
|
+
ve as defaultPlural,
|
|
716
|
+
be as interpolate,
|
|
717
|
+
le as useI18n,
|
|
718
|
+
de as useLocaleHead
|
|
715
719
|
};
|
|
720
|
+
//# sourceMappingURL=index.mjs.map
|