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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * langie v2.0.2
2
+ * langie v2.0.3
3
3
  * (c) 2026 nlit
4
4
  * @license Apache-2.0
5
5
  *
@@ -603,6 +603,14 @@ function displayNative(name = "", native = "") {
603
603
  return name !== native && TRAILING_PAREN.test(name) && TRAILING_PAREN.test(native) ? native.replace(TRAILING_PAREN, "") : native;
604
604
  }
605
605
 
606
+ // src/utils/languageLabel.ts
607
+ function languageLabel(lang) {
608
+ const primary = lang.search_alias || lang.name || "";
609
+ const native = lang.native_name || "";
610
+ if (!native || native === primary) return { primary, native: "" };
611
+ return { primary, native: displayNative(primary, native) };
612
+ }
613
+
606
614
  // src/utils/flagUrl.ts
607
615
  var isReadyFlagUrl = (flagCode) => flagCode.startsWith("/") || /^https?:\/\//i.test(flagCode);
608
616
  var flagImageUrl = (flagCode) => isReadyFlagUrl(flagCode) ? flagCode : `/flags/${flagCode}.svg`;
@@ -947,20 +955,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
947
955
  key: selectedLanguageKey.value,
948
956
  src: getFlagImageUrl(value),
949
957
  class: "lang-flag",
950
- alt: `${value.native_name || value.name} flag`,
958
+ alt: `${(0, import_vue2.unref)(languageLabel)(value).primary} flag`,
951
959
  "data-custom-flag": (0, import_vue2.unref)(isReadyFlagUrl)(getFlagCode(value)) || void 0,
952
960
  onError: onFlagError
953
961
  }, null, 40, _hoisted_2)) : (0, import_vue2.createCommentVNode)("v-if", true),
954
962
  (0, import_vue2.createElementVNode)("span", _hoisted_3, [
955
963
  (0, import_vue2.createTextVNode)(
956
- (0, import_vue2.toDisplayString)(value.name) + " ",
964
+ (0, import_vue2.toDisplayString)((0, import_vue2.unref)(languageLabel)(value).primary) + " ",
957
965
  1
958
966
  /* TEXT */
959
967
  ),
960
- value.native_name && value.native_name !== value.name ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
968
+ (0, import_vue2.unref)(languageLabel)(value).native ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
961
969
  "span",
962
970
  _hoisted_4,
963
- "(" + (0, import_vue2.toDisplayString)((0, import_vue2.unref)(displayNative)(value.name, value.native_name)) + ")",
971
+ "(" + (0, import_vue2.toDisplayString)((0, import_vue2.unref)(languageLabel)(value).native) + ")",
964
972
  1
965
973
  /* TEXT */
966
974
  )) : (0, import_vue2.createCommentVNode)("v-if", true)
@@ -976,20 +984,20 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
976
984
  key: `${option.code}-${option.flag_country || "fallback"}`,
977
985
  src: getFlagImageUrl(option),
978
986
  class: "lang-flag",
979
- alt: `${option.name} flag`,
987
+ alt: `${(0, import_vue2.unref)(languageLabel)(option).primary} flag`,
980
988
  "data-custom-flag": (0, import_vue2.unref)(isReadyFlagUrl)(getFlagCode(option)) || void 0,
981
989
  onError: onFlagError
982
990
  }, null, 40, _hoisted_6)),
983
991
  (0, import_vue2.createElementVNode)("span", _hoisted_7, [
984
992
  (0, import_vue2.createTextVNode)(
985
- (0, import_vue2.toDisplayString)(option.name) + " ",
993
+ (0, import_vue2.toDisplayString)((0, import_vue2.unref)(languageLabel)(option).primary) + " ",
986
994
  1
987
995
  /* TEXT */
988
996
  ),
989
- option.native_name && option.native_name !== option.name ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
997
+ (0, import_vue2.unref)(languageLabel)(option).native ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
990
998
  "span",
991
999
  _hoisted_8,
992
- "(" + (0, import_vue2.toDisplayString)((0, import_vue2.unref)(displayNative)(option.name, option.native_name)) + ")",
1000
+ "(" + (0, import_vue2.toDisplayString)((0, import_vue2.unref)(languageLabel)(option).native) + ")",
993
1001
  1
994
1002
  /* TEXT */
995
1003
  )) : (0, import_vue2.createCommentVNode)("v-if", true)