@lingo.dev/_spec 0.26.2 → 0.26.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/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
@@ -222,6 +222,8 @@ var localeMap = {
|
|
222
222
|
],
|
223
223
|
// Irish (Ireland)
|
224
224
|
ga: ["ga-IE"],
|
225
|
+
// Galician (Spain)
|
226
|
+
gl: ["gl-ES"],
|
225
227
|
// Maltese (Malta)
|
226
228
|
mt: ["mt-MT"],
|
227
229
|
// Slovenian (Slovenia)
|
@@ -286,7 +288,7 @@ var getLocaleCodeDelimiter = (locale) => {
|
|
286
288
|
return null;
|
287
289
|
}
|
288
290
|
};
|
289
|
-
var
|
291
|
+
var resolveOverriddenLocale = (locale, delimiter) => {
|
290
292
|
if (!delimiter) {
|
291
293
|
return locale;
|
292
294
|
}
|
@@ -525,4 +527,4 @@ var defaultConfig = LATEST_CONFIG_DEFINITION.defaultValue;
|
|
525
527
|
|
526
528
|
|
527
529
|
|
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.
|
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.resolveOverriddenLocale = resolveOverriddenLocale;
|
package/build/index.d.cts
CHANGED
@@ -52,6 +52,7 @@ declare const localeMap: {
|
|
52
52
|
readonly pa: readonly ["pa-IN", "pa-PK"];
|
53
53
|
readonly bn: readonly ["bn-BD", "bn-IN"];
|
54
54
|
readonly ga: readonly ["ga-IE"];
|
55
|
+
readonly gl: readonly ["gl-ES"];
|
55
56
|
readonly mt: readonly ["mt-MT"];
|
56
57
|
readonly sl: readonly ["sl-SI"];
|
57
58
|
readonly sq: readonly ["sq-AL"];
|
@@ -68,15 +69,47 @@ declare const localeMap: {
|
|
68
69
|
type LocaleCodeShort = keyof typeof localeMap;
|
69
70
|
type LocaleCodeFull = (typeof localeMap)[LocaleCodeShort][number];
|
70
71
|
type LocaleCode = LocaleCodeShort | LocaleCodeFull;
|
72
|
+
type LocaleDelimiter = "-" | "_" | null;
|
71
73
|
declare const localeCodesShort: LocaleCodeShort[];
|
72
74
|
declare const localeCodesFull: LocaleCodeFull[];
|
73
75
|
declare const localeCodesFullUnderscore: string[];
|
74
76
|
declare const localeCodesFullExplicitRegion: string[];
|
75
77
|
declare const localeCodes: LocaleCode[];
|
76
78
|
declare const localeCodeSchema: Z.ZodEffects<Z.ZodString, string, string>;
|
77
|
-
|
78
|
-
|
79
|
-
|
79
|
+
/**
|
80
|
+
* Resolves a locale code to its full locale representation.
|
81
|
+
*
|
82
|
+
* If the provided locale code is already a full locale code, it returns as is.
|
83
|
+
* If the provided locale code is a short locale code, it returns the first corresponding full locale.
|
84
|
+
* If the locale code is not found, it throws an error.
|
85
|
+
*
|
86
|
+
* @param {localeCodes} value - The locale code to resolve (either short or full)
|
87
|
+
* @return {LocaleCodeFull} The resolved full locale code
|
88
|
+
* @throws {Error} If the provided locale code is invalid.
|
89
|
+
*/
|
90
|
+
declare const resolveLocaleCode: (value: string) => LocaleCodeFull;
|
91
|
+
/**
|
92
|
+
* Determines the delimiter used in a locale code
|
93
|
+
*
|
94
|
+
* @param {string} locale - the locale string (e.g.,"en_US","en-GB")
|
95
|
+
* @return { string | null} - The delimiter ("_" or "-") if found, otherwise `null`.
|
96
|
+
*/
|
97
|
+
declare const getLocaleCodeDelimiter: (locale: string) => LocaleDelimiter;
|
98
|
+
/**
|
99
|
+
* Replaces the delimiter in a locale string with the specified delimiter.
|
100
|
+
*
|
101
|
+
* @param {string}locale - The locale string (e.g.,"en_US", "en-GB").
|
102
|
+
* @param {"-" | "_" | null} [delimiter] - The new delimiter to replace the existing one.
|
103
|
+
* @returns {string} The locale string with the replaced delimiter, or the original locale if no delimiter is provided.
|
104
|
+
*/
|
105
|
+
declare const resolveOverriddenLocale: (locale: string, delimiter?: LocaleDelimiter) => string;
|
106
|
+
/**
|
107
|
+
* Normalizes a locale string by replacing underscores with hyphens
|
108
|
+
* and removing the "r" in certain regional codes (e.g., "fr-rCA" → "fr-CA")
|
109
|
+
*
|
110
|
+
* @param {string} locale - The locale string (e.g.,"en_US", "en-GB").
|
111
|
+
* @return {string} The normalized locale string.
|
112
|
+
*/
|
80
113
|
declare function normalizeLocale(locale: string): string;
|
81
114
|
|
82
115
|
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"];
|
@@ -483,4 +516,4 @@ declare const defaultConfig: {
|
|
483
516
|
$schema: string;
|
484
517
|
};
|
485
518
|
|
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,
|
519
|
+
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
@@ -52,6 +52,7 @@ declare const localeMap: {
|
|
52
52
|
readonly pa: readonly ["pa-IN", "pa-PK"];
|
53
53
|
readonly bn: readonly ["bn-BD", "bn-IN"];
|
54
54
|
readonly ga: readonly ["ga-IE"];
|
55
|
+
readonly gl: readonly ["gl-ES"];
|
55
56
|
readonly mt: readonly ["mt-MT"];
|
56
57
|
readonly sl: readonly ["sl-SI"];
|
57
58
|
readonly sq: readonly ["sq-AL"];
|
@@ -68,15 +69,47 @@ declare const localeMap: {
|
|
68
69
|
type LocaleCodeShort = keyof typeof localeMap;
|
69
70
|
type LocaleCodeFull = (typeof localeMap)[LocaleCodeShort][number];
|
70
71
|
type LocaleCode = LocaleCodeShort | LocaleCodeFull;
|
72
|
+
type LocaleDelimiter = "-" | "_" | null;
|
71
73
|
declare const localeCodesShort: LocaleCodeShort[];
|
72
74
|
declare const localeCodesFull: LocaleCodeFull[];
|
73
75
|
declare const localeCodesFullUnderscore: string[];
|
74
76
|
declare const localeCodesFullExplicitRegion: string[];
|
75
77
|
declare const localeCodes: LocaleCode[];
|
76
78
|
declare const localeCodeSchema: Z.ZodEffects<Z.ZodString, string, string>;
|
77
|
-
|
78
|
-
|
79
|
-
|
79
|
+
/**
|
80
|
+
* Resolves a locale code to its full locale representation.
|
81
|
+
*
|
82
|
+
* If the provided locale code is already a full locale code, it returns as is.
|
83
|
+
* If the provided locale code is a short locale code, it returns the first corresponding full locale.
|
84
|
+
* If the locale code is not found, it throws an error.
|
85
|
+
*
|
86
|
+
* @param {localeCodes} value - The locale code to resolve (either short or full)
|
87
|
+
* @return {LocaleCodeFull} The resolved full locale code
|
88
|
+
* @throws {Error} If the provided locale code is invalid.
|
89
|
+
*/
|
90
|
+
declare const resolveLocaleCode: (value: string) => LocaleCodeFull;
|
91
|
+
/**
|
92
|
+
* Determines the delimiter used in a locale code
|
93
|
+
*
|
94
|
+
* @param {string} locale - the locale string (e.g.,"en_US","en-GB")
|
95
|
+
* @return { string | null} - The delimiter ("_" or "-") if found, otherwise `null`.
|
96
|
+
*/
|
97
|
+
declare const getLocaleCodeDelimiter: (locale: string) => LocaleDelimiter;
|
98
|
+
/**
|
99
|
+
* Replaces the delimiter in a locale string with the specified delimiter.
|
100
|
+
*
|
101
|
+
* @param {string}locale - The locale string (e.g.,"en_US", "en-GB").
|
102
|
+
* @param {"-" | "_" | null} [delimiter] - The new delimiter to replace the existing one.
|
103
|
+
* @returns {string} The locale string with the replaced delimiter, or the original locale if no delimiter is provided.
|
104
|
+
*/
|
105
|
+
declare const resolveOverriddenLocale: (locale: string, delimiter?: LocaleDelimiter) => string;
|
106
|
+
/**
|
107
|
+
* Normalizes a locale string by replacing underscores with hyphens
|
108
|
+
* and removing the "r" in certain regional codes (e.g., "fr-rCA" → "fr-CA")
|
109
|
+
*
|
110
|
+
* @param {string} locale - The locale string (e.g.,"en_US", "en-GB").
|
111
|
+
* @return {string} The normalized locale string.
|
112
|
+
*/
|
80
113
|
declare function normalizeLocale(locale: string): string;
|
81
114
|
|
82
115
|
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"];
|
@@ -483,4 +516,4 @@ declare const defaultConfig: {
|
|
483
516
|
$schema: string;
|
484
517
|
};
|
485
518
|
|
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,
|
519
|
+
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
@@ -222,6 +222,8 @@ var localeMap = {
|
|
222
222
|
],
|
223
223
|
// Irish (Ireland)
|
224
224
|
ga: ["ga-IE"],
|
225
|
+
// Galician (Spain)
|
226
|
+
gl: ["gl-ES"],
|
225
227
|
// Maltese (Malta)
|
226
228
|
mt: ["mt-MT"],
|
227
229
|
// Slovenian (Slovenia)
|
@@ -286,7 +288,7 @@ var getLocaleCodeDelimiter = (locale) => {
|
|
286
288
|
return null;
|
287
289
|
}
|
288
290
|
};
|
289
|
-
var
|
291
|
+
var resolveOverriddenLocale = (locale, delimiter) => {
|
290
292
|
if (!delimiter) {
|
291
293
|
return locale;
|
292
294
|
}
|
@@ -524,5 +526,5 @@ export {
|
|
524
526
|
normalizeLocale,
|
525
527
|
parseI18nConfig,
|
526
528
|
resolveLocaleCode,
|
527
|
-
|
529
|
+
resolveOverriddenLocale
|
528
530
|
};
|