@lingo.dev/_spec 0.26.3 → 0.26.5
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 +4 -2
- package/build/index.d.cts +37 -4
- package/build/index.d.ts +37 -4
- package/build/index.mjs +4 -2
- package/package.json +1 -1
package/build/index.cjs
CHANGED
@@ -236,6 +236,8 @@ var localeMap = {
|
|
236
236
|
nap: ["nap-IT"],
|
237
237
|
// Afrikaans (South Africa)
|
238
238
|
af: ["af-ZA"],
|
239
|
+
// Uzbek (Latin)
|
240
|
+
uz: ["uz-Latn"],
|
239
241
|
// Somali (Somalia)
|
240
242
|
so: ["so-SO"],
|
241
243
|
// Tigrinya (Ethiopia)
|
@@ -288,7 +290,7 @@ var getLocaleCodeDelimiter = (locale) => {
|
|
288
290
|
return null;
|
289
291
|
}
|
290
292
|
};
|
291
|
-
var
|
293
|
+
var resolveOverriddenLocale = (locale, delimiter) => {
|
292
294
|
if (!delimiter) {
|
293
295
|
return locale;
|
294
296
|
}
|
@@ -527,4 +529,4 @@ var defaultConfig = LATEST_CONFIG_DEFINITION.defaultValue;
|
|
527
529
|
|
528
530
|
|
529
531
|
|
530
|
-
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.
|
532
|
+
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.resolveOverriddenLocale = resolveOverriddenLocale;
|
package/build/index.d.cts
CHANGED
@@ -59,6 +59,7 @@ declare const localeMap: {
|
|
59
59
|
readonly bar: readonly ["bar-DE"];
|
60
60
|
readonly nap: readonly ["nap-IT"];
|
61
61
|
readonly af: readonly ["af-ZA"];
|
62
|
+
readonly uz: readonly ["uz-Latn"];
|
62
63
|
readonly so: readonly ["so-SO"];
|
63
64
|
readonly ti: readonly ["ti-ET"];
|
64
65
|
readonly zgh: readonly ["zgh-MA"];
|
@@ -69,15 +70,47 @@ declare const localeMap: {
|
|
69
70
|
type LocaleCodeShort = keyof typeof localeMap;
|
70
71
|
type LocaleCodeFull = (typeof localeMap)[LocaleCodeShort][number];
|
71
72
|
type LocaleCode = LocaleCodeShort | LocaleCodeFull;
|
73
|
+
type LocaleDelimiter = "-" | "_" | null;
|
72
74
|
declare const localeCodesShort: LocaleCodeShort[];
|
73
75
|
declare const localeCodesFull: LocaleCodeFull[];
|
74
76
|
declare const localeCodesFullUnderscore: string[];
|
75
77
|
declare const localeCodesFullExplicitRegion: string[];
|
76
78
|
declare const localeCodes: LocaleCode[];
|
77
79
|
declare const localeCodeSchema: Z.ZodEffects<Z.ZodString, string, string>;
|
78
|
-
|
79
|
-
|
80
|
-
|
80
|
+
/**
|
81
|
+
* Resolves a locale code to its full locale representation.
|
82
|
+
*
|
83
|
+
* If the provided locale code is already a full locale code, it returns as is.
|
84
|
+
* If the provided locale code is a short locale code, it returns the first corresponding full locale.
|
85
|
+
* If the locale code is not found, it throws an error.
|
86
|
+
*
|
87
|
+
* @param {localeCodes} value - The locale code to resolve (either short or full)
|
88
|
+
* @return {LocaleCodeFull} The resolved full locale code
|
89
|
+
* @throws {Error} If the provided locale code is invalid.
|
90
|
+
*/
|
91
|
+
declare const resolveLocaleCode: (value: string) => LocaleCodeFull;
|
92
|
+
/**
|
93
|
+
* Determines the delimiter used in a locale code
|
94
|
+
*
|
95
|
+
* @param {string} locale - the locale string (e.g.,"en_US","en-GB")
|
96
|
+
* @return { string | null} - The delimiter ("_" or "-") if found, otherwise `null`.
|
97
|
+
*/
|
98
|
+
declare const getLocaleCodeDelimiter: (locale: string) => LocaleDelimiter;
|
99
|
+
/**
|
100
|
+
* Replaces the delimiter in a locale string with the specified delimiter.
|
101
|
+
*
|
102
|
+
* @param {string}locale - The locale string (e.g.,"en_US", "en-GB").
|
103
|
+
* @param {"-" | "_" | null} [delimiter] - The new delimiter to replace the existing one.
|
104
|
+
* @returns {string} The locale string with the replaced delimiter, or the original locale if no delimiter is provided.
|
105
|
+
*/
|
106
|
+
declare const resolveOverriddenLocale: (locale: string, delimiter?: LocaleDelimiter) => string;
|
107
|
+
/**
|
108
|
+
* Normalizes a locale string by replacing underscores with hyphens
|
109
|
+
* and removing the "r" in certain regional codes (e.g., "fr-rCA" → "fr-CA")
|
110
|
+
*
|
111
|
+
* @param {string} locale - The locale string (e.g.,"en_US", "en-GB").
|
112
|
+
* @return {string} The normalized locale string.
|
113
|
+
*/
|
81
114
|
declare function normalizeLocale(locale: string): string;
|
82
115
|
|
83
116
|
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"];
|
@@ -484,4 +517,4 @@ declare const defaultConfig: {
|
|
484
517
|
$schema: string;
|
485
518
|
};
|
486
519
|
|
487
|
-
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,
|
520
|
+
export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, type LocaleDelimiter, 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, resolveOverriddenLocale };
|
package/build/index.d.ts
CHANGED
@@ -59,6 +59,7 @@ declare const localeMap: {
|
|
59
59
|
readonly bar: readonly ["bar-DE"];
|
60
60
|
readonly nap: readonly ["nap-IT"];
|
61
61
|
readonly af: readonly ["af-ZA"];
|
62
|
+
readonly uz: readonly ["uz-Latn"];
|
62
63
|
readonly so: readonly ["so-SO"];
|
63
64
|
readonly ti: readonly ["ti-ET"];
|
64
65
|
readonly zgh: readonly ["zgh-MA"];
|
@@ -69,15 +70,47 @@ declare const localeMap: {
|
|
69
70
|
type LocaleCodeShort = keyof typeof localeMap;
|
70
71
|
type LocaleCodeFull = (typeof localeMap)[LocaleCodeShort][number];
|
71
72
|
type LocaleCode = LocaleCodeShort | LocaleCodeFull;
|
73
|
+
type LocaleDelimiter = "-" | "_" | null;
|
72
74
|
declare const localeCodesShort: LocaleCodeShort[];
|
73
75
|
declare const localeCodesFull: LocaleCodeFull[];
|
74
76
|
declare const localeCodesFullUnderscore: string[];
|
75
77
|
declare const localeCodesFullExplicitRegion: string[];
|
76
78
|
declare const localeCodes: LocaleCode[];
|
77
79
|
declare const localeCodeSchema: Z.ZodEffects<Z.ZodString, string, string>;
|
78
|
-
|
79
|
-
|
80
|
-
|
80
|
+
/**
|
81
|
+
* Resolves a locale code to its full locale representation.
|
82
|
+
*
|
83
|
+
* If the provided locale code is already a full locale code, it returns as is.
|
84
|
+
* If the provided locale code is a short locale code, it returns the first corresponding full locale.
|
85
|
+
* If the locale code is not found, it throws an error.
|
86
|
+
*
|
87
|
+
* @param {localeCodes} value - The locale code to resolve (either short or full)
|
88
|
+
* @return {LocaleCodeFull} The resolved full locale code
|
89
|
+
* @throws {Error} If the provided locale code is invalid.
|
90
|
+
*/
|
91
|
+
declare const resolveLocaleCode: (value: string) => LocaleCodeFull;
|
92
|
+
/**
|
93
|
+
* Determines the delimiter used in a locale code
|
94
|
+
*
|
95
|
+
* @param {string} locale - the locale string (e.g.,"en_US","en-GB")
|
96
|
+
* @return { string | null} - The delimiter ("_" or "-") if found, otherwise `null`.
|
97
|
+
*/
|
98
|
+
declare const getLocaleCodeDelimiter: (locale: string) => LocaleDelimiter;
|
99
|
+
/**
|
100
|
+
* Replaces the delimiter in a locale string with the specified delimiter.
|
101
|
+
*
|
102
|
+
* @param {string}locale - The locale string (e.g.,"en_US", "en-GB").
|
103
|
+
* @param {"-" | "_" | null} [delimiter] - The new delimiter to replace the existing one.
|
104
|
+
* @returns {string} The locale string with the replaced delimiter, or the original locale if no delimiter is provided.
|
105
|
+
*/
|
106
|
+
declare const resolveOverriddenLocale: (locale: string, delimiter?: LocaleDelimiter) => string;
|
107
|
+
/**
|
108
|
+
* Normalizes a locale string by replacing underscores with hyphens
|
109
|
+
* and removing the "r" in certain regional codes (e.g., "fr-rCA" → "fr-CA")
|
110
|
+
*
|
111
|
+
* @param {string} locale - The locale string (e.g.,"en_US", "en-GB").
|
112
|
+
* @return {string} The normalized locale string.
|
113
|
+
*/
|
81
114
|
declare function normalizeLocale(locale: string): string;
|
82
115
|
|
83
116
|
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"];
|
@@ -484,4 +517,4 @@ declare const defaultConfig: {
|
|
484
517
|
$schema: string;
|
485
518
|
};
|
486
519
|
|
487
|
-
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,
|
520
|
+
export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, type LocaleDelimiter, 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, resolveOverriddenLocale };
|
package/build/index.mjs
CHANGED
@@ -236,6 +236,8 @@ var localeMap = {
|
|
236
236
|
nap: ["nap-IT"],
|
237
237
|
// Afrikaans (South Africa)
|
238
238
|
af: ["af-ZA"],
|
239
|
+
// Uzbek (Latin)
|
240
|
+
uz: ["uz-Latn"],
|
239
241
|
// Somali (Somalia)
|
240
242
|
so: ["so-SO"],
|
241
243
|
// Tigrinya (Ethiopia)
|
@@ -288,7 +290,7 @@ var getLocaleCodeDelimiter = (locale) => {
|
|
288
290
|
return null;
|
289
291
|
}
|
290
292
|
};
|
291
|
-
var
|
293
|
+
var resolveOverriddenLocale = (locale, delimiter) => {
|
292
294
|
if (!delimiter) {
|
293
295
|
return locale;
|
294
296
|
}
|
@@ -526,5 +528,5 @@ export {
|
|
526
528
|
normalizeLocale,
|
527
529
|
parseI18nConfig,
|
528
530
|
resolveLocaleCode,
|
529
|
-
|
531
|
+
resolveOverriddenLocale
|
530
532
|
};
|