langie 2.0.2 → 2.0.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/components/index.cjs +17 -9
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.css.map +1 -1
- package/dist/components/index.mjs +17 -9
- package/dist/components/index.mjs.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.mjs +1 -1
- package/dist/index.cjs +17 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +17 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/utils/languageLabel.d.ts +13 -0
- package/package.json +5 -5
package/dist/core.cjs
CHANGED
package/dist/core.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* langie v2.0.
|
|
2
|
+
* langie v2.0.3
|
|
3
3
|
* (c) 2026 nlit
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*
|
|
@@ -2056,6 +2056,14 @@ function displayNative(name = "", native = "") {
|
|
|
2056
2056
|
return name !== native && TRAILING_PAREN.test(name) && TRAILING_PAREN.test(native) ? native.replace(TRAILING_PAREN, "") : native;
|
|
2057
2057
|
}
|
|
2058
2058
|
|
|
2059
|
+
// src/utils/languageLabel.ts
|
|
2060
|
+
function languageLabel(lang) {
|
|
2061
|
+
const primary = lang.search_alias || lang.name || "";
|
|
2062
|
+
const native = lang.native_name || "";
|
|
2063
|
+
if (!native || native === primary) return { primary, native: "" };
|
|
2064
|
+
return { primary, native: displayNative(primary, native) };
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2059
2067
|
// src/utils/flagUrl.ts
|
|
2060
2068
|
var isReadyFlagUrl = (flagCode) => flagCode.startsWith("/") || /^https?:\/\//i.test(flagCode);
|
|
2061
2069
|
var flagImageUrl = (flagCode) => isReadyFlagUrl(flagCode) ? flagCode : `/flags/${flagCode}.svg`;
|
|
@@ -2418,20 +2426,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
|
|
|
2418
2426
|
key: selectedLanguageKey.value,
|
|
2419
2427
|
src: getFlagImageUrl(value),
|
|
2420
2428
|
class: "lang-flag",
|
|
2421
|
-
alt: `${
|
|
2429
|
+
alt: `${(0, import_vue4.unref)(languageLabel)(value).primary} flag`,
|
|
2422
2430
|
"data-custom-flag": (0, import_vue4.unref)(isReadyFlagUrl)(getFlagCode(value)) || void 0,
|
|
2423
2431
|
onError: onFlagError
|
|
2424
2432
|
}, null, 40, _hoisted_2)) : (0, import_vue4.createCommentVNode)("v-if", true),
|
|
2425
2433
|
(0, import_vue4.createElementVNode)("span", _hoisted_3, [
|
|
2426
2434
|
(0, import_vue4.createTextVNode)(
|
|
2427
|
-
(0, import_vue4.toDisplayString)(value.
|
|
2435
|
+
(0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(value).primary) + " ",
|
|
2428
2436
|
1
|
|
2429
2437
|
/* TEXT */
|
|
2430
2438
|
),
|
|
2431
|
-
|
|
2439
|
+
(0, import_vue4.unref)(languageLabel)(value).native ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
|
|
2432
2440
|
"span",
|
|
2433
2441
|
_hoisted_4,
|
|
2434
|
-
"(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(
|
|
2442
|
+
"(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(value).native) + ")",
|
|
2435
2443
|
1
|
|
2436
2444
|
/* TEXT */
|
|
2437
2445
|
)) : (0, import_vue4.createCommentVNode)("v-if", true)
|
|
@@ -2447,20 +2455,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
|
|
|
2447
2455
|
key: `${option.code}-${option.flag_country || "fallback"}`,
|
|
2448
2456
|
src: getFlagImageUrl(option),
|
|
2449
2457
|
class: "lang-flag",
|
|
2450
|
-
alt: `${option.
|
|
2458
|
+
alt: `${(0, import_vue4.unref)(languageLabel)(option).primary} flag`,
|
|
2451
2459
|
"data-custom-flag": (0, import_vue4.unref)(isReadyFlagUrl)(getFlagCode(option)) || void 0,
|
|
2452
2460
|
onError: onFlagError
|
|
2453
2461
|
}, null, 40, _hoisted_6)),
|
|
2454
2462
|
(0, import_vue4.createElementVNode)("span", _hoisted_7, [
|
|
2455
2463
|
(0, import_vue4.createTextVNode)(
|
|
2456
|
-
(0, import_vue4.toDisplayString)(option.
|
|
2464
|
+
(0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(option).primary) + " ",
|
|
2457
2465
|
1
|
|
2458
2466
|
/* TEXT */
|
|
2459
2467
|
),
|
|
2460
|
-
|
|
2468
|
+
(0, import_vue4.unref)(languageLabel)(option).native ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
|
|
2461
2469
|
"span",
|
|
2462
2470
|
_hoisted_8,
|
|
2463
|
-
"(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(
|
|
2471
|
+
"(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(option).native) + ")",
|
|
2464
2472
|
1
|
|
2465
2473
|
/* TEXT */
|
|
2466
2474
|
)) : (0, import_vue4.createCommentVNode)("v-if", true)
|