langie 2.0.2 → 2.0.4

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/core.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * langie v2.0.2
2
+ * langie v2.0.4
3
3
  * (c) 2026 nlit
4
4
  * @license Apache-2.0
5
5
  *
package/dist/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * langie v2.0.2
2
+ * langie v2.0.4
3
3
  * (c) 2026 nlit
4
4
  * @license Apache-2.0
5
5
  *
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * langie v2.0.2
2
+ * langie v2.0.4
3
3
  * (c) 2026 nlit
4
4
  * @license Apache-2.0
5
5
  *
@@ -632,6 +632,13 @@ function useLangieCore(options = {}) {
632
632
  }).catch(() => {
633
633
  });
634
634
  };
635
+ (0, import_vue.watch)(
636
+ [() => availableLanguages.value.length, currentLanguage],
637
+ ([count, lang]) => {
638
+ if (count) applyLocalizedNames(lang);
639
+ },
640
+ { immediate: true }
641
+ );
635
642
  const setLanguage = (lang) => {
636
643
  if (lang && lang !== currentLanguage.value) {
637
644
  }
@@ -2056,6 +2063,14 @@ function displayNative(name = "", native = "") {
2056
2063
  return name !== native && TRAILING_PAREN.test(name) && TRAILING_PAREN.test(native) ? native.replace(TRAILING_PAREN, "") : native;
2057
2064
  }
2058
2065
 
2066
+ // src/utils/languageLabel.ts
2067
+ function languageLabel(lang) {
2068
+ const primary = lang.search_alias || lang.name || "";
2069
+ const native = lang.native_name || "";
2070
+ if (!native || native === primary) return { primary, native: "" };
2071
+ return { primary, native: displayNative(primary, native) };
2072
+ }
2073
+
2059
2074
  // src/utils/flagUrl.ts
2060
2075
  var isReadyFlagUrl = (flagCode) => flagCode.startsWith("/") || /^https?:\/\//i.test(flagCode);
2061
2076
  var flagImageUrl = (flagCode) => isReadyFlagUrl(flagCode) ? flagCode : `/flags/${flagCode}.svg`;
@@ -2418,20 +2433,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
2418
2433
  key: selectedLanguageKey.value,
2419
2434
  src: getFlagImageUrl(value),
2420
2435
  class: "lang-flag",
2421
- alt: `${value.native_name || value.name} flag`,
2436
+ alt: `${(0, import_vue4.unref)(languageLabel)(value).primary} flag`,
2422
2437
  "data-custom-flag": (0, import_vue4.unref)(isReadyFlagUrl)(getFlagCode(value)) || void 0,
2423
2438
  onError: onFlagError
2424
2439
  }, null, 40, _hoisted_2)) : (0, import_vue4.createCommentVNode)("v-if", true),
2425
2440
  (0, import_vue4.createElementVNode)("span", _hoisted_3, [
2426
2441
  (0, import_vue4.createTextVNode)(
2427
- (0, import_vue4.toDisplayString)(value.name) + " ",
2442
+ (0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(value).primary) + " ",
2428
2443
  1
2429
2444
  /* TEXT */
2430
2445
  ),
2431
- value.native_name && value.native_name !== value.name ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
2446
+ (0, import_vue4.unref)(languageLabel)(value).native ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
2432
2447
  "span",
2433
2448
  _hoisted_4,
2434
- "(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(displayNative)(value.name, value.native_name)) + ")",
2449
+ "(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(value).native) + ")",
2435
2450
  1
2436
2451
  /* TEXT */
2437
2452
  )) : (0, import_vue4.createCommentVNode)("v-if", true)
@@ -2447,20 +2462,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue3.defineComponent)({
2447
2462
  key: `${option.code}-${option.flag_country || "fallback"}`,
2448
2463
  src: getFlagImageUrl(option),
2449
2464
  class: "lang-flag",
2450
- alt: `${option.name} flag`,
2465
+ alt: `${(0, import_vue4.unref)(languageLabel)(option).primary} flag`,
2451
2466
  "data-custom-flag": (0, import_vue4.unref)(isReadyFlagUrl)(getFlagCode(option)) || void 0,
2452
2467
  onError: onFlagError
2453
2468
  }, null, 40, _hoisted_6)),
2454
2469
  (0, import_vue4.createElementVNode)("span", _hoisted_7, [
2455
2470
  (0, import_vue4.createTextVNode)(
2456
- (0, import_vue4.toDisplayString)(option.name) + " ",
2471
+ (0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(option).primary) + " ",
2457
2472
  1
2458
2473
  /* TEXT */
2459
2474
  ),
2460
- option.native_name && option.native_name !== option.name ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
2475
+ (0, import_vue4.unref)(languageLabel)(option).native ? ((0, import_vue4.openBlock)(), (0, import_vue4.createElementBlock)(
2461
2476
  "span",
2462
2477
  _hoisted_8,
2463
- "(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(displayNative)(option.name, option.native_name)) + ")",
2478
+ "(" + (0, import_vue4.toDisplayString)((0, import_vue4.unref)(languageLabel)(option).native) + ")",
2464
2479
  1
2465
2480
  /* TEXT */
2466
2481
  )) : (0, import_vue4.createCommentVNode)("v-if", true)