generaltranslation 8.2.13 → 8.2.14
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/CHANGELOG.md +11 -0
- package/dist/{ApiError-IYfaOR30.mjs → ApiError-0DxxIHLp.mjs} +1 -1
- package/dist/{ApiError-CZ45tkW6.cjs.map → ApiError-0DxxIHLp.mjs.map} +1 -1
- package/dist/{ApiError-CZ45tkW6.cjs → ApiError-D-IBuHj6.cjs} +1 -1
- package/dist/{ApiError-IYfaOR30.mjs.map → ApiError-D-IBuHj6.cjs.map} +1 -1
- package/dist/LocaleConfig.d.ts +1 -59
- package/dist/LocaleConfig.js +1 -225
- package/dist/{base64-2fu94Klt.cjs → base64-C6BHySOc.cjs} +17 -1
- package/dist/base64-C6BHySOc.cjs.map +1 -0
- package/dist/{base64-DH0STixb.mjs → base64-CWITCfhU.mjs} +6 -2
- package/dist/base64-CWITCfhU.mjs.map +1 -0
- package/dist/core.cjs +9 -8
- package/dist/core.d.cts +1 -2
- package/dist/core.d.mts +1 -2
- package/dist/core.d.ts +1 -128
- package/dist/core.js +1 -137
- package/dist/core.mjs +2 -2
- package/dist/derive/indexVars.d.ts +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/id/types.d.ts +1 -1
- package/dist/{id-CyiXsQrY.cjs → id-C2orn1MA.cjs} +2 -2
- package/dist/{id-CyiXsQrY.cjs.map → id-C2orn1MA.cjs.map} +1 -1
- package/dist/{id-DbD7K-HL.mjs → id-DEaFhGqX.mjs} +2 -2
- package/dist/{id-DbD7K-HL.mjs.map → id-DEaFhGqX.mjs.map} +1 -1
- package/dist/id.cjs +1 -1
- package/dist/id.d.cts +1 -1
- package/dist/id.d.mts +1 -1
- package/dist/id.mjs +1 -1
- package/dist/index.cjs +368 -385
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -242
- package/dist/index.d.mts +4 -242
- package/dist/index.d.ts +5 -238
- package/dist/index.js +3 -322
- package/dist/index.mjs +215 -352
- package/dist/index.mjs.map +1 -1
- package/dist/internal.cjs +6 -6
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +6 -5
- package/dist/internal.d.mts +6 -5
- package/dist/internal.mjs +4 -4
- package/dist/internal.mjs.map +1 -1
- package/dist/{isVariable-B08mggBy.cjs → isVariable-Ba1gLXdB.cjs} +1 -1
- package/dist/{isVariable-B08mggBy.cjs.map → isVariable-Ba1gLXdB.cjs.map} +1 -1
- package/dist/{isVariable-CYsKFHvR.mjs → isVariable-fAKEB7gF.mjs} +1 -1
- package/dist/{isVariable-CYsKFHvR.mjs.map → isVariable-fAKEB7gF.mjs.map} +1 -1
- package/dist/locales/getPluralForm.js +2 -2
- package/dist/logging/logger.d.ts +0 -3
- package/dist/logging/logger.js +0 -3
- package/dist/{types-AHtYZIP-.d.mts → types-73XFwmhH.d.mts} +7 -106
- package/dist/{types-Bf8_Apq_.d.cts → types-YrrGRHBP.d.cts} +7 -106
- package/dist/types-dir/api/enqueueEntries.d.ts +1 -1
- package/dist/types-dir/api/enqueueFiles.d.ts +1 -1
- package/dist/types-dir/api/fetchTranslations.d.ts +1 -1
- package/dist/types-dir/api/file.d.ts +1 -1
- package/dist/types-dir/api/translate.d.ts +1 -1
- package/dist/types-dir/api/uploadFiles.d.ts +1 -1
- package/dist/types.cjs +7 -16
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +10 -12
- package/dist/types.js +1 -2
- package/dist/types.mjs +1 -15
- package/package.json +3 -2
- package/dist/IntlCache-CAW8tKhd.cjs +0 -212
- package/dist/IntlCache-CAW8tKhd.cjs.map +0 -1
- package/dist/IntlCache-WZk0rKvj.mjs +0 -195
- package/dist/IntlCache-WZk0rKvj.mjs.map +0 -1
- package/dist/base64-2fu94Klt.cjs.map +0 -1
- package/dist/base64-DH0STixb.mjs.map +0 -1
- package/dist/cache/IntlCache.d.ts +0 -26
- package/dist/cache/IntlCache.js +0 -84
- package/dist/cache/types.d.ts +0 -32
- package/dist/cache/types.js +0 -1
- package/dist/core-7RP541eY.cjs +0 -1677
- package/dist/core-7RP541eY.cjs.map +0 -1
- package/dist/core-I9pWGafA.d.mts +0 -209
- package/dist/core-TLJoDpJP.d.cts +0 -209
- package/dist/core-isLphYAZ.mjs +0 -1498
- package/dist/core-isLphYAZ.mjs.map +0 -1
- package/dist/errors/formattingErrors.d.ts +0 -1
- package/dist/errors/formattingErrors.js +0 -3
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +0 -59
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.js +0 -147
- package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +0 -4
- package/dist/formatting/custom-formats/CutoffFormat/constants.js +0 -30
- package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +0 -48
- package/dist/formatting/custom-formats/CutoffFormat/types.js +0 -2
- package/dist/formatting/format.d.ts +0 -1
- package/dist/formatting/format.js +0 -257
- package/dist/locales/customLocaleMapping.d.ts +0 -11
- package/dist/locales/customLocaleMapping.js +0 -23
- package/dist/locales/determineLocale.d.ts +0 -1
- package/dist/locales/determineLocale.js +0 -72
- package/dist/locales/getLocaleDirection.d.ts +0 -1
- package/dist/locales/getLocaleDirection.js +0 -89
- package/dist/locales/getLocaleEmoji.d.ts +0 -2
- package/dist/locales/getLocaleEmoji.js +0 -319
- package/dist/locales/getLocaleName.d.ts +0 -1
- package/dist/locales/getLocaleName.js +0 -45
- package/dist/locales/getLocaleProperties.d.ts +0 -32
- package/dist/locales/getLocaleProperties.js +0 -220
- package/dist/locales/getRegionProperties.d.ts +0 -7
- package/dist/locales/getRegionProperties.js +0 -61
- package/dist/locales/isSameDialect.d.ts +0 -1
- package/dist/locales/isSameDialect.js +0 -41
- package/dist/locales/isSameLanguage.d.ts +0 -1
- package/dist/locales/isSameLanguage.js +0 -20
- package/dist/locales/isSupersetLocale.d.ts +0 -1
- package/dist/locales/isSupersetLocale.js +0 -22
- package/dist/locales/isValidLocale.d.ts +0 -1
- package/dist/locales/isValidLocale.js +0 -75
- package/dist/locales/requiresTranslation.d.ts +0 -1
- package/dist/locales/requiresTranslation.js +0 -32
- package/dist/locales/resolveAliasLocale.d.ts +0 -8
- package/dist/locales/resolveAliasLocale.js +0 -21
- package/dist/locales/resolveCanonicalLocale.d.ts +0 -8
- package/dist/locales/resolveCanonicalLocale.js +0 -13
- package/dist/logging/warnings.d.ts +0 -2
- package/dist/logging/warnings.js +0 -2
- package/dist/types-dir/jsx/content.d.ts +0 -61
- package/dist/types-dir/jsx/content.js +0 -11
- package/dist/types-dir/jsx/variables.d.ts +0 -9
- package/dist/types-dir/jsx/variables.js +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/types.mjs.map +0 -1
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { intlCache } from '../cache/IntlCache';
|
|
13
|
-
import { libraryDefaultLocale } from '../settings/settings';
|
|
14
|
-
import { defaultEmoji, getRegionEmoji } from './getLocaleEmoji';
|
|
15
|
-
/**
|
|
16
|
-
* Retrieves multiple properties for a given region code, including:
|
|
17
|
-
* - `code`: the original region code
|
|
18
|
-
* - `name`: the localized display name
|
|
19
|
-
* - `emoji`: the associated flag or symbol
|
|
20
|
-
*
|
|
21
|
-
* Behavior:
|
|
22
|
-
* - Accepts ISO 3166-1 alpha-2 or UN M.49 region codes (e.g., `"US"`, `"FR"`, `"419"`).
|
|
23
|
-
* - If `customMapping` contains a `name` or `emoji` for the region, those override the default values.
|
|
24
|
-
* - Otherwise, uses `Intl.DisplayNames` to get the localized region name in the given `defaultLocale`,
|
|
25
|
-
* falling back to `libraryDefaultLocale`.
|
|
26
|
-
* - Falls back to the region code as `name` if display name resolution fails.
|
|
27
|
-
* - Falls back to `defaultEmoji` if no emoji can be computed or found in `customMapping`.
|
|
28
|
-
*
|
|
29
|
-
* @param {string} region - The region code to look up (e.g., `"US"`, `"GB"`, `"DE"`).
|
|
30
|
-
* @param {string} [defaultLocale=libraryDefaultLocale] - The locale to use when localizing the region name.
|
|
31
|
-
* @param {CustomRegionMapping} [customMapping] - Optional mapping of region codes to custom names and/or emojis.
|
|
32
|
-
* @returns {{ code: string, name: string, emoji: string }} An object containing:
|
|
33
|
-
* - `code`: the input region code
|
|
34
|
-
* - `name`: the localized or custom region name
|
|
35
|
-
* - `emoji`: the matching emoji flag or symbol
|
|
36
|
-
* @internal
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* _getRegionProperties('US', 'en');
|
|
40
|
-
* // => { code: 'US', name: 'United States', emoji: '🇺🇸' }
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* _getRegionProperties('US', 'fr');
|
|
44
|
-
* // => { code: 'US', name: 'États-Unis', emoji: '🇺🇸' }
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* _getRegionProperties('US', 'en', { US: { name: 'USA', emoji: '🗽' } });
|
|
48
|
-
* // => { code: 'US', name: 'USA', emoji: '🗽' }
|
|
49
|
-
*/
|
|
50
|
-
export function _getRegionProperties(region, defaultLocale, customMapping) {
|
|
51
|
-
if (defaultLocale === void 0) { defaultLocale = libraryDefaultLocale; }
|
|
52
|
-
defaultLocale || (defaultLocale = libraryDefaultLocale);
|
|
53
|
-
try {
|
|
54
|
-
var displayNames = intlCache.get('DisplayNames', [defaultLocale, libraryDefaultLocale], // default language order
|
|
55
|
-
{ type: 'region' });
|
|
56
|
-
return __assign({ code: region, name: displayNames.of(region) || region, emoji: getRegionEmoji(region) }, customMapping === null || customMapping === void 0 ? void 0 : customMapping[region]);
|
|
57
|
-
}
|
|
58
|
-
catch (_a) {
|
|
59
|
-
return __assign({ code: region, name: region, emoji: defaultEmoji }, customMapping === null || customMapping === void 0 ? void 0 : customMapping[region]);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { intlCache } from '../cache/IntlCache';
|
|
2
|
-
import { _standardizeLocale } from './isValidLocale';
|
|
3
|
-
function checkTwoLocalesAreSameDialect(codeA, codeB) {
|
|
4
|
-
var _a = intlCache.get('Locale', codeA), languageA = _a.language, regionA = _a.region, scriptA = _a.script;
|
|
5
|
-
var _b = intlCache.get('Locale', codeB), languageB = _b.language, regionB = _b.region, scriptB = _b.script;
|
|
6
|
-
if (languageA !== languageB)
|
|
7
|
-
return false;
|
|
8
|
-
if (regionA && regionB && regionA !== regionB)
|
|
9
|
-
return false;
|
|
10
|
-
if (scriptA && scriptB && scriptA !== scriptB)
|
|
11
|
-
return false;
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Test two or more language codes to determine if they are exactly the same
|
|
16
|
-
* e.g. "en-US" and "en" would be exactly the same.
|
|
17
|
-
* "en-GB" and "en" would be exactly the same.
|
|
18
|
-
* "en-GB" and "en-US" would be different.
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export default function _isSameDialect() {
|
|
22
|
-
var locales = [];
|
|
23
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
24
|
-
locales[_i] = arguments[_i];
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
// standardize codes
|
|
28
|
-
var flattenedCodes = locales.flat().map(_standardizeLocale);
|
|
29
|
-
for (var i = 0; i < flattenedCodes.length; i++) {
|
|
30
|
-
for (var j = i + 1; j < flattenedCodes.length; j++) {
|
|
31
|
-
if (!checkTwoLocalesAreSameDialect(flattenedCodes[i], flattenedCodes[j]))
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error(error);
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { intlCache } from '../cache/IntlCache';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export default function _isSameLanguage() {
|
|
6
|
-
var locales = [];
|
|
7
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8
|
-
locales[_i] = arguments[_i];
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
var flattenedCodes = locales.flat();
|
|
12
|
-
// Get the language for each code
|
|
13
|
-
var languages_1 = flattenedCodes.map(function (locale) { return intlCache.get('Locale', locale).language; });
|
|
14
|
-
return languages_1.every(function (language) { return language === languages_1[0]; });
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
console.error(error);
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { intlCache } from '../cache/IntlCache';
|
|
2
|
-
import { _standardizeLocale } from './isValidLocale';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export default function _isSupersetLocale(superLocale, subLocale) {
|
|
7
|
-
try {
|
|
8
|
-
var _a = intlCache.get('Locale', _standardizeLocale(superLocale)), languageSuper = _a.language, regionSuper = _a.region, scriptSuper = _a.script;
|
|
9
|
-
var _b = intlCache.get('Locale', _standardizeLocale(subLocale)), languageSub = _b.language, regionSub = _b.region, scriptSub = _b.script;
|
|
10
|
-
if (languageSuper !== languageSub)
|
|
11
|
-
return false;
|
|
12
|
-
if (regionSuper && regionSuper !== regionSub)
|
|
13
|
-
return false;
|
|
14
|
-
if (scriptSuper && scriptSuper !== scriptSub)
|
|
15
|
-
return false;
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
console.error(error);
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { intlCache } from '../cache/IntlCache';
|
|
2
|
-
import { libraryDefaultLocale } from '../settings/settings';
|
|
3
|
-
var scriptExceptions = ['Cham', 'Jamo', 'Kawi', 'Lisu', 'Toto', 'Thai'];
|
|
4
|
-
//// According to BCP 47, the range qaa–qtz is reserved for private-use language codes
|
|
5
|
-
var isCustomLanguage = function (language) {
|
|
6
|
-
return language >= 'qaa' && language <= 'qtz';
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Checks if a given BCP 47 language code is valid.
|
|
10
|
-
* @param {string} code - The BCP 47 language code to validate.
|
|
11
|
-
* @param {CustomMapping} [customMapping] - The custom mapping to use for validation.
|
|
12
|
-
* @returns {boolean} True if the BCP 47 code is valid, false otherwise.
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export var _isValidLocale = function (locale, customMapping) {
|
|
16
|
-
// If in custom mapping, return true
|
|
17
|
-
if ((customMapping === null || customMapping === void 0 ? void 0 : customMapping[locale]) &&
|
|
18
|
-
typeof customMapping[locale] === 'object' &&
|
|
19
|
-
'code' in customMapping[locale] &&
|
|
20
|
-
customMapping[locale].code) {
|
|
21
|
-
locale = customMapping[locale].code;
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
var _a = intlCache.get('Locale', locale), language = _a.language, region_1 = _a.region, script_1 = _a.script;
|
|
25
|
-
if (locale.split('-').length !==
|
|
26
|
-
(function () {
|
|
27
|
-
var partCount = 1;
|
|
28
|
-
if (region_1)
|
|
29
|
-
partCount += 1;
|
|
30
|
-
if (script_1)
|
|
31
|
-
partCount += 1;
|
|
32
|
-
return partCount;
|
|
33
|
-
})())
|
|
34
|
-
return false;
|
|
35
|
-
var displayLanguageNames = intlCache.get('DisplayNames', [libraryDefaultLocale], {
|
|
36
|
-
type: 'language',
|
|
37
|
-
});
|
|
38
|
-
if (displayLanguageNames.of(language) === language &&
|
|
39
|
-
!isCustomLanguage(language))
|
|
40
|
-
return false;
|
|
41
|
-
if (region_1) {
|
|
42
|
-
var displayRegionNames = intlCache.get('DisplayNames', [libraryDefaultLocale], {
|
|
43
|
-
type: 'region',
|
|
44
|
-
});
|
|
45
|
-
if (displayRegionNames.of(region_1) === region_1)
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
if (script_1) {
|
|
49
|
-
var displayScriptNames = intlCache.get('DisplayNames', [libraryDefaultLocale], {
|
|
50
|
-
type: 'script',
|
|
51
|
-
});
|
|
52
|
-
if (displayScriptNames.of(script_1) === script_1 &&
|
|
53
|
-
!scriptExceptions.includes(script_1))
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
catch (_b) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Standardizes a BCP 47 locale to ensure correct formatting.
|
|
64
|
-
* @param {string} locale - The BCP 47 locale to standardize.
|
|
65
|
-
* @returns {string} The standardized BCP 47 locale, or the input string if it cannot be standardized.
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
export var _standardizeLocale = function (locale) {
|
|
69
|
-
try {
|
|
70
|
-
return Intl.getCanonicalLocales(locale)[0];
|
|
71
|
-
}
|
|
72
|
-
catch (_a) {
|
|
73
|
-
return locale;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import _isSameDialect from './isSameDialect';
|
|
2
|
-
import _isSameLanguage from './isSameLanguage';
|
|
3
|
-
import { _isValidLocale } from './isValidLocale';
|
|
4
|
-
/**
|
|
5
|
-
* Given a target locale and a source locale, determines whether a translation is required
|
|
6
|
-
* If the target locale and the source locale are the same, returns false, otherwise returns true
|
|
7
|
-
* If a translation is not possible due to the target locale being outside of the optional approvedLanguages scope, also returns false
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export default function _requiresTranslation(sourceLocale, targetLocale, approvedLocales, customMapping) {
|
|
11
|
-
// If codes are invalid
|
|
12
|
-
if (!_isValidLocale(sourceLocale, customMapping) ||
|
|
13
|
-
!_isValidLocale(targetLocale, customMapping) ||
|
|
14
|
-
(approvedLocales &&
|
|
15
|
-
approvedLocales.some(function (approvedLocale) { return !_isValidLocale(approvedLocale, customMapping); }))) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
// Check if the languages are identical, if so, a translation is not required
|
|
19
|
-
if (_isSameDialect(sourceLocale, targetLocale)) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
// Check that the target locale is within the approvedLocales scope, if not, a translation is not required
|
|
23
|
-
// isSameLanguage rather than checkTwoLocalesAreSameDialect so we can show different dialects as a fallback
|
|
24
|
-
if (approvedLocales &&
|
|
25
|
-
!approvedLocales.some(function (approvedLocale) {
|
|
26
|
-
return _isSameLanguage(targetLocale, approvedLocale);
|
|
27
|
-
})) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
// Otherwise, a translation is required!
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CustomMapping } from './customLocaleMapping';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the alias locale for a given locale.
|
|
4
|
-
* @param locale - The locale to resolve the alias locale for
|
|
5
|
-
* @param customMapping - The custom mapping to use for resolving the alias locale
|
|
6
|
-
* @returns The configured alias for a canonical locale, or the input locale when already an alias or no alias mapping exists.
|
|
7
|
-
*/
|
|
8
|
-
export declare function _resolveAliasLocale(locale: string, customMapping?: CustomMapping): string;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves the alias locale for a given locale.
|
|
3
|
-
* @param locale - The locale to resolve the alias locale for
|
|
4
|
-
* @param customMapping - The custom mapping to use for resolving the alias locale
|
|
5
|
-
* @returns The configured alias for a canonical locale, or the input locale when already an alias or no alias mapping exists.
|
|
6
|
-
*/
|
|
7
|
-
export function _resolveAliasLocale(locale, customMapping) {
|
|
8
|
-
var reverseCustomMapping;
|
|
9
|
-
if (customMapping) {
|
|
10
|
-
reverseCustomMapping = Object.fromEntries(Object.entries(customMapping)
|
|
11
|
-
.filter(function (_a) {
|
|
12
|
-
var value = _a[1];
|
|
13
|
-
return value && typeof value === 'object' && 'code' in value;
|
|
14
|
-
})
|
|
15
|
-
.map(function (_a) {
|
|
16
|
-
var key = _a[0], value = _a[1];
|
|
17
|
-
return [value.code, key];
|
|
18
|
-
}));
|
|
19
|
-
}
|
|
20
|
-
return (reverseCustomMapping === null || reverseCustomMapping === void 0 ? void 0 : reverseCustomMapping[locale]) || locale;
|
|
21
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CustomMapping } from './customLocaleMapping';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the canonical locale for a given locale.
|
|
4
|
-
* @param locale - The locale to resolve the canonical locale for
|
|
5
|
-
* @param customMapping - The custom mapping to use for resolving the canonical locale
|
|
6
|
-
* @returns The canonical locale, or the input locale when no canonical mapping exists.
|
|
7
|
-
*/
|
|
8
|
-
export declare function _resolveCanonicalLocale(locale: string, customMapping?: CustomMapping): string;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { shouldUseCanonicalLocale } from './customLocaleMapping';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the canonical locale for a given locale.
|
|
4
|
-
* @param locale - The locale to resolve the canonical locale for
|
|
5
|
-
* @param customMapping - The custom mapping to use for resolving the canonical locale
|
|
6
|
-
* @returns The canonical locale, or the input locale when no canonical mapping exists.
|
|
7
|
-
*/
|
|
8
|
-
export function _resolveCanonicalLocale(locale, customMapping) {
|
|
9
|
-
if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {
|
|
10
|
-
return customMapping[locale].code;
|
|
11
|
-
}
|
|
12
|
-
return locale;
|
|
13
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const formatI18nextWarning = "Warning: formatI18next is not currently supported but will be implemented in a future version. Use _formatMessageICU for current ICU message format support.";
|
|
2
|
-
export declare const formatJsxWarning = "Warning: formatJsx is not currently supported but will be implemented in a future version. Use _formatMessageICU for current ICU message format support.";
|
package/dist/logging/warnings.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export var formatI18nextWarning = 'Warning: formatI18next is not currently supported but will be implemented in a future version. Use _formatMessageICU for current ICU message format support.';
|
|
2
|
-
export var formatJsxWarning = 'Warning: formatJsx is not currently supported but will be implemented in a future version. Use _formatMessageICU for current ICU message format support.';
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Variable } from './variables';
|
|
2
|
-
/**
|
|
3
|
-
* Map of data-_gt properties to their corresponding React props
|
|
4
|
-
*/
|
|
5
|
-
export declare const HTML_CONTENT_PROPS: {
|
|
6
|
-
readonly pl: "placeholder";
|
|
7
|
-
readonly ti: "title";
|
|
8
|
-
readonly alt: "alt";
|
|
9
|
-
readonly arl: "aria-label";
|
|
10
|
-
readonly arb: "aria-labelledby";
|
|
11
|
-
readonly ard: "aria-describedby";
|
|
12
|
-
};
|
|
13
|
-
export type HtmlContentPropKeysRecord = Partial<Record<keyof typeof HTML_CONTENT_PROPS, string>>;
|
|
14
|
-
export type HtmlContentPropValuesRecord = Partial<Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>>;
|
|
15
|
-
/**
|
|
16
|
-
* GTProp is an internal property used to contain data for translating and rendering elements.
|
|
17
|
-
* note, transformations are only read on the server side if they are 'plural' or 'branch'
|
|
18
|
-
*/
|
|
19
|
-
export type GTProp = {
|
|
20
|
-
b?: Record<string, JsxChildren>;
|
|
21
|
-
t?: 'p' | 'b';
|
|
22
|
-
} & HtmlContentPropKeysRecord;
|
|
23
|
-
export type JsxElement = {
|
|
24
|
-
t?: string;
|
|
25
|
-
i?: number;
|
|
26
|
-
d?: GTProp;
|
|
27
|
-
c?: JsxChildren;
|
|
28
|
-
};
|
|
29
|
-
export type JsxChild = string | JsxElement | Variable;
|
|
30
|
-
/**
|
|
31
|
-
* The format of the string content
|
|
32
|
-
*/
|
|
33
|
-
export type StringFormat = 'ICU' | 'I18NEXT' | 'STRING';
|
|
34
|
-
/**
|
|
35
|
-
* The format of the content.
|
|
36
|
-
*/
|
|
37
|
-
export type DataFormat = 'JSX' | StringFormat;
|
|
38
|
-
/**
|
|
39
|
-
* String format content.
|
|
40
|
-
*/
|
|
41
|
-
export type StringContent = IcuMessage | StringMessage | I18nextMessage;
|
|
42
|
-
/**
|
|
43
|
-
* A content type representing JSX, ICU, and I18next messages.
|
|
44
|
-
*/
|
|
45
|
-
export type Content = JsxChildren | StringContent;
|
|
46
|
-
/**
|
|
47
|
-
* A content type representing JSX elements.
|
|
48
|
-
*/
|
|
49
|
-
export type JsxChildren = JsxChild | JsxChild[];
|
|
50
|
-
/**
|
|
51
|
-
* A content type representing ICU messages.
|
|
52
|
-
*/
|
|
53
|
-
export type IcuMessage = string;
|
|
54
|
-
/**
|
|
55
|
-
* A content type representing I18next messages.
|
|
56
|
-
*/
|
|
57
|
-
export type I18nextMessage = string;
|
|
58
|
-
/**
|
|
59
|
-
* A content type representing plain strings.
|
|
60
|
-
*/
|
|
61
|
-
export type StringMessage = string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":[],"sources":["../src/types-dir/jsx/content.ts"],"sourcesContent":["import { Variable } from './variables';\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n b?: Record<string, JsxChildren>; // Branches\n t?: 'p' | 'b'; // Branch Transformation\n} & HtmlContentPropKeysRecord;\n\nexport type JsxElement = {\n t?: string; // tag name\n i?: number; // id\n d?: GTProp; // GT data\n c?: JsxChildren; // children\n};\n\nexport type JsxChild = string | JsxElement | Variable;\n\n/**\n * The format of the string content\n */\nexport type StringFormat = 'ICU' | 'I18NEXT' | 'STRING';\n\n/**\n * The format of the content.\n */\nexport type DataFormat = 'JSX' | StringFormat;\n\n/**\n * String format content.\n */\nexport type StringContent = IcuMessage | StringMessage | I18nextMessage;\n\n/**\n * A content type representing JSX, ICU, and I18next messages.\n */\nexport type Content = JsxChildren | StringContent;\n\n/**\n * A content type representing JSX elements.\n */\nexport type JsxChildren = JsxChild | JsxChild[];\n\n/**\n * A content type representing ICU messages.\n */\nexport type IcuMessage = string;\n\n/**\n * A content type representing I18next messages.\n */\nexport type I18nextMessage = string;\n\n/**\n * A content type representing plain strings.\n */\nexport type StringMessage = string;\n"],"mappings":";;;;;AAKA,MAAa,qBAAqB;CAChC,IAAI;CACJ,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN"}
|
package/dist/types.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../src/types-dir/jsx/content.ts"],"sourcesContent":["import { Variable } from './variables';\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n b?: Record<string, JsxChildren>; // Branches\n t?: 'p' | 'b'; // Branch Transformation\n} & HtmlContentPropKeysRecord;\n\nexport type JsxElement = {\n t?: string; // tag name\n i?: number; // id\n d?: GTProp; // GT data\n c?: JsxChildren; // children\n};\n\nexport type JsxChild = string | JsxElement | Variable;\n\n/**\n * The format of the string content\n */\nexport type StringFormat = 'ICU' | 'I18NEXT' | 'STRING';\n\n/**\n * The format of the content.\n */\nexport type DataFormat = 'JSX' | StringFormat;\n\n/**\n * String format content.\n */\nexport type StringContent = IcuMessage | StringMessage | I18nextMessage;\n\n/**\n * A content type representing JSX, ICU, and I18next messages.\n */\nexport type Content = JsxChildren | StringContent;\n\n/**\n * A content type representing JSX elements.\n */\nexport type JsxChildren = JsxChild | JsxChild[];\n\n/**\n * A content type representing ICU messages.\n */\nexport type IcuMessage = string;\n\n/**\n * A content type representing I18next messages.\n */\nexport type I18nextMessage = string;\n\n/**\n * A content type representing plain strings.\n */\nexport type StringMessage = string;\n"],"mappings":";;;;AAKA,MAAa,qBAAqB;CAChC,IAAI;CACJ,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN"}
|