@lingo.dev/_spec 0.26.1 → 0.26.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
@@ -277,15 +277,6 @@ var resolveLocaleCode = (value) => {
277
277
  }
278
278
  throw new Error(`Invalid locale code: ${value}`);
279
279
  };
280
- var getAlternativeLocaleCodes = (locale) => {
281
- if (locale.includes("-")) {
282
- return [locale.replace(/-/g, "_")];
283
- } else if (locale.includes("_")) {
284
- return [locale.replace(/_/g, "-")];
285
- } else {
286
- return [];
287
- }
288
- };
289
280
  var getLocaleCodeDelimiter = (locale) => {
290
281
  if (locale.includes("_")) {
291
282
  return "_";
@@ -305,6 +296,9 @@ var resolveOverridenLocale = (locale, delimiter) => {
305
296
  }
306
297
  return locale.replace(currentDelimiter, delimiter);
307
298
  };
299
+ function normalizeLocale(locale) {
300
+ return locale.replaceAll("_", "-").replace(/([a-z]{2,3}-)r/, "$1");
301
+ }
308
302
 
309
303
  // src/formats.ts
310
304
 
@@ -531,4 +525,4 @@ var defaultConfig = LATEST_CONFIG_DEFINITION.defaultValue;
531
525
 
532
526
 
533
527
 
534
- exports.LATEST_CONFIG_DEFINITION = LATEST_CONFIG_DEFINITION; exports.bucketItemSchema = bucketItemSchema; exports.bucketTypeSchema = bucketTypeSchema; exports.bucketTypes = bucketTypes; exports.configV0Definition = configV0Definition; exports.configV1Definition = configV1Definition; exports.configV1_1Definition = configV1_1Definition; exports.configV1_2Definition = configV1_2Definition; exports.configV1_3Definition = configV1_3Definition; exports.configV1_4Definition = configV1_4Definition; exports.defaultConfig = defaultConfig; exports.getAlternativeLocaleCodes = getAlternativeLocaleCodes; exports.getLocaleCodeDelimiter = getLocaleCodeDelimiter; exports.localeCodeSchema = localeCodeSchema; exports.localeCodes = localeCodes; exports.localeCodesFull = localeCodesFull; exports.localeCodesFullExplicitRegion = localeCodesFullExplicitRegion; exports.localeCodesFullUnderscore = localeCodesFullUnderscore; exports.localeCodesShort = localeCodesShort; exports.localeSchema = localeSchema; exports.parseI18nConfig = parseI18nConfig; exports.resolveLocaleCode = resolveLocaleCode; exports.resolveOverridenLocale = resolveOverridenLocale;
528
+ exports.LATEST_CONFIG_DEFINITION = LATEST_CONFIG_DEFINITION; exports.bucketItemSchema = bucketItemSchema; exports.bucketTypeSchema = bucketTypeSchema; exports.bucketTypes = bucketTypes; exports.configV0Definition = configV0Definition; exports.configV1Definition = configV1Definition; exports.configV1_1Definition = configV1_1Definition; exports.configV1_2Definition = configV1_2Definition; exports.configV1_3Definition = configV1_3Definition; exports.configV1_4Definition = configV1_4Definition; exports.defaultConfig = defaultConfig; exports.getLocaleCodeDelimiter = getLocaleCodeDelimiter; exports.localeCodeSchema = localeCodeSchema; exports.localeCodes = localeCodes; exports.localeCodesFull = localeCodesFull; exports.localeCodesFullExplicitRegion = localeCodesFullExplicitRegion; exports.localeCodesFullUnderscore = localeCodesFullUnderscore; exports.localeCodesShort = localeCodesShort; exports.localeSchema = localeSchema; exports.normalizeLocale = normalizeLocale; exports.parseI18nConfig = parseI18nConfig; exports.resolveLocaleCode = resolveLocaleCode; exports.resolveOverridenLocale = resolveOverridenLocale;
package/build/index.d.cts CHANGED
@@ -75,9 +75,9 @@ declare const localeCodesFullExplicitRegion: string[];
75
75
  declare const localeCodes: LocaleCode[];
76
76
  declare const localeCodeSchema: Z.ZodEffects<Z.ZodString, string, string>;
77
77
  declare const resolveLocaleCode: (value: LocaleCode) => LocaleCodeFull;
78
- declare const getAlternativeLocaleCodes: (locale: string) => string[];
79
78
  declare const getLocaleCodeDelimiter: (locale: string) => string | null;
80
79
  declare const resolveOverridenLocale: (locale: string, delimiter?: "-" | "_" | null) => string;
80
+ declare function normalizeLocale(locale: string): string;
81
81
 
82
82
  declare const bucketTypes: readonly ["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"];
83
83
  declare const bucketTypeSchema: Z.ZodEnum<["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"]>;
@@ -483,4 +483,4 @@ declare const defaultConfig: {
483
483
  $schema: string;
484
484
  };
485
485
 
486
- export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, bucketItemSchema, bucketTypeSchema, bucketTypes, configV0Definition, configV1Definition, configV1_1Definition, configV1_2Definition, configV1_3Definition, configV1_4Definition, defaultConfig, getAlternativeLocaleCodes, getLocaleCodeDelimiter, localeCodeSchema, localeCodes, localeCodesFull, localeCodesFullExplicitRegion, localeCodesFullUnderscore, localeCodesShort, localeSchema, parseI18nConfig, resolveLocaleCode, resolveOverridenLocale };
486
+ export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, bucketItemSchema, bucketTypeSchema, bucketTypes, configV0Definition, configV1Definition, configV1_1Definition, configV1_2Definition, configV1_3Definition, configV1_4Definition, defaultConfig, getLocaleCodeDelimiter, localeCodeSchema, localeCodes, localeCodesFull, localeCodesFullExplicitRegion, localeCodesFullUnderscore, localeCodesShort, localeSchema, normalizeLocale, parseI18nConfig, resolveLocaleCode, resolveOverridenLocale };
package/build/index.d.ts CHANGED
@@ -75,9 +75,9 @@ declare const localeCodesFullExplicitRegion: string[];
75
75
  declare const localeCodes: LocaleCode[];
76
76
  declare const localeCodeSchema: Z.ZodEffects<Z.ZodString, string, string>;
77
77
  declare const resolveLocaleCode: (value: LocaleCode) => LocaleCodeFull;
78
- declare const getAlternativeLocaleCodes: (locale: string) => string[];
79
78
  declare const getLocaleCodeDelimiter: (locale: string) => string | null;
80
79
  declare const resolveOverridenLocale: (locale: string, delimiter?: "-" | "_" | null) => string;
80
+ declare function normalizeLocale(locale: string): string;
81
81
 
82
82
  declare const bucketTypes: readonly ["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"];
83
83
  declare const bucketTypeSchema: Z.ZodEnum<["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"]>;
@@ -483,4 +483,4 @@ declare const defaultConfig: {
483
483
  $schema: string;
484
484
  };
485
485
 
486
- export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, bucketItemSchema, bucketTypeSchema, bucketTypes, configV0Definition, configV1Definition, configV1_1Definition, configV1_2Definition, configV1_3Definition, configV1_4Definition, defaultConfig, getAlternativeLocaleCodes, getLocaleCodeDelimiter, localeCodeSchema, localeCodes, localeCodesFull, localeCodesFullExplicitRegion, localeCodesFullUnderscore, localeCodesShort, localeSchema, parseI18nConfig, resolveLocaleCode, resolveOverridenLocale };
486
+ export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, bucketItemSchema, bucketTypeSchema, bucketTypes, configV0Definition, configV1Definition, configV1_1Definition, configV1_2Definition, configV1_3Definition, configV1_4Definition, defaultConfig, getLocaleCodeDelimiter, localeCodeSchema, localeCodes, localeCodesFull, localeCodesFullExplicitRegion, localeCodesFullUnderscore, localeCodesShort, localeSchema, normalizeLocale, parseI18nConfig, resolveLocaleCode, resolveOverridenLocale };
package/build/index.mjs CHANGED
@@ -277,15 +277,6 @@ var resolveLocaleCode = (value) => {
277
277
  }
278
278
  throw new Error(`Invalid locale code: ${value}`);
279
279
  };
280
- var getAlternativeLocaleCodes = (locale) => {
281
- if (locale.includes("-")) {
282
- return [locale.replace(/-/g, "_")];
283
- } else if (locale.includes("_")) {
284
- return [locale.replace(/_/g, "-")];
285
- } else {
286
- return [];
287
- }
288
- };
289
280
  var getLocaleCodeDelimiter = (locale) => {
290
281
  if (locale.includes("_")) {
291
282
  return "_";
@@ -305,6 +296,9 @@ var resolveOverridenLocale = (locale, delimiter) => {
305
296
  }
306
297
  return locale.replace(currentDelimiter, delimiter);
307
298
  };
299
+ function normalizeLocale(locale) {
300
+ return locale.replaceAll("_", "-").replace(/([a-z]{2,3}-)r/, "$1");
301
+ }
308
302
 
309
303
  // src/formats.ts
310
304
  import Z2 from "zod";
@@ -519,7 +513,6 @@ export {
519
513
  configV1_3Definition,
520
514
  configV1_4Definition,
521
515
  defaultConfig,
522
- getAlternativeLocaleCodes,
523
516
  getLocaleCodeDelimiter,
524
517
  localeCodeSchema,
525
518
  localeCodes,
@@ -528,6 +521,7 @@ export {
528
521
  localeCodesFullUnderscore,
529
522
  localeCodesShort,
530
523
  localeSchema,
524
+ normalizeLocale,
531
525
  parseI18nConfig,
532
526
  resolveLocaleCode,
533
527
  resolveOverridenLocale
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingo.dev/_spec",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "description": "Lingo.dev open specification",
5
5
  "private": false,
6
6
  "publishConfig": {