@lingo.dev/_locales 0.3.1 → 0.3.2

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/build/index.cjs CHANGED
@@ -48945,7 +48945,12 @@ function isValidRegionCode(code) {
48945
48945
  }
48946
48946
 
48947
48947
  // src/names/loader.ts
48948
- var CLDR_BASE_URL = process.env.CLDR_BASE_URL || "https://raw.githubusercontent.com/unicode-org/cldr-json/main/cldr-json/cldr-localenames-full/main";
48948
+ function getCLDRBaseUrl() {
48949
+ if (typeof process !== "undefined" && process.env?.CLDR_BASE_URL) {
48950
+ return process.env.CLDR_BASE_URL;
48951
+ }
48952
+ return "https://raw.githubusercontent.com/unicode-org/cldr-json/main/cldr-json/cldr-localenames-full/main";
48953
+ }
48949
48954
  var cache = /* @__PURE__ */ new Map();
48950
48955
  async function loadTerritoryNames(displayLanguage) {
48951
48956
  const cacheKey = `territories-${displayLanguage}`;
@@ -48954,7 +48959,7 @@ async function loadTerritoryNames(displayLanguage) {
48954
48959
  }
48955
48960
  try {
48956
48961
  const response = await fetch(
48957
- `${CLDR_BASE_URL}/${displayLanguage}/territories.json`
48962
+ `${getCLDRBaseUrl()}/${displayLanguage}/territories.json`
48958
48963
  );
48959
48964
  if (!response.ok) {
48960
48965
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
@@ -48982,7 +48987,7 @@ async function loadLanguageNames(displayLanguage) {
48982
48987
  }
48983
48988
  try {
48984
48989
  const response = await fetch(
48985
- `${CLDR_BASE_URL}/${displayLanguage}/languages.json`
48990
+ `${getCLDRBaseUrl()}/${displayLanguage}/languages.json`
48986
48991
  );
48987
48992
  if (!response.ok) {
48988
48993
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
@@ -49010,7 +49015,7 @@ async function loadScriptNames(displayLanguage) {
49010
49015
  }
49011
49016
  try {
49012
49017
  const response = await fetch(
49013
- `${CLDR_BASE_URL}/${displayLanguage}/scripts.json`
49018
+ `${getCLDRBaseUrl()}/${displayLanguage}/scripts.json`
49014
49019
  );
49015
49020
  if (!response.ok) {
49016
49021
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
package/build/index.mjs CHANGED
@@ -48907,7 +48907,12 @@ function isValidRegionCode(code) {
48907
48907
  }
48908
48908
 
48909
48909
  // src/names/loader.ts
48910
- var CLDR_BASE_URL = process.env.CLDR_BASE_URL || "https://raw.githubusercontent.com/unicode-org/cldr-json/main/cldr-json/cldr-localenames-full/main";
48910
+ function getCLDRBaseUrl() {
48911
+ if (typeof process !== "undefined" && process.env?.CLDR_BASE_URL) {
48912
+ return process.env.CLDR_BASE_URL;
48913
+ }
48914
+ return "https://raw.githubusercontent.com/unicode-org/cldr-json/main/cldr-json/cldr-localenames-full/main";
48915
+ }
48911
48916
  var cache = /* @__PURE__ */ new Map();
48912
48917
  async function loadTerritoryNames(displayLanguage) {
48913
48918
  const cacheKey = `territories-${displayLanguage}`;
@@ -48916,7 +48921,7 @@ async function loadTerritoryNames(displayLanguage) {
48916
48921
  }
48917
48922
  try {
48918
48923
  const response = await fetch(
48919
- `${CLDR_BASE_URL}/${displayLanguage}/territories.json`
48924
+ `${getCLDRBaseUrl()}/${displayLanguage}/territories.json`
48920
48925
  );
48921
48926
  if (!response.ok) {
48922
48927
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
@@ -48944,7 +48949,7 @@ async function loadLanguageNames(displayLanguage) {
48944
48949
  }
48945
48950
  try {
48946
48951
  const response = await fetch(
48947
- `${CLDR_BASE_URL}/${displayLanguage}/languages.json`
48952
+ `${getCLDRBaseUrl()}/${displayLanguage}/languages.json`
48948
48953
  );
48949
48954
  if (!response.ok) {
48950
48955
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
@@ -48972,7 +48977,7 @@ async function loadScriptNames(displayLanguage) {
48972
48977
  }
48973
48978
  try {
48974
48979
  const response = await fetch(
48975
- `${CLDR_BASE_URL}/${displayLanguage}/scripts.json`
48980
+ `${getCLDRBaseUrl()}/${displayLanguage}/scripts.json`
48976
48981
  );
48977
48982
  if (!response.ok) {
48978
48983
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingo.dev/_locales",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Lingo.dev locales",
5
5
  "private": false,
6
6
  "repository": {