generaltranslation 8.0.1-alpha.1 โ 8.0.1
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 +6 -0
- package/dist/id/hashSource.d.ts +1 -2
- package/dist/id.cjs.min.cjs.map +1 -1
- package/dist/id.esm.min.mjs.map +1 -1
- package/dist/index.cjs.min.cjs +18 -1
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.d.ts +43 -2
- package/dist/index.esm.min.mjs +18 -1
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/types-dir/api/entry.d.ts +1 -2
- package/dist/types-dir/api/file.d.ts +1 -1
- package/dist/types.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { DataFormat as DataFormat$1 } from 'src/types';
|
|
2
|
+
|
|
1
3
|
type CustomMapping = Record<string, string | Partial<LocaleProperties>>;
|
|
2
4
|
|
|
3
5
|
type LocaleProperties = {
|
|
@@ -167,7 +169,7 @@ type FileReference = {
|
|
|
167
169
|
branchId: string;
|
|
168
170
|
fileName: string;
|
|
169
171
|
fileFormat: FileFormat;
|
|
170
|
-
dataFormat?: DataFormat;
|
|
172
|
+
dataFormat?: DataFormat$1;
|
|
171
173
|
};
|
|
172
174
|
|
|
173
175
|
type DownloadFileBatchRequest = {
|
|
@@ -1236,6 +1238,45 @@ declare function getLocaleEmoji(locale: string, customMapping?: CustomMapping):
|
|
|
1236
1238
|
* @property {string} emoji - The emoji associated with the locale's region, if applicable.
|
|
1237
1239
|
*/
|
|
1238
1240
|
declare function getLocaleProperties(locale: string, defaultLocale?: string, customMapping?: CustomMapping): LocaleProperties;
|
|
1241
|
+
/**
|
|
1242
|
+
* Retrieves multiple properties for a given region code, including:
|
|
1243
|
+
* - `code`: the original region code
|
|
1244
|
+
* - `name`: the localized display name
|
|
1245
|
+
* - `emoji`: the associated flag or symbol
|
|
1246
|
+
*
|
|
1247
|
+
* Behavior:
|
|
1248
|
+
* - Accepts ISO 3166-1 alpha-2 or UN M.49 region codes (e.g., `"US"`, `"FR"`, `"419"`).
|
|
1249
|
+
* - If `customMapping` contains a `name` or `emoji` for the region, those override the default values.
|
|
1250
|
+
* - Otherwise, uses `Intl.DisplayNames` to get the localized region name in the given `defaultLocale`,
|
|
1251
|
+
* falling back to `libraryDefaultLocale`.
|
|
1252
|
+
* - Falls back to the region code as `name` if display name resolution fails.
|
|
1253
|
+
* - Falls back to `defaultEmoji` if no emoji mapping is found in `emojis` or `customMapping`.
|
|
1254
|
+
*
|
|
1255
|
+
* @param {string} region - The region code to look up (e.g., `"US"`, `"GB"`, `"DE"`).
|
|
1256
|
+
* @param {string} [defaultLocale=libraryDefaultLocale] - The locale to use when localizing the region name.
|
|
1257
|
+
* @param {CustomRegionMapping} [customMapping] - Optional mapping of region codes to custom names and/or emojis.
|
|
1258
|
+
* @returns {{ code: string, name: string, emoji: string }} An object containing:
|
|
1259
|
+
* - `code`: the input region code
|
|
1260
|
+
* - `name`: the localized or custom region name
|
|
1261
|
+
* - `emoji`: the matching emoji flag or symbol
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* getRegionProperties('US', 'en');
|
|
1265
|
+
* // => { code: 'US', name: 'United States', emoji: '๐บ๐ธ' }
|
|
1266
|
+
*
|
|
1267
|
+
* @example
|
|
1268
|
+
* getRegionProperties('US', 'fr');
|
|
1269
|
+
* // => { code: 'US', name: 'รtats-Unis', emoji: '๐บ๐ธ' }
|
|
1270
|
+
*
|
|
1271
|
+
* @example
|
|
1272
|
+
* getRegionProperties('US', 'en', { US: { name: 'USA', emoji: '๐ฝ' } });
|
|
1273
|
+
* // => { code: 'US', name: 'USA', emoji: '๐ฝ' }
|
|
1274
|
+
*/
|
|
1275
|
+
declare function getRegionProperties(region: string, defaultLocale?: string, customMapping?: CustomRegionMapping): {
|
|
1276
|
+
code: string;
|
|
1277
|
+
name: string;
|
|
1278
|
+
emoji: string;
|
|
1279
|
+
};
|
|
1239
1280
|
/**
|
|
1240
1281
|
* Determines whether a translation is required based on the source and target locales.
|
|
1241
1282
|
*
|
|
@@ -1307,4 +1348,4 @@ declare function isSameLanguage(...locales: (string | string[])[]): boolean;
|
|
|
1307
1348
|
*/
|
|
1308
1349
|
declare function isSupersetLocale(superLocale: string, subLocale: string): boolean;
|
|
1309
1350
|
|
|
1310
|
-
export { GT, determineLocale, formatCurrency, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, requiresTranslation, resolveAliasLocale, standardizeLocale };
|
|
1351
|
+
export { GT, determineLocale, formatCurrency, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, getRegionProperties, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, requiresTranslation, resolveAliasLocale, standardizeLocale };
|