@lingo.dev/_spec 0.26.3 → 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 +2 -2
- package/build/index.d.cts +36 -4
- package/build/index.d.ts +36 -4
- package/build/index.mjs +2 -2
- package/package.json +1 -1
package/build/index.cjs
CHANGED
@@ -288,7 +288,7 @@ var getLocaleCodeDelimiter = (locale) => {
|
|
288
288
|
return null;
|
289
289
|
}
|
290
290
|
};
|
291
|
-
var
|
291
|
+
var resolveOverriddenLocale = (locale, delimiter) => {
|
292
292
|
if (!delimiter) {
|
293
293
|
return locale;
|
294
294
|
}
|
@@ -527,4 +527,4 @@ var defaultConfig = LATEST_CONFIG_DEFINITION.defaultValue;
|
|
527
527
|
|
528
528
|
|
529
529
|
|
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.
|
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
@@ -69,15 +69,47 @@ declare const localeMap: {
|
|
69
69
|
type LocaleCodeShort = keyof typeof localeMap;
|
70
70
|
type LocaleCodeFull = (typeof localeMap)[LocaleCodeShort][number];
|
71
71
|
type LocaleCode = LocaleCodeShort | LocaleCodeFull;
|
72
|
+
type LocaleDelimiter = "-" | "_" | null;
|
72
73
|
declare const localeCodesShort: LocaleCodeShort[];
|
73
74
|
declare const localeCodesFull: LocaleCodeFull[];
|
74
75
|
declare const localeCodesFullUnderscore: string[];
|
75
76
|
declare const localeCodesFullExplicitRegion: string[];
|
76
77
|
declare const localeCodes: LocaleCode[];
|
77
78
|
declare const localeCodeSchema: Z.ZodEffects<Z.ZodString, string, string>;
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
+
*/
|
81
113
|
declare function normalizeLocale(locale: string): string;
|
82
114
|
|
83
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"];
|
@@ -484,4 +516,4 @@ declare const defaultConfig: {
|
|
484
516
|
$schema: string;
|
485
517
|
};
|
486
518
|
|
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,
|
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
@@ -69,15 +69,47 @@ declare const localeMap: {
|
|
69
69
|
type LocaleCodeShort = keyof typeof localeMap;
|
70
70
|
type LocaleCodeFull = (typeof localeMap)[LocaleCodeShort][number];
|
71
71
|
type LocaleCode = LocaleCodeShort | LocaleCodeFull;
|
72
|
+
type LocaleDelimiter = "-" | "_" | null;
|
72
73
|
declare const localeCodesShort: LocaleCodeShort[];
|
73
74
|
declare const localeCodesFull: LocaleCodeFull[];
|
74
75
|
declare const localeCodesFullUnderscore: string[];
|
75
76
|
declare const localeCodesFullExplicitRegion: string[];
|
76
77
|
declare const localeCodes: LocaleCode[];
|
77
78
|
declare const localeCodeSchema: Z.ZodEffects<Z.ZodString, string, string>;
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
+
*/
|
81
113
|
declare function normalizeLocale(locale: string): string;
|
82
114
|
|
83
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"];
|
@@ -484,4 +516,4 @@ declare const defaultConfig: {
|
|
484
516
|
$schema: string;
|
485
517
|
};
|
486
518
|
|
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,
|
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
@@ -288,7 +288,7 @@ var getLocaleCodeDelimiter = (locale) => {
|
|
288
288
|
return null;
|
289
289
|
}
|
290
290
|
};
|
291
|
-
var
|
291
|
+
var resolveOverriddenLocale = (locale, delimiter) => {
|
292
292
|
if (!delimiter) {
|
293
293
|
return locale;
|
294
294
|
}
|
@@ -526,5 +526,5 @@ export {
|
|
526
526
|
normalizeLocale,
|
527
527
|
parseI18nConfig,
|
528
528
|
resolveLocaleCode,
|
529
|
-
|
529
|
+
resolveOverriddenLocale
|
530
530
|
};
|