@terai/translator 0.0.17 → 0.0.18
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/dist/index-7t-AdJLS.d.cts +72 -0
- package/dist/index-7t-AdJLS.d.cts.map +1 -0
- package/dist/index-7t-AdJLS.d.mts +72 -0
- package/dist/index-7t-AdJLS.d.mts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +18 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/translators/index.d.cts +1 -1
- package/dist/translators/index.d.mts +1 -1
- package/package.json +4 -4
- package/dist/index-DTSqS4fv.d.cts +0 -63
- package/dist/index-DTSqS4fv.d.cts.map +0 -1
- package/dist/index-DTSqS4fv.d.mts +0 -63
- package/dist/index-DTSqS4fv.d.mts.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region ../types/dist/index.d.mts
|
|
2
|
+
//#region src/locale.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* BCP 47 Locale Identifiers
|
|
5
|
+
*
|
|
6
|
+
* Every locale in Unicode CLDR v48.2.0, plus the language-region form
|
|
7
|
+
* of locales CLDR spells with a script (e.g. 'zh-CN' for 'zh-Hans-CN').
|
|
8
|
+
* Format follows BCP 47 standard using hyphens (e.g., 'en-US', 'zh-Hans-CN').
|
|
9
|
+
*
|
|
10
|
+
* Generated by scripts/generate-locales.mjs. Do not edit by hand.
|
|
11
|
+
*
|
|
12
|
+
* Structure:
|
|
13
|
+
* - language: ISO 639-1/639-3 language code (e.g., 'en', 'zh')
|
|
14
|
+
* - script: ISO 15924 script code (e.g., 'Hans', 'Latn')
|
|
15
|
+
* - region: ISO 3166-1 alpha-2 country code or UN M.49 region code (e.g., 'US', '419')
|
|
16
|
+
* - variant: Registered variant subtags (e.g., 'valencia', 'tarask')
|
|
17
|
+
*
|
|
18
|
+
* @see https://cldr.unicode.org/
|
|
19
|
+
* @see https://www.ietf.org/rfc/bcp/bcp47.txt
|
|
20
|
+
* @see https://www.iana.org/assignments/language-subtag-registry
|
|
21
|
+
*/
|
|
22
|
+
type Locale = 'aa' | 'aa-DJ' | 'aa-ER' | 'aa-ET' | 'ab' | 'ab-GE' | 'af' | 'af-NA' | 'af-ZA' | 'agq' | 'agq-CM' | 'ak' | 'ak-GH' | 'am' | 'am-ET' | 'an' | 'an-ES' | 'ann' | 'ann-NG' | 'apc' | 'apc-SY' | 'ar' | 'ar-001' | 'ar-AE' | 'ar-BH' | 'ar-DJ' | 'ar-DZ' | 'ar-EG' | 'ar-EH' | 'ar-ER' | 'ar-IL' | 'ar-IQ' | 'ar-JO' | 'ar-KM' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'ar-MR' | 'ar-OM' | 'ar-PS' | 'ar-QA' | 'ar-SA' | 'ar-SD' | 'ar-SO' | 'ar-SS' | 'ar-SY' | 'ar-TD' | 'ar-TN' | 'ar-YE' | 'arn' | 'arn-CL' | 'as' | 'as-IN' | 'asa' | 'asa-TZ' | 'ast' | 'ast-ES' | 'az' | 'az-AZ' | 'az-Arab' | 'az-Arab-IQ' | 'az-Arab-IR' | 'az-Arab-TR' | 'az-Cyrl' | 'az-Cyrl-AZ' | 'az-IQ' | 'az-IR' | 'az-Latn' | 'az-Latn-AZ' | 'ba' | 'ba-RU' | 'bal' | 'bal-Arab' | 'bal-Arab-PK' | 'bal-Latn' | 'bal-Latn-PK' | 'bal-PK' | 'bas' | 'bas-CM' | 'be' | 'be-BY' | 'be-tarask' | 'bem' | 'bem-ZM' | 'bew' | 'bew-ID' | 'bez' | 'bez-TZ' | 'bg' | 'bg-BG' | 'bgc' | 'bgc-IN' | 'bgn' | 'bgn-AE' | 'bgn-AF' | 'bgn-IR' | 'bgn-OM' | 'bgn-PK' | 'bho' | 'bho-IN' | 'blo' | 'blo-BJ' | 'blt' | 'blt-VN' | 'bm' | 'bm-ML' | 'bm-Nkoo' | 'bm-Nkoo-ML' | 'bn' | 'bn-BD' | 'bn-IN' | 'bo' | 'bo-CN' | 'bo-IN' | 'bqi' | 'bqi-IR' | 'br' | 'br-FR' | 'brx' | 'brx-IN' | 'bs' | 'bs-BA' | 'bs-Cyrl' | 'bs-Cyrl-BA' | 'bs-Latn' | 'bs-Latn-BA' | 'bss' | 'bss-CM' | 'bua' | 'bua-RU' | 'byn' | 'byn-ER' | 'ca' | 'ca-AD' | 'ca-ES' | 'ca-ES-valencia' | 'ca-FR' | 'ca-IT' | 'cad' | 'cad-US' | 'cch' | 'cch-NG' | 'ccp' | 'ccp-BD' | 'ccp-IN' | 'ce' | 'ce-RU' | 'ceb' | 'ceb-PH' | 'cgg' | 'cgg-UG' | 'cho' | 'cho-US' | 'chr' | 'chr-US' | 'cic' | 'cic-US' | 'ckb' | 'ckb-IQ' | 'ckb-IR' | 'co' | 'co-FR' | 'cop' | 'cop-EG' | 'cs' | 'cs-CZ' | 'csw' | 'csw-CA' | 'cu' | 'cu-RU' | 'cv' | 'cv-RU' | 'cy' | 'cy-GB' | 'da' | 'da-DK' | 'da-GL' | 'dav' | 'dav-KE' | 'de' | 'de-AT' | 'de-BE' | 'de-CH' | 'de-DE' | 'de-IT' | 'de-LI' | 'de-LU' | 'dje' | 'dje-NE' | 'doi' | 'doi-IN' | 'dsb' | 'dsb-DE' | 'dua' | 'dua-CM' | 'dv' | 'dv-MV' | 'dyo' | 'dyo-SN' | 'dz' | 'dz-BT' | 'ebu' | 'ebu-KE' | 'ee' | 'ee-GH' | 'ee-TG' | 'el' | 'el-CY' | 'el-GR' | 'el-polyton' | 'en' | 'en-001' | 'en-150' | 'en-AE' | 'en-AG' | 'en-AI' | 'en-AS' | 'en-AT' | 'en-AU' | 'en-BB' | 'en-BE' | 'en-BI' | 'en-BM' | 'en-BS' | 'en-BW' | 'en-BZ' | 'en-CA' | 'en-CC' | 'en-CH' | 'en-CK' | 'en-CM' | 'en-CX' | 'en-CY' | 'en-CZ' | 'en-DE' | 'en-DG' | 'en-DK' | 'en-DM' | 'en-Dsrt' | 'en-Dsrt-US' | 'en-EE' | 'en-ER' | 'en-ES' | 'en-FI' | 'en-FJ' | 'en-FK' | 'en-FM' | 'en-FR' | 'en-GB' | 'en-GD' | 'en-GE' | 'en-GG' | 'en-GH' | 'en-GI' | 'en-GM' | 'en-GS' | 'en-GU' | 'en-GY' | 'en-HK' | 'en-HU' | 'en-ID' | 'en-IE' | 'en-IL' | 'en-IM' | 'en-IN' | 'en-IO' | 'en-IT' | 'en-JE' | 'en-JM' | 'en-JP' | 'en-KE' | 'en-KI' | 'en-KN' | 'en-KY' | 'en-LC' | 'en-LR' | 'en-LS' | 'en-LT' | 'en-LV' | 'en-MG' | 'en-MH' | 'en-MO' | 'en-MP' | 'en-MS' | 'en-MT' | 'en-MU' | 'en-MV' | 'en-MW' | 'en-MY' | 'en-NA' | 'en-NF' | 'en-NG' | 'en-NL' | 'en-NO' | 'en-NR' | 'en-NU' | 'en-NZ' | 'en-PG' | 'en-PH' | 'en-PK' | 'en-PL' | 'en-PN' | 'en-PR' | 'en-PT' | 'en-PW' | 'en-RO' | 'en-RW' | 'en-SB' | 'en-SC' | 'en-SD' | 'en-SE' | 'en-SG' | 'en-SH' | 'en-SI' | 'en-SK' | 'en-SL' | 'en-SS' | 'en-SX' | 'en-SZ' | 'en-Shaw' | 'en-Shaw-GB' | 'en-TC' | 'en-TK' | 'en-TO' | 'en-TT' | 'en-TV' | 'en-TZ' | 'en-UA' | 'en-UG' | 'en-UM' | 'en-US' | 'en-VC' | 'en-VG' | 'en-VI' | 'en-VU' | 'en-WS' | 'en-ZA' | 'en-ZM' | 'en-ZW' | 'eo' | 'eo-001' | 'es' | 'es-419' | 'es-AR' | 'es-BO' | 'es-BR' | 'es-BZ' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-CU' | 'es-DO' | 'es-EA' | 'es-EC' | 'es-ES' | 'es-GQ' | 'es-GT' | 'es-HN' | 'es-IC' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PE' | 'es-PH' | 'es-PR' | 'es-PY' | 'es-SV' | 'es-US' | 'es-UY' | 'es-VE' | 'et' | 'et-EE' | 'eu' | 'eu-ES' | 'ewo' | 'ewo-CM' | 'fa' | 'fa-AF' | 'fa-IR' | 'ff' | 'ff-Adlm' | 'ff-Adlm-BF' | 'ff-Adlm-CM' | 'ff-Adlm-GH' | 'ff-Adlm-GM' | 'ff-Adlm-GN' | 'ff-Adlm-GW' | 'ff-Adlm-LR' | 'ff-Adlm-MR' | 'ff-Adlm-NE' | 'ff-Adlm-NG' | 'ff-Adlm-SL' | 'ff-Adlm-SN' | 'ff-BF' | 'ff-CM' | 'ff-GH' | 'ff-GM' | 'ff-GN' | 'ff-GW' | 'ff-LR' | 'ff-Latn' | 'ff-Latn-BF' | 'ff-Latn-CM' | 'ff-Latn-GH' | 'ff-Latn-GM' | 'ff-Latn-GN' | 'ff-Latn-GW' | 'ff-Latn-LR' | 'ff-Latn-MR' | 'ff-Latn-NE' | 'ff-Latn-NG' | 'ff-Latn-SL' | 'ff-Latn-SN' | 'ff-MR' | 'ff-NE' | 'ff-NG' | 'ff-SL' | 'ff-SN' | 'fi' | 'fi-FI' | 'fil' | 'fil-PH' | 'fo' | 'fo-DK' | 'fo-FO' | 'fr' | 'fr-BE' | 'fr-BF' | 'fr-BI' | 'fr-BJ' | 'fr-BL' | 'fr-CA' | 'fr-CD' | 'fr-CF' | 'fr-CG' | 'fr-CH' | 'fr-CI' | 'fr-CM' | 'fr-DJ' | 'fr-DZ' | 'fr-FR' | 'fr-GA' | 'fr-GF' | 'fr-GN' | 'fr-GP' | 'fr-GQ' | 'fr-HT' | 'fr-KM' | 'fr-LU' | 'fr-MA' | 'fr-MC' | 'fr-MF' | 'fr-MG' | 'fr-ML' | 'fr-MQ' | 'fr-MR' | 'fr-MU' | 'fr-NC' | 'fr-NE' | 'fr-PF' | 'fr-PM' | 'fr-RE' | 'fr-RW' | 'fr-SC' | 'fr-SN' | 'fr-SY' | 'fr-TD' | 'fr-TG' | 'fr-TN' | 'fr-VU' | 'fr-WF' | 'fr-YT' | 'frr' | 'frr-DE' | 'fur' | 'fur-IT' | 'fy' | 'fy-NL' | 'ga' | 'ga-GB' | 'ga-IE' | 'gaa' | 'gaa-GH' | 'gd' | 'gd-GB' | 'gez' | 'gez-ER' | 'gez-ET' | 'gl' | 'gl-ES' | 'gn' | 'gn-PY' | 'gsw' | 'gsw-CH' | 'gsw-FR' | 'gsw-LI' | 'gu' | 'gu-IN' | 'guz' | 'guz-KE' | 'gv' | 'gv-IM' | 'ha' | 'ha-Arab' | 'ha-Arab-NG' | 'ha-Arab-SD' | 'ha-GH' | 'ha-NE' | 'ha-NG' | 'ha-SD' | 'haw' | 'haw-US' | 'he' | 'he-IL' | 'hi' | 'hi-IN' | 'hi-Latn' | 'hi-Latn-IN' | 'hnj' | 'hnj-Hmnp' | 'hnj-Hmnp-US' | 'hnj-US' | 'hr' | 'hr-BA' | 'hr-HR' | 'hsb' | 'hsb-DE' | 'ht' | 'ht-HT' | 'hu' | 'hu-HU' | 'hy' | 'hy-AM' | 'ia' | 'ia-001' | 'id' | 'id-ID' | 'ie' | 'ie-EE' | 'ig' | 'ig-NG' | 'ii' | 'ii-CN' | 'io' | 'io-001' | 'is' | 'is-IS' | 'it' | 'it-CH' | 'it-IT' | 'it-SM' | 'it-VA' | 'iu' | 'iu-CA' | 'iu-Latn' | 'iu-Latn-CA' | 'ja' | 'ja-JP' | 'jbo' | 'jbo-001' | 'jgo' | 'jgo-CM' | 'jmc' | 'jmc-TZ' | 'jv' | 'jv-ID' | 'ka' | 'ka-GE' | 'kaa' | 'kaa-Cyrl' | 'kaa-Cyrl-UZ' | 'kaa-Latn' | 'kaa-Latn-UZ' | 'kaa-UZ' | 'kab' | 'kab-DZ' | 'kaj' | 'kaj-NG' | 'kam' | 'kam-KE' | 'kcg' | 'kcg-NG' | 'kde' | 'kde-TZ' | 'kea' | 'kea-CV' | 'kek' | 'kek-GT' | 'ken' | 'ken-CM' | 'kgp' | 'kgp-BR' | 'khq' | 'khq-ML' | 'ki' | 'ki-KE' | 'kk' | 'kk-Arab' | 'kk-Arab-CN' | 'kk-CN' | 'kk-Cyrl' | 'kk-Cyrl-KZ' | 'kk-KZ' | 'kkj' | 'kkj-CM' | 'kl' | 'kl-GL' | 'kln' | 'kln-KE' | 'km' | 'km-KH' | 'kn' | 'kn-IN' | 'ko' | 'ko-CN' | 'ko-KP' | 'ko-KR' | 'kok' | 'kok-Deva' | 'kok-Deva-IN' | 'kok-IN' | 'kok-Latn' | 'kok-Latn-IN' | 'kpe' | 'kpe-GN' | 'kpe-LR' | 'ks' | 'ks-Arab' | 'ks-Arab-IN' | 'ks-Deva' | 'ks-Deva-IN' | 'ks-IN' | 'ksb' | 'ksb-TZ' | 'ksf' | 'ksf-CM' | 'ksh' | 'ksh-DE' | 'ku' | 'ku-Arab' | 'ku-Arab-IQ' | 'ku-Arab-IR' | 'ku-IQ' | 'ku-IR' | 'ku-Latn' | 'ku-Latn-IQ' | 'ku-Latn-SY' | 'ku-Latn-TR' | 'ku-SY' | 'ku-TR' | 'kw' | 'kw-GB' | 'kxv' | 'kxv-Deva' | 'kxv-Deva-IN' | 'kxv-IN' | 'kxv-Latn' | 'kxv-Latn-IN' | 'kxv-Orya' | 'kxv-Orya-IN' | 'kxv-Telu' | 'kxv-Telu-IN' | 'ky' | 'ky-KG' | 'la' | 'la-VA' | 'lag' | 'lag-TZ' | 'lb' | 'lb-LU' | 'lg' | 'lg-UG' | 'lij' | 'lij-IT' | 'lkt' | 'lkt-US' | 'lld' | 'lld-IT' | 'lmo' | 'lmo-IT' | 'ln' | 'ln-AO' | 'ln-CD' | 'ln-CF' | 'ln-CG' | 'lo' | 'lo-LA' | 'lrc' | 'lrc-IQ' | 'lrc-IR' | 'lt' | 'lt-LT' | 'ltg' | 'ltg-LV' | 'lu' | 'lu-CD' | 'luo' | 'luo-KE' | 'luy' | 'luy-KE' | 'lv' | 'lv-LV' | 'lzz' | 'lzz-TR' | 'mai' | 'mai-IN' | 'mas' | 'mas-KE' | 'mas-TZ' | 'mdf' | 'mdf-RU' | 'mer' | 'mer-KE' | 'mfe' | 'mfe-MU' | 'mg' | 'mg-MG' | 'mgh' | 'mgh-MZ' | 'mgo' | 'mgo-CM' | 'mhn' | 'mhn-IT' | 'mi' | 'mi-NZ' | 'mic' | 'mic-CA' | 'mk' | 'mk-MK' | 'ml' | 'ml-IN' | 'mn' | 'mn-CN' | 'mn-MN' | 'mn-Mong' | 'mn-Mong-CN' | 'mn-Mong-MN' | 'mni' | 'mni-Beng' | 'mni-Beng-IN' | 'mni-IN' | 'mni-Mtei' | 'mni-Mtei-IN' | 'moh' | 'moh-CA' | 'mr' | 'mr-IN' | 'ms' | 'ms-Arab' | 'ms-Arab-BN' | 'ms-Arab-MY' | 'ms-BN' | 'ms-ID' | 'ms-MY' | 'ms-SG' | 'mt' | 'mt-MT' | 'mua' | 'mua-CM' | 'mus' | 'mus-US' | 'mww' | 'mww-Hmnp' | 'mww-Hmnp-US' | 'mww-US' | 'my' | 'my-MM' | 'myv' | 'myv-RU' | 'mzn' | 'mzn-IR' | 'naq' | 'naq-NA' | 'nb' | 'nb-NO' | 'nb-SJ' | 'nd' | 'nd-ZW' | 'nds' | 'nds-DE' | 'nds-NL' | 'ne' | 'ne-IN' | 'ne-NP' | 'nl' | 'nl-AW' | 'nl-BE' | 'nl-BQ' | 'nl-CW' | 'nl-NL' | 'nl-SR' | 'nl-SX' | 'nmg' | 'nmg-CM' | 'nn' | 'nn-NO' | 'nnh' | 'nnh-CM' | 'no' | 'no-NO' | 'nqo' | 'nqo-GN' | 'nr' | 'nr-ZA' | 'nso' | 'nso-ZA' | 'nus' | 'nus-SS' | 'nv' | 'nv-US' | 'ny' | 'ny-MW' | 'nyn' | 'nyn-UG' | 'oc' | 'oc-ES' | 'oc-FR' | 'oka' | 'oka-CA' | 'oka-US' | 'om' | 'om-ET' | 'om-KE' | 'or' | 'or-IN' | 'os' | 'os-GE' | 'os-RU' | 'osa' | 'osa-US' | 'pa' | 'pa-Arab' | 'pa-Arab-PK' | 'pa-Guru' | 'pa-Guru-IN' | 'pa-IN' | 'pa-PK' | 'pap' | 'pap-AW' | 'pap-CW' | 'pcm' | 'pcm-NG' | 'pi' | 'pi-GB' | 'pi-Latn' | 'pi-Latn-GB' | 'pis' | 'pis-SB' | 'pl' | 'pl-PL' | 'pms' | 'pms-IT' | 'prg' | 'prg-PL' | 'ps' | 'ps-AF' | 'ps-PK' | 'pt' | 'pt-AO' | 'pt-BR' | 'pt-CH' | 'pt-CV' | 'pt-GQ' | 'pt-GW' | 'pt-LU' | 'pt-MO' | 'pt-MZ' | 'pt-PT' | 'pt-ST' | 'pt-TL' | 'qu' | 'qu-BO' | 'qu-EC' | 'qu-PE' | 'quc' | 'quc-GT' | 'raj' | 'raj-IN' | 'rhg' | 'rhg-BD' | 'rhg-MM' | 'rhg-Rohg' | 'rhg-Rohg-BD' | 'rhg-Rohg-MM' | 'rif' | 'rif-MA' | 'rm' | 'rm-CH' | 'rn' | 'rn-BI' | 'ro' | 'ro-MD' | 'ro-RO' | 'rof' | 'rof-TZ' | 'ru' | 'ru-BY' | 'ru-KG' | 'ru-KZ' | 'ru-MD' | 'ru-RU' | 'ru-UA' | 'rw' | 'rw-RW' | 'rwk' | 'rwk-TZ' | 'sa' | 'sa-IN' | 'sah' | 'sah-RU' | 'saq' | 'saq-KE' | 'sat' | 'sat-Deva' | 'sat-Deva-IN' | 'sat-IN' | 'sat-Olck' | 'sat-Olck-IN' | 'sbp' | 'sbp-TZ' | 'sc' | 'sc-IT' | 'scn' | 'scn-IT' | 'sd' | 'sd-Arab' | 'sd-Arab-PK' | 'sd-Deva' | 'sd-Deva-IN' | 'sd-IN' | 'sd-PK' | 'sdh' | 'sdh-IQ' | 'sdh-IR' | 'se' | 'se-FI' | 'se-NO' | 'se-SE' | 'seh' | 'seh-MZ' | 'ses' | 'ses-ML' | 'sg' | 'sg-CF' | 'sgs' | 'sgs-LT' | 'shi' | 'shi-Latn' | 'shi-Latn-MA' | 'shi-MA' | 'shi-Tfng' | 'shi-Tfng-MA' | 'shn' | 'shn-MM' | 'shn-TH' | 'si' | 'si-LK' | 'sid' | 'sid-ET' | 'sk' | 'sk-SK' | 'skr' | 'skr-PK' | 'sl' | 'sl-SI' | 'sma' | 'sma-NO' | 'sma-SE' | 'smj' | 'smj-NO' | 'smj-SE' | 'smn' | 'smn-FI' | 'sms' | 'sms-FI' | 'sn' | 'sn-ZW' | 'so' | 'so-DJ' | 'so-ET' | 'so-KE' | 'so-SO' | 'sq' | 'sq-AL' | 'sq-MK' | 'sq-XK' | 'sr' | 'sr-BA' | 'sr-Cyrl' | 'sr-Cyrl-BA' | 'sr-Cyrl-ME' | 'sr-Cyrl-RS' | 'sr-Cyrl-XK' | 'sr-Latn' | 'sr-Latn-BA' | 'sr-Latn-ME' | 'sr-Latn-RS' | 'sr-Latn-XK' | 'sr-ME' | 'sr-RS' | 'sr-XK' | 'ss' | 'ss-SZ' | 'ss-ZA' | 'ssy' | 'ssy-ER' | 'st' | 'st-LS' | 'st-ZA' | 'su' | 'su-ID' | 'su-Latn' | 'su-Latn-ID' | 'suz' | 'suz-Deva' | 'suz-Deva-NP' | 'suz-NP' | 'suz-Sunu' | 'suz-Sunu-NP' | 'sv' | 'sv-AX' | 'sv-FI' | 'sv-SE' | 'sw' | 'sw-CD' | 'sw-KE' | 'sw-TZ' | 'sw-UG' | 'syr' | 'syr-IQ' | 'syr-SY' | 'szl' | 'szl-PL' | 'ta' | 'ta-IN' | 'ta-LK' | 'ta-MY' | 'ta-SG' | 'te' | 'te-IN' | 'teo' | 'teo-KE' | 'teo-UG' | 'tg' | 'tg-TJ' | 'th' | 'th-TH' | 'ti' | 'ti-ER' | 'ti-ET' | 'tig' | 'tig-ER' | 'tk' | 'tk-TM' | 'tn' | 'tn-BW' | 'tn-ZA' | 'to' | 'to-TO' | 'tok' | 'tok-001' | 'tpi' | 'tpi-PG' | 'tr' | 'tr-CY' | 'tr-TR' | 'trv' | 'trv-TW' | 'trw' | 'trw-PK' | 'ts' | 'ts-ZA' | 'tt' | 'tt-RU' | 'twq' | 'twq-NE' | 'tyv' | 'tyv-RU' | 'tzm' | 'tzm-MA' | 'ug' | 'ug-CN' | 'uk' | 'uk-UA' | 'und' | 'ur' | 'ur-IN' | 'ur-PK' | 'uz' | 'uz-AF' | 'uz-Arab' | 'uz-Arab-AF' | 'uz-Cyrl' | 'uz-Cyrl-UZ' | 'uz-Latn' | 'uz-Latn-UZ' | 'uz-UZ' | 'vai' | 'vai-LR' | 'vai-Latn' | 'vai-Latn-LR' | 'vai-Vaii' | 'vai-Vaii-LR' | 've' | 've-ZA' | 'vec' | 'vec-IT' | 'vi' | 'vi-VN' | 'vmw' | 'vmw-MZ' | 'vo' | 'vo-001' | 'vun' | 'vun-TZ' | 'wa' | 'wa-BE' | 'wae' | 'wae-CH' | 'wal' | 'wal-ET' | 'wbp' | 'wbp-AU' | 'wo' | 'wo-SN' | 'xh' | 'xh-ZA' | 'xnr' | 'xnr-IN' | 'xog' | 'xog-UG' | 'yav' | 'yav-CM' | 'yi' | 'yi-UA' | 'yo' | 'yo-BJ' | 'yo-NG' | 'yrl' | 'yrl-BR' | 'yrl-CO' | 'yrl-VE' | 'yue' | 'yue-CN' | 'yue-HK' | 'yue-Hans' | 'yue-Hans-CN' | 'yue-Hant' | 'yue-Hant-CN' | 'yue-Hant-HK' | 'yue-Hant-MO' | 'yue-MO' | 'za' | 'za-CN' | 'zgh' | 'zgh-MA' | 'zh' | 'zh-CN' | 'zh-HK' | 'zh-Hans' | 'zh-Hans-CN' | 'zh-Hans-HK' | 'zh-Hans-MO' | 'zh-Hans-MY' | 'zh-Hans-SG' | 'zh-Hant' | 'zh-Hant-HK' | 'zh-Hant-MO' | 'zh-Hant-MY' | 'zh-Hant-TW' | 'zh-Latn' | 'zh-Latn-CN' | 'zh-MO' | 'zh-MY' | 'zh-SG' | 'zh-TW' | 'zu' | 'zu-ZA';
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/dictionary.d.ts
|
|
25
|
+
type Dictionary = Record<string, string>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/translator.d.ts
|
|
28
|
+
type Translator = ({ dictionary, locale, projectLocale }: {
|
|
29
|
+
dictionary: Dictionary;
|
|
30
|
+
locale: Locale;
|
|
31
|
+
projectLocale: Locale;
|
|
32
|
+
}) => Promise<Dictionary>;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/config.d.ts
|
|
35
|
+
/**
|
|
36
|
+
* Configuration for Terai
|
|
37
|
+
*/
|
|
38
|
+
type Config = {
|
|
39
|
+
/**
|
|
40
|
+
* List of files glob to to look for your locale declarations
|
|
41
|
+
*/
|
|
42
|
+
include: string[];
|
|
43
|
+
/**
|
|
44
|
+
* List of files glob to ignore
|
|
45
|
+
*/
|
|
46
|
+
exclude?: string[];
|
|
47
|
+
/**
|
|
48
|
+
* The output directory for your locale system
|
|
49
|
+
*/
|
|
50
|
+
outDir: string;
|
|
51
|
+
/**
|
|
52
|
+
* The base locale used in your project messages
|
|
53
|
+
*/
|
|
54
|
+
projectLocale: Locale;
|
|
55
|
+
/**
|
|
56
|
+
* The aditional locales you want to support
|
|
57
|
+
*/
|
|
58
|
+
outLocales: Locale[];
|
|
59
|
+
/**
|
|
60
|
+
* The translator for your messages
|
|
61
|
+
*/
|
|
62
|
+
translator: Translator;
|
|
63
|
+
/**
|
|
64
|
+
* Maximum number of messages sent to the translator in a single call.
|
|
65
|
+
* Batches run concurrently and are saved independently, so a failing batch
|
|
66
|
+
* does not discard the others. Defaults to sending every message at once.
|
|
67
|
+
*/
|
|
68
|
+
batchSize?: number;
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
export { Translator as i, Dictionary as n, Locale as r, Config as t };
|
|
72
|
+
//# sourceMappingURL=index-7t-AdJLS.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-7t-AdJLS.d.cts","names":[],"sources":["../../types/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;KAoBY;;;KAGA,aAAa;;;KAKb,gBAAgB,YAAY,QAAQ;EAC9C,YAAY;EACZ,QAAQ;EACR,eAAe;MACX,QAAQ;;;;;;KAMF;;;;EAIV;;;;EAIA;;;;EAIA;;;;EAIA,eAAe;;;;EAIf,YAAY;;;;EAIZ,YAAY;;;;;;EAMZ"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region ../types/dist/index.d.mts
|
|
2
|
+
//#region src/locale.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* BCP 47 Locale Identifiers
|
|
5
|
+
*
|
|
6
|
+
* Every locale in Unicode CLDR v48.2.0, plus the language-region form
|
|
7
|
+
* of locales CLDR spells with a script (e.g. 'zh-CN' for 'zh-Hans-CN').
|
|
8
|
+
* Format follows BCP 47 standard using hyphens (e.g., 'en-US', 'zh-Hans-CN').
|
|
9
|
+
*
|
|
10
|
+
* Generated by scripts/generate-locales.mjs. Do not edit by hand.
|
|
11
|
+
*
|
|
12
|
+
* Structure:
|
|
13
|
+
* - language: ISO 639-1/639-3 language code (e.g., 'en', 'zh')
|
|
14
|
+
* - script: ISO 15924 script code (e.g., 'Hans', 'Latn')
|
|
15
|
+
* - region: ISO 3166-1 alpha-2 country code or UN M.49 region code (e.g., 'US', '419')
|
|
16
|
+
* - variant: Registered variant subtags (e.g., 'valencia', 'tarask')
|
|
17
|
+
*
|
|
18
|
+
* @see https://cldr.unicode.org/
|
|
19
|
+
* @see https://www.ietf.org/rfc/bcp/bcp47.txt
|
|
20
|
+
* @see https://www.iana.org/assignments/language-subtag-registry
|
|
21
|
+
*/
|
|
22
|
+
type Locale = 'aa' | 'aa-DJ' | 'aa-ER' | 'aa-ET' | 'ab' | 'ab-GE' | 'af' | 'af-NA' | 'af-ZA' | 'agq' | 'agq-CM' | 'ak' | 'ak-GH' | 'am' | 'am-ET' | 'an' | 'an-ES' | 'ann' | 'ann-NG' | 'apc' | 'apc-SY' | 'ar' | 'ar-001' | 'ar-AE' | 'ar-BH' | 'ar-DJ' | 'ar-DZ' | 'ar-EG' | 'ar-EH' | 'ar-ER' | 'ar-IL' | 'ar-IQ' | 'ar-JO' | 'ar-KM' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'ar-MR' | 'ar-OM' | 'ar-PS' | 'ar-QA' | 'ar-SA' | 'ar-SD' | 'ar-SO' | 'ar-SS' | 'ar-SY' | 'ar-TD' | 'ar-TN' | 'ar-YE' | 'arn' | 'arn-CL' | 'as' | 'as-IN' | 'asa' | 'asa-TZ' | 'ast' | 'ast-ES' | 'az' | 'az-AZ' | 'az-Arab' | 'az-Arab-IQ' | 'az-Arab-IR' | 'az-Arab-TR' | 'az-Cyrl' | 'az-Cyrl-AZ' | 'az-IQ' | 'az-IR' | 'az-Latn' | 'az-Latn-AZ' | 'ba' | 'ba-RU' | 'bal' | 'bal-Arab' | 'bal-Arab-PK' | 'bal-Latn' | 'bal-Latn-PK' | 'bal-PK' | 'bas' | 'bas-CM' | 'be' | 'be-BY' | 'be-tarask' | 'bem' | 'bem-ZM' | 'bew' | 'bew-ID' | 'bez' | 'bez-TZ' | 'bg' | 'bg-BG' | 'bgc' | 'bgc-IN' | 'bgn' | 'bgn-AE' | 'bgn-AF' | 'bgn-IR' | 'bgn-OM' | 'bgn-PK' | 'bho' | 'bho-IN' | 'blo' | 'blo-BJ' | 'blt' | 'blt-VN' | 'bm' | 'bm-ML' | 'bm-Nkoo' | 'bm-Nkoo-ML' | 'bn' | 'bn-BD' | 'bn-IN' | 'bo' | 'bo-CN' | 'bo-IN' | 'bqi' | 'bqi-IR' | 'br' | 'br-FR' | 'brx' | 'brx-IN' | 'bs' | 'bs-BA' | 'bs-Cyrl' | 'bs-Cyrl-BA' | 'bs-Latn' | 'bs-Latn-BA' | 'bss' | 'bss-CM' | 'bua' | 'bua-RU' | 'byn' | 'byn-ER' | 'ca' | 'ca-AD' | 'ca-ES' | 'ca-ES-valencia' | 'ca-FR' | 'ca-IT' | 'cad' | 'cad-US' | 'cch' | 'cch-NG' | 'ccp' | 'ccp-BD' | 'ccp-IN' | 'ce' | 'ce-RU' | 'ceb' | 'ceb-PH' | 'cgg' | 'cgg-UG' | 'cho' | 'cho-US' | 'chr' | 'chr-US' | 'cic' | 'cic-US' | 'ckb' | 'ckb-IQ' | 'ckb-IR' | 'co' | 'co-FR' | 'cop' | 'cop-EG' | 'cs' | 'cs-CZ' | 'csw' | 'csw-CA' | 'cu' | 'cu-RU' | 'cv' | 'cv-RU' | 'cy' | 'cy-GB' | 'da' | 'da-DK' | 'da-GL' | 'dav' | 'dav-KE' | 'de' | 'de-AT' | 'de-BE' | 'de-CH' | 'de-DE' | 'de-IT' | 'de-LI' | 'de-LU' | 'dje' | 'dje-NE' | 'doi' | 'doi-IN' | 'dsb' | 'dsb-DE' | 'dua' | 'dua-CM' | 'dv' | 'dv-MV' | 'dyo' | 'dyo-SN' | 'dz' | 'dz-BT' | 'ebu' | 'ebu-KE' | 'ee' | 'ee-GH' | 'ee-TG' | 'el' | 'el-CY' | 'el-GR' | 'el-polyton' | 'en' | 'en-001' | 'en-150' | 'en-AE' | 'en-AG' | 'en-AI' | 'en-AS' | 'en-AT' | 'en-AU' | 'en-BB' | 'en-BE' | 'en-BI' | 'en-BM' | 'en-BS' | 'en-BW' | 'en-BZ' | 'en-CA' | 'en-CC' | 'en-CH' | 'en-CK' | 'en-CM' | 'en-CX' | 'en-CY' | 'en-CZ' | 'en-DE' | 'en-DG' | 'en-DK' | 'en-DM' | 'en-Dsrt' | 'en-Dsrt-US' | 'en-EE' | 'en-ER' | 'en-ES' | 'en-FI' | 'en-FJ' | 'en-FK' | 'en-FM' | 'en-FR' | 'en-GB' | 'en-GD' | 'en-GE' | 'en-GG' | 'en-GH' | 'en-GI' | 'en-GM' | 'en-GS' | 'en-GU' | 'en-GY' | 'en-HK' | 'en-HU' | 'en-ID' | 'en-IE' | 'en-IL' | 'en-IM' | 'en-IN' | 'en-IO' | 'en-IT' | 'en-JE' | 'en-JM' | 'en-JP' | 'en-KE' | 'en-KI' | 'en-KN' | 'en-KY' | 'en-LC' | 'en-LR' | 'en-LS' | 'en-LT' | 'en-LV' | 'en-MG' | 'en-MH' | 'en-MO' | 'en-MP' | 'en-MS' | 'en-MT' | 'en-MU' | 'en-MV' | 'en-MW' | 'en-MY' | 'en-NA' | 'en-NF' | 'en-NG' | 'en-NL' | 'en-NO' | 'en-NR' | 'en-NU' | 'en-NZ' | 'en-PG' | 'en-PH' | 'en-PK' | 'en-PL' | 'en-PN' | 'en-PR' | 'en-PT' | 'en-PW' | 'en-RO' | 'en-RW' | 'en-SB' | 'en-SC' | 'en-SD' | 'en-SE' | 'en-SG' | 'en-SH' | 'en-SI' | 'en-SK' | 'en-SL' | 'en-SS' | 'en-SX' | 'en-SZ' | 'en-Shaw' | 'en-Shaw-GB' | 'en-TC' | 'en-TK' | 'en-TO' | 'en-TT' | 'en-TV' | 'en-TZ' | 'en-UA' | 'en-UG' | 'en-UM' | 'en-US' | 'en-VC' | 'en-VG' | 'en-VI' | 'en-VU' | 'en-WS' | 'en-ZA' | 'en-ZM' | 'en-ZW' | 'eo' | 'eo-001' | 'es' | 'es-419' | 'es-AR' | 'es-BO' | 'es-BR' | 'es-BZ' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-CU' | 'es-DO' | 'es-EA' | 'es-EC' | 'es-ES' | 'es-GQ' | 'es-GT' | 'es-HN' | 'es-IC' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PE' | 'es-PH' | 'es-PR' | 'es-PY' | 'es-SV' | 'es-US' | 'es-UY' | 'es-VE' | 'et' | 'et-EE' | 'eu' | 'eu-ES' | 'ewo' | 'ewo-CM' | 'fa' | 'fa-AF' | 'fa-IR' | 'ff' | 'ff-Adlm' | 'ff-Adlm-BF' | 'ff-Adlm-CM' | 'ff-Adlm-GH' | 'ff-Adlm-GM' | 'ff-Adlm-GN' | 'ff-Adlm-GW' | 'ff-Adlm-LR' | 'ff-Adlm-MR' | 'ff-Adlm-NE' | 'ff-Adlm-NG' | 'ff-Adlm-SL' | 'ff-Adlm-SN' | 'ff-BF' | 'ff-CM' | 'ff-GH' | 'ff-GM' | 'ff-GN' | 'ff-GW' | 'ff-LR' | 'ff-Latn' | 'ff-Latn-BF' | 'ff-Latn-CM' | 'ff-Latn-GH' | 'ff-Latn-GM' | 'ff-Latn-GN' | 'ff-Latn-GW' | 'ff-Latn-LR' | 'ff-Latn-MR' | 'ff-Latn-NE' | 'ff-Latn-NG' | 'ff-Latn-SL' | 'ff-Latn-SN' | 'ff-MR' | 'ff-NE' | 'ff-NG' | 'ff-SL' | 'ff-SN' | 'fi' | 'fi-FI' | 'fil' | 'fil-PH' | 'fo' | 'fo-DK' | 'fo-FO' | 'fr' | 'fr-BE' | 'fr-BF' | 'fr-BI' | 'fr-BJ' | 'fr-BL' | 'fr-CA' | 'fr-CD' | 'fr-CF' | 'fr-CG' | 'fr-CH' | 'fr-CI' | 'fr-CM' | 'fr-DJ' | 'fr-DZ' | 'fr-FR' | 'fr-GA' | 'fr-GF' | 'fr-GN' | 'fr-GP' | 'fr-GQ' | 'fr-HT' | 'fr-KM' | 'fr-LU' | 'fr-MA' | 'fr-MC' | 'fr-MF' | 'fr-MG' | 'fr-ML' | 'fr-MQ' | 'fr-MR' | 'fr-MU' | 'fr-NC' | 'fr-NE' | 'fr-PF' | 'fr-PM' | 'fr-RE' | 'fr-RW' | 'fr-SC' | 'fr-SN' | 'fr-SY' | 'fr-TD' | 'fr-TG' | 'fr-TN' | 'fr-VU' | 'fr-WF' | 'fr-YT' | 'frr' | 'frr-DE' | 'fur' | 'fur-IT' | 'fy' | 'fy-NL' | 'ga' | 'ga-GB' | 'ga-IE' | 'gaa' | 'gaa-GH' | 'gd' | 'gd-GB' | 'gez' | 'gez-ER' | 'gez-ET' | 'gl' | 'gl-ES' | 'gn' | 'gn-PY' | 'gsw' | 'gsw-CH' | 'gsw-FR' | 'gsw-LI' | 'gu' | 'gu-IN' | 'guz' | 'guz-KE' | 'gv' | 'gv-IM' | 'ha' | 'ha-Arab' | 'ha-Arab-NG' | 'ha-Arab-SD' | 'ha-GH' | 'ha-NE' | 'ha-NG' | 'ha-SD' | 'haw' | 'haw-US' | 'he' | 'he-IL' | 'hi' | 'hi-IN' | 'hi-Latn' | 'hi-Latn-IN' | 'hnj' | 'hnj-Hmnp' | 'hnj-Hmnp-US' | 'hnj-US' | 'hr' | 'hr-BA' | 'hr-HR' | 'hsb' | 'hsb-DE' | 'ht' | 'ht-HT' | 'hu' | 'hu-HU' | 'hy' | 'hy-AM' | 'ia' | 'ia-001' | 'id' | 'id-ID' | 'ie' | 'ie-EE' | 'ig' | 'ig-NG' | 'ii' | 'ii-CN' | 'io' | 'io-001' | 'is' | 'is-IS' | 'it' | 'it-CH' | 'it-IT' | 'it-SM' | 'it-VA' | 'iu' | 'iu-CA' | 'iu-Latn' | 'iu-Latn-CA' | 'ja' | 'ja-JP' | 'jbo' | 'jbo-001' | 'jgo' | 'jgo-CM' | 'jmc' | 'jmc-TZ' | 'jv' | 'jv-ID' | 'ka' | 'ka-GE' | 'kaa' | 'kaa-Cyrl' | 'kaa-Cyrl-UZ' | 'kaa-Latn' | 'kaa-Latn-UZ' | 'kaa-UZ' | 'kab' | 'kab-DZ' | 'kaj' | 'kaj-NG' | 'kam' | 'kam-KE' | 'kcg' | 'kcg-NG' | 'kde' | 'kde-TZ' | 'kea' | 'kea-CV' | 'kek' | 'kek-GT' | 'ken' | 'ken-CM' | 'kgp' | 'kgp-BR' | 'khq' | 'khq-ML' | 'ki' | 'ki-KE' | 'kk' | 'kk-Arab' | 'kk-Arab-CN' | 'kk-CN' | 'kk-Cyrl' | 'kk-Cyrl-KZ' | 'kk-KZ' | 'kkj' | 'kkj-CM' | 'kl' | 'kl-GL' | 'kln' | 'kln-KE' | 'km' | 'km-KH' | 'kn' | 'kn-IN' | 'ko' | 'ko-CN' | 'ko-KP' | 'ko-KR' | 'kok' | 'kok-Deva' | 'kok-Deva-IN' | 'kok-IN' | 'kok-Latn' | 'kok-Latn-IN' | 'kpe' | 'kpe-GN' | 'kpe-LR' | 'ks' | 'ks-Arab' | 'ks-Arab-IN' | 'ks-Deva' | 'ks-Deva-IN' | 'ks-IN' | 'ksb' | 'ksb-TZ' | 'ksf' | 'ksf-CM' | 'ksh' | 'ksh-DE' | 'ku' | 'ku-Arab' | 'ku-Arab-IQ' | 'ku-Arab-IR' | 'ku-IQ' | 'ku-IR' | 'ku-Latn' | 'ku-Latn-IQ' | 'ku-Latn-SY' | 'ku-Latn-TR' | 'ku-SY' | 'ku-TR' | 'kw' | 'kw-GB' | 'kxv' | 'kxv-Deva' | 'kxv-Deva-IN' | 'kxv-IN' | 'kxv-Latn' | 'kxv-Latn-IN' | 'kxv-Orya' | 'kxv-Orya-IN' | 'kxv-Telu' | 'kxv-Telu-IN' | 'ky' | 'ky-KG' | 'la' | 'la-VA' | 'lag' | 'lag-TZ' | 'lb' | 'lb-LU' | 'lg' | 'lg-UG' | 'lij' | 'lij-IT' | 'lkt' | 'lkt-US' | 'lld' | 'lld-IT' | 'lmo' | 'lmo-IT' | 'ln' | 'ln-AO' | 'ln-CD' | 'ln-CF' | 'ln-CG' | 'lo' | 'lo-LA' | 'lrc' | 'lrc-IQ' | 'lrc-IR' | 'lt' | 'lt-LT' | 'ltg' | 'ltg-LV' | 'lu' | 'lu-CD' | 'luo' | 'luo-KE' | 'luy' | 'luy-KE' | 'lv' | 'lv-LV' | 'lzz' | 'lzz-TR' | 'mai' | 'mai-IN' | 'mas' | 'mas-KE' | 'mas-TZ' | 'mdf' | 'mdf-RU' | 'mer' | 'mer-KE' | 'mfe' | 'mfe-MU' | 'mg' | 'mg-MG' | 'mgh' | 'mgh-MZ' | 'mgo' | 'mgo-CM' | 'mhn' | 'mhn-IT' | 'mi' | 'mi-NZ' | 'mic' | 'mic-CA' | 'mk' | 'mk-MK' | 'ml' | 'ml-IN' | 'mn' | 'mn-CN' | 'mn-MN' | 'mn-Mong' | 'mn-Mong-CN' | 'mn-Mong-MN' | 'mni' | 'mni-Beng' | 'mni-Beng-IN' | 'mni-IN' | 'mni-Mtei' | 'mni-Mtei-IN' | 'moh' | 'moh-CA' | 'mr' | 'mr-IN' | 'ms' | 'ms-Arab' | 'ms-Arab-BN' | 'ms-Arab-MY' | 'ms-BN' | 'ms-ID' | 'ms-MY' | 'ms-SG' | 'mt' | 'mt-MT' | 'mua' | 'mua-CM' | 'mus' | 'mus-US' | 'mww' | 'mww-Hmnp' | 'mww-Hmnp-US' | 'mww-US' | 'my' | 'my-MM' | 'myv' | 'myv-RU' | 'mzn' | 'mzn-IR' | 'naq' | 'naq-NA' | 'nb' | 'nb-NO' | 'nb-SJ' | 'nd' | 'nd-ZW' | 'nds' | 'nds-DE' | 'nds-NL' | 'ne' | 'ne-IN' | 'ne-NP' | 'nl' | 'nl-AW' | 'nl-BE' | 'nl-BQ' | 'nl-CW' | 'nl-NL' | 'nl-SR' | 'nl-SX' | 'nmg' | 'nmg-CM' | 'nn' | 'nn-NO' | 'nnh' | 'nnh-CM' | 'no' | 'no-NO' | 'nqo' | 'nqo-GN' | 'nr' | 'nr-ZA' | 'nso' | 'nso-ZA' | 'nus' | 'nus-SS' | 'nv' | 'nv-US' | 'ny' | 'ny-MW' | 'nyn' | 'nyn-UG' | 'oc' | 'oc-ES' | 'oc-FR' | 'oka' | 'oka-CA' | 'oka-US' | 'om' | 'om-ET' | 'om-KE' | 'or' | 'or-IN' | 'os' | 'os-GE' | 'os-RU' | 'osa' | 'osa-US' | 'pa' | 'pa-Arab' | 'pa-Arab-PK' | 'pa-Guru' | 'pa-Guru-IN' | 'pa-IN' | 'pa-PK' | 'pap' | 'pap-AW' | 'pap-CW' | 'pcm' | 'pcm-NG' | 'pi' | 'pi-GB' | 'pi-Latn' | 'pi-Latn-GB' | 'pis' | 'pis-SB' | 'pl' | 'pl-PL' | 'pms' | 'pms-IT' | 'prg' | 'prg-PL' | 'ps' | 'ps-AF' | 'ps-PK' | 'pt' | 'pt-AO' | 'pt-BR' | 'pt-CH' | 'pt-CV' | 'pt-GQ' | 'pt-GW' | 'pt-LU' | 'pt-MO' | 'pt-MZ' | 'pt-PT' | 'pt-ST' | 'pt-TL' | 'qu' | 'qu-BO' | 'qu-EC' | 'qu-PE' | 'quc' | 'quc-GT' | 'raj' | 'raj-IN' | 'rhg' | 'rhg-BD' | 'rhg-MM' | 'rhg-Rohg' | 'rhg-Rohg-BD' | 'rhg-Rohg-MM' | 'rif' | 'rif-MA' | 'rm' | 'rm-CH' | 'rn' | 'rn-BI' | 'ro' | 'ro-MD' | 'ro-RO' | 'rof' | 'rof-TZ' | 'ru' | 'ru-BY' | 'ru-KG' | 'ru-KZ' | 'ru-MD' | 'ru-RU' | 'ru-UA' | 'rw' | 'rw-RW' | 'rwk' | 'rwk-TZ' | 'sa' | 'sa-IN' | 'sah' | 'sah-RU' | 'saq' | 'saq-KE' | 'sat' | 'sat-Deva' | 'sat-Deva-IN' | 'sat-IN' | 'sat-Olck' | 'sat-Olck-IN' | 'sbp' | 'sbp-TZ' | 'sc' | 'sc-IT' | 'scn' | 'scn-IT' | 'sd' | 'sd-Arab' | 'sd-Arab-PK' | 'sd-Deva' | 'sd-Deva-IN' | 'sd-IN' | 'sd-PK' | 'sdh' | 'sdh-IQ' | 'sdh-IR' | 'se' | 'se-FI' | 'se-NO' | 'se-SE' | 'seh' | 'seh-MZ' | 'ses' | 'ses-ML' | 'sg' | 'sg-CF' | 'sgs' | 'sgs-LT' | 'shi' | 'shi-Latn' | 'shi-Latn-MA' | 'shi-MA' | 'shi-Tfng' | 'shi-Tfng-MA' | 'shn' | 'shn-MM' | 'shn-TH' | 'si' | 'si-LK' | 'sid' | 'sid-ET' | 'sk' | 'sk-SK' | 'skr' | 'skr-PK' | 'sl' | 'sl-SI' | 'sma' | 'sma-NO' | 'sma-SE' | 'smj' | 'smj-NO' | 'smj-SE' | 'smn' | 'smn-FI' | 'sms' | 'sms-FI' | 'sn' | 'sn-ZW' | 'so' | 'so-DJ' | 'so-ET' | 'so-KE' | 'so-SO' | 'sq' | 'sq-AL' | 'sq-MK' | 'sq-XK' | 'sr' | 'sr-BA' | 'sr-Cyrl' | 'sr-Cyrl-BA' | 'sr-Cyrl-ME' | 'sr-Cyrl-RS' | 'sr-Cyrl-XK' | 'sr-Latn' | 'sr-Latn-BA' | 'sr-Latn-ME' | 'sr-Latn-RS' | 'sr-Latn-XK' | 'sr-ME' | 'sr-RS' | 'sr-XK' | 'ss' | 'ss-SZ' | 'ss-ZA' | 'ssy' | 'ssy-ER' | 'st' | 'st-LS' | 'st-ZA' | 'su' | 'su-ID' | 'su-Latn' | 'su-Latn-ID' | 'suz' | 'suz-Deva' | 'suz-Deva-NP' | 'suz-NP' | 'suz-Sunu' | 'suz-Sunu-NP' | 'sv' | 'sv-AX' | 'sv-FI' | 'sv-SE' | 'sw' | 'sw-CD' | 'sw-KE' | 'sw-TZ' | 'sw-UG' | 'syr' | 'syr-IQ' | 'syr-SY' | 'szl' | 'szl-PL' | 'ta' | 'ta-IN' | 'ta-LK' | 'ta-MY' | 'ta-SG' | 'te' | 'te-IN' | 'teo' | 'teo-KE' | 'teo-UG' | 'tg' | 'tg-TJ' | 'th' | 'th-TH' | 'ti' | 'ti-ER' | 'ti-ET' | 'tig' | 'tig-ER' | 'tk' | 'tk-TM' | 'tn' | 'tn-BW' | 'tn-ZA' | 'to' | 'to-TO' | 'tok' | 'tok-001' | 'tpi' | 'tpi-PG' | 'tr' | 'tr-CY' | 'tr-TR' | 'trv' | 'trv-TW' | 'trw' | 'trw-PK' | 'ts' | 'ts-ZA' | 'tt' | 'tt-RU' | 'twq' | 'twq-NE' | 'tyv' | 'tyv-RU' | 'tzm' | 'tzm-MA' | 'ug' | 'ug-CN' | 'uk' | 'uk-UA' | 'und' | 'ur' | 'ur-IN' | 'ur-PK' | 'uz' | 'uz-AF' | 'uz-Arab' | 'uz-Arab-AF' | 'uz-Cyrl' | 'uz-Cyrl-UZ' | 'uz-Latn' | 'uz-Latn-UZ' | 'uz-UZ' | 'vai' | 'vai-LR' | 'vai-Latn' | 'vai-Latn-LR' | 'vai-Vaii' | 'vai-Vaii-LR' | 've' | 've-ZA' | 'vec' | 'vec-IT' | 'vi' | 'vi-VN' | 'vmw' | 'vmw-MZ' | 'vo' | 'vo-001' | 'vun' | 'vun-TZ' | 'wa' | 'wa-BE' | 'wae' | 'wae-CH' | 'wal' | 'wal-ET' | 'wbp' | 'wbp-AU' | 'wo' | 'wo-SN' | 'xh' | 'xh-ZA' | 'xnr' | 'xnr-IN' | 'xog' | 'xog-UG' | 'yav' | 'yav-CM' | 'yi' | 'yi-UA' | 'yo' | 'yo-BJ' | 'yo-NG' | 'yrl' | 'yrl-BR' | 'yrl-CO' | 'yrl-VE' | 'yue' | 'yue-CN' | 'yue-HK' | 'yue-Hans' | 'yue-Hans-CN' | 'yue-Hant' | 'yue-Hant-CN' | 'yue-Hant-HK' | 'yue-Hant-MO' | 'yue-MO' | 'za' | 'za-CN' | 'zgh' | 'zgh-MA' | 'zh' | 'zh-CN' | 'zh-HK' | 'zh-Hans' | 'zh-Hans-CN' | 'zh-Hans-HK' | 'zh-Hans-MO' | 'zh-Hans-MY' | 'zh-Hans-SG' | 'zh-Hant' | 'zh-Hant-HK' | 'zh-Hant-MO' | 'zh-Hant-MY' | 'zh-Hant-TW' | 'zh-Latn' | 'zh-Latn-CN' | 'zh-MO' | 'zh-MY' | 'zh-SG' | 'zh-TW' | 'zu' | 'zu-ZA';
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/dictionary.d.ts
|
|
25
|
+
type Dictionary = Record<string, string>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/translator.d.ts
|
|
28
|
+
type Translator = ({ dictionary, locale, projectLocale }: {
|
|
29
|
+
dictionary: Dictionary;
|
|
30
|
+
locale: Locale;
|
|
31
|
+
projectLocale: Locale;
|
|
32
|
+
}) => Promise<Dictionary>;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/config.d.ts
|
|
35
|
+
/**
|
|
36
|
+
* Configuration for Terai
|
|
37
|
+
*/
|
|
38
|
+
type Config = {
|
|
39
|
+
/**
|
|
40
|
+
* List of files glob to to look for your locale declarations
|
|
41
|
+
*/
|
|
42
|
+
include: string[];
|
|
43
|
+
/**
|
|
44
|
+
* List of files glob to ignore
|
|
45
|
+
*/
|
|
46
|
+
exclude?: string[];
|
|
47
|
+
/**
|
|
48
|
+
* The output directory for your locale system
|
|
49
|
+
*/
|
|
50
|
+
outDir: string;
|
|
51
|
+
/**
|
|
52
|
+
* The base locale used in your project messages
|
|
53
|
+
*/
|
|
54
|
+
projectLocale: Locale;
|
|
55
|
+
/**
|
|
56
|
+
* The aditional locales you want to support
|
|
57
|
+
*/
|
|
58
|
+
outLocales: Locale[];
|
|
59
|
+
/**
|
|
60
|
+
* The translator for your messages
|
|
61
|
+
*/
|
|
62
|
+
translator: Translator;
|
|
63
|
+
/**
|
|
64
|
+
* Maximum number of messages sent to the translator in a single call.
|
|
65
|
+
* Batches run concurrently and are saved independently, so a failing batch
|
|
66
|
+
* does not discard the others. Defaults to sending every message at once.
|
|
67
|
+
*/
|
|
68
|
+
batchSize?: number;
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
export { Translator as i, Dictionary as n, Locale as r, Config as t };
|
|
72
|
+
//# sourceMappingURL=index-7t-AdJLS.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-7t-AdJLS.d.mts","names":[],"sources":["../../types/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;KAoBY;;;KAGA,aAAa;;;KAKb,gBAAgB,YAAY,QAAQ;EAC9C,YAAY;EACZ,QAAQ;EACR,eAAe;MACX,QAAQ;;;;;;KAMF;;;;EAIV;;;;EAIA;;;;EAIA;;;;EAIA,eAAe;;;;EAIf,YAAY;;;;EAIZ,YAAY;;;;;;EAMZ"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});async function e({dictionary:e,projectLocale:t,locale:n,translator:r}){return r({dictionary:e,projectLocale:t,locale:n})}exports.translate=e;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});async function e({dictionary:e,projectLocale:t,locale:n,translator:r}){return r({dictionary:e,projectLocale:t,locale:n})}async function t({dictionary:e,projectLocale:t,locale:n,translator:r,batchSize:i}){let a=Object.keys(e),o=i&&i>0?i:a.length,s=[];for(let e=0;e<a.length;e+=o)s.push(a.slice(e,e+o));let c=await Promise.allSettled(s.map(i=>r({dictionary:Object.fromEntries(i.map(t=>[t,e[t]])),projectLocale:t,locale:n}))),l={dictionary:{},missing:[],failed:[],errors:[]};return c.forEach((e,t)=>{let n=s[t];if(e.status===`rejected`)l.failed.push(...n),l.errors.push(e.reason);else for(let t of n){let n=e.value?.[t];typeof n==`string`&&n.trim()?l.dictionary[t]=n:l.missing.push(t)}}),l}exports.translate=e,exports.translateDictionary=t;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["translate","translator"],"sources":["../src/translate.ts"],"sourcesContent":["// Types\nimport type { Config, Locale, Dictionary } from '@terai/types'\n\nexport type TranslateOptions = Pick<Config, 'translator' | 'projectLocale'> & {\n\tdictionary: Dictionary\n\tlocale: Locale\n}\n\nexport async function translate({\n\tdictionary,\n\tprojectLocale,\n\tlocale,\n\ttranslator\n}: TranslateOptions): Promise<Dictionary> {\n\treturn translator({\n\t\tdictionary,\n\t\tprojectLocale,\n\t\tlocale\n\t})\n}\n"],"mappings":"A,mEAQA,eAAsBA,EAAU,CAC/B,aACA,gBACA,SACA,cACyC,CACzC,OAAOC,EAAW,CACjB,aACA,gBACA,QACD,CAAC,CACF,C"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["translate","translator","translateDictionary","ids","dictionary","size","batchSize","batches","i","results","batch","id","result","index","settled","value"],"sources":["../src/translate.ts","../src/translate-dictionary.ts"],"sourcesContent":["// Types\nimport type { Config, Locale, Dictionary } from '@terai/types'\n\nexport type TranslateOptions = Pick<Config, 'translator' | 'projectLocale'> & {\n\tdictionary: Dictionary\n\tlocale: Locale\n}\n\nexport async function translate({\n\tdictionary,\n\tprojectLocale,\n\tlocale,\n\ttranslator\n}: TranslateOptions): Promise<Dictionary> {\n\treturn translator({\n\t\tdictionary,\n\t\tprojectLocale,\n\t\tlocale\n\t})\n}\n","// Types\nimport type { Config, Locale, Dictionary } from '@terai/types'\n\nexport type TranslateDictionaryOptions = Pick<\n\tConfig,\n\t'translator' | 'projectLocale' | 'batchSize'\n> & {\n\tdictionary: Dictionary\n\tlocale: Locale\n}\n\nexport type TranslateDictionaryResult = {\n\t/** Valid translations, keyed by the requested message ids only */\n\tdictionary: Dictionary\n\t/** Ids the translator returned no usable translation for */\n\tmissing: string[]\n\t/** Ids whose batch rejected */\n\tfailed: string[]\n\t/** Rejection reasons of the failed batches */\n\terrors: unknown[]\n}\n\nexport async function translateDictionary({\n\tdictionary,\n\tprojectLocale,\n\tlocale,\n\ttranslator,\n\tbatchSize\n}: TranslateDictionaryOptions): Promise<TranslateDictionaryResult> {\n\tconst ids = Object.keys(dictionary)\n\tconst size = batchSize && batchSize > 0 ? batchSize : ids.length\n\tconst batches: string[][] = []\n\n\tfor (let i = 0; i < ids.length; i += size) {\n\t\tbatches.push(ids.slice(i, i + size))\n\t}\n\n\tconst results = await Promise.allSettled(\n\t\tbatches.map((batch) =>\n\t\t\ttranslator({\n\t\t\t\tdictionary: Object.fromEntries(batch.map((id) => [id, dictionary[id]])),\n\t\t\t\tprojectLocale,\n\t\t\t\tlocale\n\t\t\t})\n\t\t)\n\t)\n\n\tconst result: TranslateDictionaryResult = {\n\t\tdictionary: {},\n\t\tmissing: [],\n\t\tfailed: [],\n\t\terrors: []\n\t}\n\n\tresults.forEach((settled, index) => {\n\t\tconst batch = batches[index]\n\n\t\tif (settled.status === 'rejected') {\n\t\t\tresult.failed.push(...batch)\n\t\t\tresult.errors.push(settled.reason)\n\t\t\treturn\n\t\t}\n\n\t\t// Keep only the ids that were asked for: translators (LLMs in particular)\n\t\t// may rename, drop or invent keys.\n\t\tfor (const id of batch) {\n\t\t\tconst value = settled.value?.[id]\n\n\t\t\tif (typeof value === 'string' && value.trim()) {\n\t\t\t\tresult.dictionary[id] = value\n\t\t\t} else {\n\t\t\t\tresult.missing.push(id)\n\t\t\t}\n\t\t}\n\t})\n\n\treturn result\n}\n"],"mappings":"A,mEAQA,eAAsBA,EAAU,CAC/B,aACA,gBACA,SACA,cACyC,CACzC,OAAOC,EAAW,CACjB,aACA,gBACA,QACD,CAAC,CACF,CCGA,eAAsBC,EAAoB,CACzC,aACA,gBACA,SACA,aACA,aACkE,CAClE,IAAMC,EAAM,OAAO,KAAKC,CAAU,EAC5BC,EAAOC,GAAaA,EAAY,EAAIA,EAAYH,EAAI,OACpDI,EAAsB,CAAC,EAE7B,IAAK,IAAIC,EAAI,EAAGA,EAAIL,EAAI,OAAQ,GAAKE,EACpCE,EAAQ,KAAKJ,EAAI,MAAMK,EAAGA,EAAIH,CAAI,CAAC,EAGpC,IAAMI,EAAU,MAAM,QAAQ,WAC7BF,EAAQ,IAAK,GACZN,EAAW,CACV,WAAY,OAAO,YAAYS,EAAM,IAAK,GAAO,CAACC,EAAIP,EAAWO,EAAG,CAAC,CAAC,EACtE,gBACA,QACD,CAAC,CACF,CACD,EAEMC,EAAoC,CACzC,WAAY,CAAC,EACb,QAAS,CAAC,EACV,OAAQ,CAAC,EACT,OAAQ,CAAC,CACV,EAwBA,OAtBAH,EAAQ,SAAS,EAAS,IAAU,CACnC,IAAMC,EAAQH,EAAQM,GAEtB,GAAIC,EAAQ,SAAW,WACtBF,EAAO,OAAO,KAAK,GAAGF,CAAK,EAC3BE,EAAO,OAAO,KAAKE,EAAQ,MAAM,OAMlC,IAAK,IAAMH,KAAMD,EAAO,CACvB,IAAMK,EAAQD,EAAQ,QAAQH,GAE1B,OAAOI,GAAU,UAAYA,EAAM,KAAK,EAC3C,EAAO,WAAWJ,GAAMI,EAExBH,EAAO,QAAQ,KAAKD,CAAE,CAExB,CACD,CAAC,EAEMC,CACR,C"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Dictionary, r as Locale, t as Config } from "./index-
|
|
1
|
+
import { n as Dictionary, r as Locale, t as Config } from "./index-7t-AdJLS.cjs";
|
|
2
2
|
//#region src/translate.d.ts
|
|
3
3
|
export type TranslateOptions = Pick<Config, 'translator' | 'projectLocale'> & {
|
|
4
4
|
dictionary: Dictionary;
|
|
@@ -6,4 +6,21 @@ export type TranslateOptions = Pick<Config, 'translator' | 'projectLocale'> & {
|
|
|
6
6
|
};
|
|
7
7
|
export declare function translate({ dictionary, projectLocale, locale, translator }: TranslateOptions): Promise<Dictionary>;
|
|
8
8
|
//#endregion
|
|
9
|
+
//#region src/translate-dictionary.d.ts
|
|
10
|
+
export type TranslateDictionaryOptions = Pick<Config, 'translator' | 'projectLocale' | 'batchSize'> & {
|
|
11
|
+
dictionary: Dictionary;
|
|
12
|
+
locale: Locale;
|
|
13
|
+
};
|
|
14
|
+
export type TranslateDictionaryResult = {
|
|
15
|
+
/** Valid translations, keyed by the requested message ids only */
|
|
16
|
+
dictionary: Dictionary;
|
|
17
|
+
/** Ids the translator returned no usable translation for */
|
|
18
|
+
missing: string[];
|
|
19
|
+
/** Ids whose batch rejected */
|
|
20
|
+
failed: string[];
|
|
21
|
+
/** Rejection reasons of the failed batches */
|
|
22
|
+
errors: unknown[];
|
|
23
|
+
};
|
|
24
|
+
export declare function translateDictionary({ dictionary, projectLocale, locale, translator, batchSize }: TranslateDictionaryOptions): Promise<TranslateDictionaryResult>;
|
|
25
|
+
//#endregion
|
|
9
26
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/translate.ts"],"mappings":";;YAGY,mBAAmB,KAAK;EACnC,YAAY;EACZ,QAAQ;;wBAGa,YACrB,YACA,eACA,QACA,cACE,mBAAmB,QAAQ"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/translate.ts","../src/translate-dictionary.ts"],"mappings":";;YAGY,mBAAmB,KAAK;EACnC,YAAY;EACZ,QAAQ;;wBAGa,YACrB,YACA,eACA,QACA,cACE,mBAAmB,QAAQ;;;YCVlB,6BAA6B,KACxC;EAGA,YAAY;EACZ,QAAQ;;YAGG;;EAEX,YAAY;;EAEZ;;EAEA;;EAEA;;wBAGqB,sBACrB,YACA,eACA,QACA,YACA,aACE,6BAA6B,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Dictionary, r as Locale, t as Config } from "./index-
|
|
1
|
+
import { n as Dictionary, r as Locale, t as Config } from "./index-7t-AdJLS.mjs";
|
|
2
2
|
//#region src/translate.d.ts
|
|
3
3
|
export type TranslateOptions = Pick<Config, 'translator' | 'projectLocale'> & {
|
|
4
4
|
dictionary: Dictionary;
|
|
@@ -6,4 +6,21 @@ export type TranslateOptions = Pick<Config, 'translator' | 'projectLocale'> & {
|
|
|
6
6
|
};
|
|
7
7
|
export declare function translate({ dictionary, projectLocale, locale, translator }: TranslateOptions): Promise<Dictionary>;
|
|
8
8
|
//#endregion
|
|
9
|
+
//#region src/translate-dictionary.d.ts
|
|
10
|
+
export type TranslateDictionaryOptions = Pick<Config, 'translator' | 'projectLocale' | 'batchSize'> & {
|
|
11
|
+
dictionary: Dictionary;
|
|
12
|
+
locale: Locale;
|
|
13
|
+
};
|
|
14
|
+
export type TranslateDictionaryResult = {
|
|
15
|
+
/** Valid translations, keyed by the requested message ids only */
|
|
16
|
+
dictionary: Dictionary;
|
|
17
|
+
/** Ids the translator returned no usable translation for */
|
|
18
|
+
missing: string[];
|
|
19
|
+
/** Ids whose batch rejected */
|
|
20
|
+
failed: string[];
|
|
21
|
+
/** Rejection reasons of the failed batches */
|
|
22
|
+
errors: unknown[];
|
|
23
|
+
};
|
|
24
|
+
export declare function translateDictionary({ dictionary, projectLocale, locale, translator, batchSize }: TranslateDictionaryOptions): Promise<TranslateDictionaryResult>;
|
|
25
|
+
//#endregion
|
|
9
26
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/translate.ts"],"mappings":";;YAGY,mBAAmB,KAAK;EACnC,YAAY;EACZ,QAAQ;;wBAGa,YACrB,YACA,eACA,QACA,cACE,mBAAmB,QAAQ"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/translate.ts","../src/translate-dictionary.ts"],"mappings":";;YAGY,mBAAmB,KAAK;EACnC,YAAY;EACZ,QAAQ;;wBAGa,YACrB,YACA,eACA,QACA,cACE,mBAAmB,QAAQ;;;YCVlB,6BAA6B,KACxC;EAGA,YAAY;EACZ,QAAQ;;YAGG;;EAEX,YAAY;;EAEZ;;EAEA;;EAEA;;wBAGqB,sBACrB,YACA,eACA,QACA,YACA,aACE,6BAA6B,QAAQ"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
async function e({dictionary:e,projectLocale:t,locale:n,translator:r}){return r({dictionary:e,projectLocale:t,locale:n})}export{e as translate};
|
|
1
|
+
async function e({dictionary:e,projectLocale:t,locale:n,translator:r}){return r({dictionary:e,projectLocale:t,locale:n})}async function t({dictionary:e,projectLocale:t,locale:n,translator:r,batchSize:i}){let a=Object.keys(e),o=i&&i>0?i:a.length,s=[];for(let e=0;e<a.length;e+=o)s.push(a.slice(e,e+o));let c=await Promise.allSettled(s.map(i=>r({dictionary:Object.fromEntries(i.map(t=>[t,e[t]])),projectLocale:t,locale:n}))),l={dictionary:{},missing:[],failed:[],errors:[]};return c.forEach((e,t)=>{let n=s[t];if(e.status===`rejected`)l.failed.push(...n),l.errors.push(e.reason);else for(let t of n){let n=e.value?.[t];typeof n==`string`&&n.trim()?l.dictionary[t]=n:l.missing.push(t)}}),l}export{e as translate,t as translateDictionary};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["translate","translator"],"sources":["../src/translate.ts"],"sourcesContent":["// Types\nimport type { Config, Locale, Dictionary } from '@terai/types'\n\nexport type TranslateOptions = Pick<Config, 'translator' | 'projectLocale'> & {\n\tdictionary: Dictionary\n\tlocale: Locale\n}\n\nexport async function translate({\n\tdictionary,\n\tprojectLocale,\n\tlocale,\n\ttranslator\n}: TranslateOptions): Promise<Dictionary> {\n\treturn translator({\n\t\tdictionary,\n\t\tprojectLocale,\n\t\tlocale\n\t})\n}\n"],"mappings":"AAQA,eAAsBA,EAAU,CAC/B,aACA,gBACA,SACA,cACyC,CACzC,OAAOC,EAAW,CACjB,aACA,gBACA,QACD,CAAC,CACF,C"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["translate","translator","translateDictionary","ids","dictionary","size","batchSize","batches","i","results","batch","id","result","index","settled","value"],"sources":["../src/translate.ts","../src/translate-dictionary.ts"],"sourcesContent":["// Types\nimport type { Config, Locale, Dictionary } from '@terai/types'\n\nexport type TranslateOptions = Pick<Config, 'translator' | 'projectLocale'> & {\n\tdictionary: Dictionary\n\tlocale: Locale\n}\n\nexport async function translate({\n\tdictionary,\n\tprojectLocale,\n\tlocale,\n\ttranslator\n}: TranslateOptions): Promise<Dictionary> {\n\treturn translator({\n\t\tdictionary,\n\t\tprojectLocale,\n\t\tlocale\n\t})\n}\n","// Types\nimport type { Config, Locale, Dictionary } from '@terai/types'\n\nexport type TranslateDictionaryOptions = Pick<\n\tConfig,\n\t'translator' | 'projectLocale' | 'batchSize'\n> & {\n\tdictionary: Dictionary\n\tlocale: Locale\n}\n\nexport type TranslateDictionaryResult = {\n\t/** Valid translations, keyed by the requested message ids only */\n\tdictionary: Dictionary\n\t/** Ids the translator returned no usable translation for */\n\tmissing: string[]\n\t/** Ids whose batch rejected */\n\tfailed: string[]\n\t/** Rejection reasons of the failed batches */\n\terrors: unknown[]\n}\n\nexport async function translateDictionary({\n\tdictionary,\n\tprojectLocale,\n\tlocale,\n\ttranslator,\n\tbatchSize\n}: TranslateDictionaryOptions): Promise<TranslateDictionaryResult> {\n\tconst ids = Object.keys(dictionary)\n\tconst size = batchSize && batchSize > 0 ? batchSize : ids.length\n\tconst batches: string[][] = []\n\n\tfor (let i = 0; i < ids.length; i += size) {\n\t\tbatches.push(ids.slice(i, i + size))\n\t}\n\n\tconst results = await Promise.allSettled(\n\t\tbatches.map((batch) =>\n\t\t\ttranslator({\n\t\t\t\tdictionary: Object.fromEntries(batch.map((id) => [id, dictionary[id]])),\n\t\t\t\tprojectLocale,\n\t\t\t\tlocale\n\t\t\t})\n\t\t)\n\t)\n\n\tconst result: TranslateDictionaryResult = {\n\t\tdictionary: {},\n\t\tmissing: [],\n\t\tfailed: [],\n\t\terrors: []\n\t}\n\n\tresults.forEach((settled, index) => {\n\t\tconst batch = batches[index]\n\n\t\tif (settled.status === 'rejected') {\n\t\t\tresult.failed.push(...batch)\n\t\t\tresult.errors.push(settled.reason)\n\t\t\treturn\n\t\t}\n\n\t\t// Keep only the ids that were asked for: translators (LLMs in particular)\n\t\t// may rename, drop or invent keys.\n\t\tfor (const id of batch) {\n\t\t\tconst value = settled.value?.[id]\n\n\t\t\tif (typeof value === 'string' && value.trim()) {\n\t\t\t\tresult.dictionary[id] = value\n\t\t\t} else {\n\t\t\t\tresult.missing.push(id)\n\t\t\t}\n\t\t}\n\t})\n\n\treturn result\n}\n"],"mappings":"AAQA,eAAsBA,EAAU,CAC/B,aACA,gBACA,SACA,cACyC,CACzC,OAAOC,EAAW,CACjB,aACA,gBACA,QACD,CAAC,CACF,CCGA,eAAsBC,EAAoB,CACzC,aACA,gBACA,SACA,aACA,aACkE,CAClE,IAAMC,EAAM,OAAO,KAAKC,CAAU,EAC5BC,EAAOC,GAAaA,EAAY,EAAIA,EAAYH,EAAI,OACpDI,EAAsB,CAAC,EAE7B,IAAK,IAAIC,EAAI,EAAGA,EAAIL,EAAI,OAAQ,GAAKE,EACpCE,EAAQ,KAAKJ,EAAI,MAAMK,EAAGA,EAAIH,CAAI,CAAC,EAGpC,IAAMI,EAAU,MAAM,QAAQ,WAC7BF,EAAQ,IAAK,GACZN,EAAW,CACV,WAAY,OAAO,YAAYS,EAAM,IAAK,GAAO,CAACC,EAAIP,EAAWO,EAAG,CAAC,CAAC,EACtE,gBACA,QACD,CAAC,CACF,CACD,EAEMC,EAAoC,CACzC,WAAY,CAAC,EACb,QAAS,CAAC,EACV,OAAQ,CAAC,EACT,OAAQ,CAAC,CACV,EAwBA,OAtBAH,EAAQ,SAAS,EAAS,IAAU,CACnC,IAAMC,EAAQH,EAAQM,GAEtB,GAAIC,EAAQ,SAAW,WACtBF,EAAO,OAAO,KAAK,GAAGF,CAAK,EAC3BE,EAAO,OAAO,KAAKE,EAAQ,MAAM,OAMlC,IAAK,IAAMH,KAAMD,EAAO,CACvB,IAAMK,EAAQD,EAAQ,QAAQH,GAE1B,OAAOI,GAAU,UAAYA,EAAM,KAAK,EAC3C,EAAO,WAAWJ,GAAMI,EAExBH,EAAO,QAAQ,KAAKD,CAAE,CAExB,CACD,CAAC,EAEMC,CACR,C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terai/translator",
|
|
3
3
|
"description": "terai core translator",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.18",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"ai": "^7.0.143",
|
|
54
54
|
"deepl-node": "^1.28.1",
|
|
55
55
|
"zod": "^4.6.7",
|
|
56
|
-
"@terai/runtime": "0.0.
|
|
57
|
-
"@terai/types": "0.0.
|
|
58
|
-
"@terai/utils": "0.0.
|
|
56
|
+
"@terai/runtime": "0.0.18",
|
|
57
|
+
"@terai/types": "0.0.18",
|
|
58
|
+
"@terai/utils": "0.0.18"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"dev": "tsdown --format=esm --no-dts --watch",
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
//#region ../types/dist/index.d.mts
|
|
2
|
-
//#region src/locale.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* BCP 47 Locale Identifiers
|
|
5
|
-
*
|
|
6
|
-
* This type represents all valid locale codes based on the Unicode CLDR v47 (2025).
|
|
7
|
-
* Format follows BCP 47 standard using hyphens (e.g., 'en-US', 'zh-Hans-CN').
|
|
8
|
-
*
|
|
9
|
-
* Structure:
|
|
10
|
-
* - language: ISO 639-1/639-3 language code (e.g., 'en', 'zh')
|
|
11
|
-
* - script: ISO 15924 script code (e.g., 'Hans', 'Latn')
|
|
12
|
-
* - region: ISO 3166-1 alpha-2 country code or UN M.49 region code (e.g., 'US', '419')
|
|
13
|
-
* - variant: Registered variant subtags (e.g., 'valencia', 'tarask')
|
|
14
|
-
*
|
|
15
|
-
* @see https://cldr.unicode.org/
|
|
16
|
-
* @see https://www.ietf.org/rfc/bcp/bcp47.txt
|
|
17
|
-
* @see https://www.iana.org/assignments/language-subtag-registry
|
|
18
|
-
*/
|
|
19
|
-
type Locale = 'aa' | 'aa-DJ' | 'aa-ER' | 'ab' | 'af' | 'af-NA' | 'af-ZA' | 'agq' | 'agq-CM' | 'ak' | 'ak-GH' | 'am' | 'am-ET' | 'an' | 'an-ES' | 'ann' | 'ann-NG' | 'apc' | 'apc-SY' | 'ar' | 'ar-001' | 'ar-AE' | 'ar-BH' | 'ar-DJ' | 'ar-DZ' | 'ar-EG' | 'ar-EH' | 'ar-ER' | 'ar-IL' | 'ar-IQ' | 'ar-JO' | 'ar-KM' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'ar-MR' | 'ar-OM' | 'ar-PS' | 'ar-QA' | 'ar-SA' | 'ar-SD' | 'ar-SO' | 'ar-SS' | 'ar-SY' | 'ar-TD' | 'ar-TN' | 'ar-YE' | 'arn' | 'arn-CL' | 'as' | 'as-IN' | 'asa' | 'asa-TZ' | 'ast' | 'ast-ES' | 'az' | 'az-Arab' | 'az-Arab-IQ' | 'az-Arab-IR' | 'az-Arab-TR' | 'az-Cyrl' | 'az-Cyrl-AZ' | 'az-Latn' | 'az-Latn-AZ' | 'ba' | 'ba-RU' | 'bal' | 'bal-Arab' | 'bal-Arab-PK' | 'bal-Latn' | 'bal-Latn-PK' | 'bas' | 'bas-CM' | 'be' | 'be-BY' | 'be-tarask' | 'bem' | 'bem-ZM' | 'bew' | 'bew-ID' | 'bez' | 'bez-TZ' | 'bg' | 'bg-BG' | 'bgc' | 'bgc-IN' | 'bgn' | 'bgn-AE' | 'bgn-AF' | 'bgn-IR' | 'bgn-OM' | 'bgn-PK' | 'bho' | 'bho-IN' | 'blo' | 'blo-BJ' | 'blt' | 'blt-VN' | 'bm' | 'bm-ML' | 'bm-Nkoo' | 'bm-Nkoo-ML' | 'bn' | 'bn-BD' | 'bn-IN' | 'bo' | 'bo-CN' | 'bo-IN' | 'bqi' | 'bqi-IR' | 'br' | 'br-FR' | 'brx' | 'brx-IN' | 'bs' | 'bs-Cyrl' | 'bs-Cyrl-BA' | 'bs-Latn' | 'bs-Latn-BA' | 'bss' | 'bss-CM' | 'bua' | 'bua-RU' | 'byn' | 'byn-ER' | 'ca' | 'ca-AD' | 'ca-ES' | 'ca-ES-valencia' | 'ca-FR' | 'ca-IT' | 'cad' | 'cad-US' | 'cch' | 'cch-NG' | 'ccp' | 'ccp-BD' | 'ccp-IN' | 'ce' | 'ce-RU' | 'ceb' | 'ceb-PH' | 'cgg' | 'cgg-UG' | 'cho' | 'cho-US' | 'chr' | 'chr-US' | 'cic' | 'cic-US' | 'ckb' | 'ckb-IQ' | 'ckb-IR' | 'co' | 'co-FR' | 'cop' | 'cop-EG' | 'cs' | 'cs-CZ' | 'csw' | 'csw-CA' | 'cu' | 'cu-RU' | 'cv' | 'cv-RU' | 'cy' | 'cy-GB' | 'da' | 'da-DK' | 'da-GL' | 'dav' | 'dav-KE' | 'de' | 'de-AT' | 'de-BE' | 'de-CH' | 'de-DE' | 'de-IT' | 'de-LI' | 'de-LU' | 'dje' | 'dje-NE' | 'doi' | 'doi-IN' | 'dsb' | 'dsb-DE' | 'dua' | 'dua-CM' | 'dv' | 'dv-MV' | 'dyo' | 'dyo-SN' | 'dz' | 'dz-BT' | 'ebu' | 'ebu-KE' | 'ee' | 'ee-GH' | 'ee-TG' | 'el' | 'el-CY' | 'el-GR' | 'el-polyton' | 'en' | 'en-001' | 'en-150' | 'en-AE' | 'en-AG' | 'en-AI' | 'en-AS' | 'en-AT' | 'en-AU' | 'en-BB' | 'en-BE' | 'en-BI' | 'en-BM' | 'en-BS' | 'en-BW' | 'en-BZ' | 'en-CA' | 'en-CC' | 'en-CH' | 'en-CK' | 'en-CM' | 'en-CX' | 'en-CY' | 'en-CZ' | 'en-DE' | 'en-DG' | 'en-DK' | 'en-DM' | 'en-Dsrt' | 'en-Dsrt-US' | 'en-EE' | 'en-ER' | 'en-ES' | 'en-FI' | 'en-FJ' | 'en-FK' | 'en-FM' | 'en-FR' | 'en-GB' | 'en-GD' | 'en-GE' | 'en-GG' | 'en-GH' | 'en-GI' | 'en-GM' | 'en-GS' | 'en-GU' | 'en-GY' | 'en-HK' | 'en-HU' | 'en-ID' | 'en-IE' | 'en-IL' | 'en-IM' | 'en-IN' | 'en-IO' | 'en-IT' | 'en-JE' | 'en-JM' | 'en-JP' | 'en-KE' | 'en-KI' | 'en-KN' | 'en-KY' | 'en-LC' | 'en-LR' | 'en-LS' | 'en-LT' | 'en-LV' | 'en-MG' | 'en-MH' | 'en-MO' | 'en-MP' | 'en-MS' | 'en-MT' | 'en-MU' | 'en-MV' | 'en-MW' | 'en-MY' | 'en-NA' | 'en-NF' | 'en-NG' | 'en-NL' | 'en-NO' | 'en-NR' | 'en-NU' | 'en-NZ' | 'en-PG' | 'en-PH' | 'en-PK' | 'en-PL' | 'en-PN' | 'en-PR' | 'en-PT' | 'en-PW' | 'en-RO' | 'en-RW' | 'en-SB' | 'en-SC' | 'en-SD' | 'en-SE' | 'en-SG' | 'en-SH' | 'en-SI' | 'en-SK' | 'en-SL' | 'en-SS' | 'en-SX' | 'en-SZ' | 'en-Shaw' | 'en-Shaw-GB' | 'en-TC' | 'en-TK' | 'en-TO' | 'en-TT' | 'en-TV' | 'en-TZ' | 'en-UA' | 'en-UG' | 'en-UM' | 'en-US' | 'en-US-POSIX' | 'en-VC' | 'en-VG' | 'en-VI' | 'en-VU' | 'en-WS' | 'en-ZA' | 'en-ZM' | 'en-ZW' | 'eo' | 'eo-001' | 'es' | 'es-419' | 'es-AR' | 'es-BO' | 'es-BR' | 'es-BZ' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-CU' | 'es-DO' | 'es-EA' | 'es-EC' | 'es-ES' | 'es-GQ' | 'es-GT' | 'es-HN' | 'es-IC' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PE' | 'es-PH' | 'es-PR' | 'es-PY' | 'es-SV' | 'es-US' | 'es-UY' | 'es-VE' | 'et' | 'et-EE' | 'eu' | 'eu-ES' | 'ewo' | 'ewo-CM' | 'fa' | 'fa-AF' | 'fa-IR' | 'ff' | 'ff-Adlm' | 'ff-Adlm-BF' | 'ff-Adlm-CM' | 'ff-Adlm-GH' | 'ff-Adlm-GM' | 'ff-Adlm-GN' | 'ff-Adlm-GW' | 'ff-Adlm-LR' | 'ff-Adlm-MR' | 'ff-Adlm-NE' | 'ff-Adlm-NG' | 'ff-Adlm-SL' | 'ff-Adlm-SN' | 'ff-Latn' | 'ff-Latn-BF' | 'ff-Latn-CM' | 'ff-Latn-GH' | 'ff-Latn-GM' | 'ff-Latn-GN' | 'ff-Latn-GW' | 'ff-Latn-LR' | 'ff-Latn-MR' | 'ff-Latn-NE' | 'ff-Latn-NG' | 'ff-Latn-SL' | 'ff-Latn-SN' | 'fi' | 'fi-FI' | 'fil' | 'fil-PH' | 'fo' | 'fo-DK' | 'fo-FO' | 'fr' | 'fr-BE' | 'fr-BF' | 'fr-BI' | 'fr-BJ' | 'fr-BL' | 'fr-CA' | 'fr-CD' | 'fr-CF' | 'fr-CG' | 'fr-CH' | 'fr-CI' | 'fr-CM' | 'fr-DJ' | 'fr-DZ' | 'fr-FR' | 'fr-GA' | 'fr-GF' | 'fr-GN' | 'fr-GP' | 'fr-GQ' | 'fr-HT' | 'fr-KM' | 'fr-LU' | 'fr-MA' | 'fr-MC' | 'fr-MF' | 'fr-MG' | 'fr-ML' | 'fr-MQ' | 'fr-MR' | 'fr-MU' | 'fr-NC' | 'fr-NE' | 'fr-PF' | 'fr-PM' | 'fr-RE' | 'fr-RW' | 'fr-SC' | 'fr-SN' | 'fr-SY' | 'fr-TD' | 'fr-TG' | 'fr-TN' | 'fr-VU' | 'fr-WF' | 'fr-YT' | 'frr' | 'frr-DE' | 'fur' | 'fur-IT' | 'fy' | 'fy-NL' | 'ga' | 'ga-GB' | 'ga-IE' | 'gaa' | 'gaa-GH' | 'gd' | 'gd-GB' | 'gez' | 'gez-ER' | 'gez-ET' | 'gl' | 'gl-ES' | 'gn' | 'gn-PY' | 'gsw' | 'gsw-CH' | 'gsw-FR' | 'gsw-LI' | 'gu' | 'gu-IN' | 'guz' | 'guz-KE' | 'gv' | 'gv-IM' | 'ha' | 'ha-Arab' | 'ha-Arab-NG' | 'ha-Arab-SD' | 'ha-GH' | 'ha-NE' | 'ha-NG' | 'haw' | 'haw-US' | 'he' | 'he-IL' | 'hi' | 'hi-IN' | 'hi-Latn' | 'hi-Latn-IN' | 'hnj' | 'hnj-Hmnp' | 'hnj-Hmnp-US' | 'hr' | 'hr-BA' | 'hr-HR' | 'hsb' | 'hsb-DE' | 'ht' | 'ht-HT' | 'hu' | 'hu-HU' | 'hy' | 'hy-AM' | 'ia' | 'ia-001' | 'id' | 'id-ID' | 'ie' | 'ie-EE' | 'ig' | 'ig-NG' | 'ii' | 'ii-CN' | 'io' | 'io-001' | 'is' | 'is-IS' | 'it' | 'it-CH' | 'it-IT' | 'it-SM' | 'it-VA' | 'iu' | 'iu-CA' | 'iu-Latn' | 'iu-Latn-CA' | 'ja' | 'ja-JP' | 'jbo' | 'jbo-001' | 'jgo' | 'jgo-CM' | 'jmc' | 'jmc-TZ' | 'jv' | 'jv-ID' | 'ka' | 'ka-GE' | 'kaa' | 'kaa-Cyrl' | 'kaa-Cyrl-UZ' | 'kaa-Latn' | 'kaa-Latn-UZ' | 'kab' | 'kab-DZ' | 'kaj' | 'kaj-NG' | 'kam' | 'kam-KE' | 'kcg' | 'kcg-NG' | 'kde' | 'kde-TZ' | 'kea' | 'kea-CV' | 'kek' | 'kek-GT' | 'ken' | 'ken-CM' | 'kgp' | 'kgp-BR' | 'khq' | 'khq-ML' | 'ki' | 'ki-KE' | 'kk' | 'kk-Arab' | 'kk-Arab-CN' | 'kk-Cyrl' | 'kk-Cyrl-KZ' | 'kk-KZ' | 'kkj' | 'kkj-CM' | 'kl' | 'kl-GL' | 'kln' | 'kln-KE' | 'km' | 'km-KH' | 'kn' | 'kn-IN' | 'ko' | 'ko-CN' | 'ko-KP' | 'ko-KR' | 'kok' | 'kok-Deva' | 'kok-Deva-IN' | 'kok-IN' | 'kok-Latn' | 'kok-Latn-IN' | 'kpe' | 'kpe-GN' | 'kpe-LR' | 'ks' | 'ks-Arab' | 'ks-Arab-IN' | 'ks-Deva' | 'ks-Deva-IN' | 'ksb' | 'ksb-TZ' | 'ksf' | 'ksf-CM' | 'ksh' | 'ksh-DE' | 'ku' | 'ku-Arab' | 'ku-Arab-IQ' | 'ku-Arab-IR' | 'ku-Latn' | 'ku-Latn-IQ' | 'ku-Latn-SY' | 'ku-Latn-TR' | 'ku-TR' | 'kw' | 'kw-GB' | 'kxv' | 'kxv-Deva' | 'kxv-Deva-IN' | 'kxv-Latn' | 'kxv-Latn-IN' | 'kxv-Orya' | 'kxv-Orya-IN' | 'kxv-Telu' | 'kxv-Telu-IN' | 'ky' | 'ky-KG' | 'la' | 'la-VA' | 'lag' | 'lag-TZ' | 'lb' | 'lb-LU' | 'lg' | 'lg-UG' | 'lij' | 'lij-IT' | 'lkt' | 'lkt-US' | 'lld' | 'lld-IT' | 'lmo' | 'lmo-IT' | 'ln' | 'ln-AO' | 'ln-CD' | 'ln-CF' | 'ln-CG' | 'lo' | 'lo-LA' | 'lrc' | 'lrc-IQ' | 'lrc-IR' | 'lt' | 'lt-LT' | 'ltg' | 'ltg-LV' | 'lu' | 'lu-CD' | 'luo' | 'luo-KE' | 'luy' | 'luy-KE' | 'lv' | 'lv-LV' | 'lzz' | 'lzz-TR' | 'mai' | 'mai-IN' | 'mas' | 'mas-KE' | 'mas-TZ' | 'mdf' | 'mdf-RU' | 'mer' | 'mer-KE' | 'mfe' | 'mfe-MU' | 'mg' | 'mg-MG' | 'mgh' | 'mgh-MZ' | 'mgo' | 'mgo-CM' | 'mhn' | 'mhn-IT' | 'mi' | 'mi-NZ' | 'mic' | 'mic-CA' | 'mk' | 'mk-MK' | 'ml' | 'ml-IN' | 'mn' | 'mn-MN' | 'mn-Mong' | 'mn-Mong-CN' | 'mn-Mong-MN' | 'mni' | 'mni-Beng' | 'mni-Beng-IN' | 'mni-Mtei' | 'mni-Mtei-IN' | 'moh' | 'moh-CA' | 'mr' | 'mr-IN' | 'ms' | 'ms-Arab' | 'ms-Arab-BN' | 'ms-Arab-MY' | 'ms-BN' | 'ms-ID' | 'ms-MY' | 'ms-SG' | 'mt' | 'mt-MT' | 'mua' | 'mua-CM' | 'mus' | 'mus-US' | 'mww' | 'mww-Hmnp' | 'mww-Hmnp-US' | 'my' | 'my-MM' | 'myv' | 'myv-RU' | 'mzn' | 'mzn-IR' | 'naq' | 'naq-NA' | 'nb' | 'nb-NO' | 'nb-SJ' | 'nd' | 'nd-ZW' | 'nds' | 'nds-DE' | 'nds-NL' | 'ne' | 'ne-IN' | 'ne-NP' | 'nl' | 'nl-AW' | 'nl-BE' | 'nl-BQ' | 'nl-CW' | 'nl-NL' | 'nl-SR' | 'nl-SX' | 'nmg' | 'nmg-CM' | 'nn' | 'nn-NO' | 'nnh' | 'nnh-CM' | 'no' | 'no-NO' | 'nqo' | 'nqo-GN' | 'nr' | 'nr-ZA' | 'nso' | 'nso-ZA' | 'nus' | 'nus-SS' | 'nv' | 'nv-US' | 'ny' | 'ny-MW' | 'nyn' | 'nyn-UG' | 'oc' | 'oc-ES' | 'oc-FR' | 'oka' | 'oka-CA' | 'oka-US' | 'om' | 'om-ET' | 'om-KE' | 'or' | 'or-IN' | 'os' | 'os-GE' | 'os-RU' | 'osa' | 'osa-US' | 'pa' | 'pa-Arab' | 'pa-Arab-PK' | 'pa-Guru' | 'pa-Guru-IN' | 'pap' | 'pap-AW' | 'pap-CW' | 'pcm' | 'pcm-NG' | 'pi' | 'pi-Latn' | 'pi-Latn-TH' | 'pis' | 'pis-SB' | 'pl' | 'pl-PL' | 'pms' | 'pms-IT' | 'prg' | 'prg-001' | 'ps' | 'ps-AF' | 'ps-PK' | 'pt' | 'pt-AO' | 'pt-BR' | 'pt-CH' | 'pt-CV' | 'pt-GQ' | 'pt-GW' | 'pt-LU' | 'pt-MO' | 'pt-MZ' | 'pt-PT' | 'pt-ST' | 'pt-TL' | 'qu' | 'qu-BO' | 'qu-EC' | 'qu-PE' | 'quc' | 'quc-GT' | 'raj' | 'raj-IN' | 'rhg' | 'rhg-Rohg' | 'rhg-Rohg-BD' | 'rhg-Rohg-MM' | 'rif' | 'rif-MA' | 'rm' | 'rm-CH' | 'rn' | 'rn-BI' | 'ro' | 'ro-MD' | 'ro-RO' | 'rof' | 'rof-TZ' | 'root' | 'ru' | 'ru-BY' | 'ru-KG' | 'ru-KZ' | 'ru-MD' | 'ru-RU' | 'ru-UA' | 'rw' | 'rw-RW' | 'rwk' | 'rwk-TZ' | 'sa' | 'sa-IN' | 'sah' | 'sah-RU' | 'saq' | 'saq-KE' | 'sat' | 'sat-Deva' | 'sat-Deva-IN' | 'sat-Olck' | 'sat-Olck-IN' | 'sbp' | 'sbp-TZ' | 'sc' | 'sc-IT' | 'scn' | 'scn-IT' | 'sd' | 'sd-Arab' | 'sd-Arab-PK' | 'sd-Deva' | 'sd-Deva-IN' | 'sdh' | 'sdh-IQ' | 'sdh-IR' | 'se' | 'se-FI' | 'se-NO' | 'se-SE' | 'seh' | 'seh-MZ' | 'ses' | 'ses-ML' | 'sg' | 'sg-CF' | 'sgs' | 'sgs-LT' | 'shi' | 'shi-Latn' | 'shi-Latn-MA' | 'shi-Tfng' | 'shi-Tfng-MA' | 'shn' | 'shn-MM' | 'shn-TH' | 'si' | 'si-LK' | 'sid' | 'sid-ET' | 'sk' | 'sk-SK' | 'skr' | 'skr-PK' | 'sl' | 'sl-SI' | 'sma' | 'sma-NO' | 'sma-SE' | 'smj' | 'smj-NO' | 'smj-SE' | 'smn' | 'smn-FI' | 'sms' | 'sms-FI' | 'sn' | 'sn-ZW' | 'so' | 'so-DJ' | 'so-ET' | 'so-KE' | 'so-SO' | 'sq' | 'sq-AL' | 'sq-MK' | 'sq-XK' | 'sr' | 'sr-Cyrl' | 'sr-Cyrl-BA' | 'sr-Cyrl-ME' | 'sr-Cyrl-RS' | 'sr-Cyrl-XK' | 'sr-Latn' | 'sr-Latn-BA' | 'sr-Latn-ME' | 'sr-Latn-RS' | 'sr-Latn-XK' | 'ss' | 'ss-SZ' | 'ss-ZA' | 'ssy' | 'ssy-ER' | 'st' | 'st-LS' | 'st-ZA' | 'su' | 'su-Latn' | 'su-Latn-ID' | 'suz' | 'suz-Deva' | 'suz-Deva-NP' | 'suz-Sunu' | 'suz-Sunu-NP' | 'sv' | 'sv-AX' | 'sv-FI' | 'sv-SE' | 'sw' | 'sw-CD' | 'sw-KE' | 'sw-TZ' | 'sw-UG' | 'syr' | 'syr-IQ' | 'syr-SY' | 'szl' | 'szl-PL' | 'ta' | 'ta-IN' | 'ta-LK' | 'ta-MY' | 'ta-SG' | 'te' | 'te-IN' | 'teo' | 'teo-KE' | 'teo-UG' | 'tg' | 'tg-TJ' | 'th' | 'th-TH' | 'ti' | 'ti-ER' | 'ti-ET' | 'tig' | 'tig-ER' | 'tk' | 'tk-TM' | 'tn' | 'tn-BW' | 'tn-ZA' | 'to' | 'to-TO' | 'tok' | 'tok-001' | 'tpi' | 'tpi-PG' | 'tr' | 'tr-CY' | 'tr-TR' | 'trv' | 'trv-TW' | 'trw' | 'trw-PK' | 'ts' | 'ts-ZA' | 'tt' | 'tt-RU' | 'twq' | 'twq-NE' | 'tyv' | 'tyv-RU' | 'tzm' | 'tzm-MA' | 'ug' | 'ug-CN' | 'uk' | 'uk-UA' | 'und' | 'ur' | 'ur-IN' | 'ur-PK' | 'uz' | 'uz-Arab' | 'uz-Arab-AF' | 'uz-Cyrl' | 'uz-Cyrl-UZ' | 'uz-Latn' | 'uz-Latn-UZ' | 'vai' | 'vai-Latn' | 'vai-Latn-LR' | 'vai-Vaii' | 'vai-Vaii-LR' | 've' | 've-ZA' | 'vec' | 'vec-IT' | 'vi' | 'vi-VN' | 'vmw' | 'vmw-MZ' | 'vo' | 'vo-001' | 'vun' | 'vun-TZ' | 'wa' | 'wa-BE' | 'wae' | 'wae-CH' | 'wal' | 'wal-ET' | 'wbp' | 'wbp-AU' | 'wo' | 'wo-SN' | 'xh' | 'xh-ZA' | 'xnr' | 'xnr-IN' | 'xog' | 'xog-UG' | 'yav' | 'yav-CM' | 'yi' | 'yi-001' | 'yo' | 'yo-BJ' | 'yo-NG' | 'yrl' | 'yrl-BR' | 'yrl-CO' | 'yrl-VE' | 'yue' | 'yue-Hans' | 'yue-Hans-CN' | 'yue-Hant' | 'yue-Hant-CN' | 'yue-Hant-HK' | 'yue-Hant-MO' | 'za' | 'za-CN' | 'zgh' | 'zgh-MA' | 'zh' | 'zh-Hans' | 'zh-Hans-CN' | 'zh-Hans-HK' | 'zh-Hans-MO' | 'zh-Hans-MY' | 'zh-Hans-SG' | 'zh-Hant' | 'zh-Hant-HK' | 'zh-Hant-MO' | 'zh-Hant-MY' | 'zh-Hant-TW' | 'zh-Latn' | 'zh-Latn-CN' | 'zu' | 'zu-ZA';
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/dictionary.d.ts
|
|
22
|
-
type Dictionary = Record<string, string>;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/translator.d.ts
|
|
25
|
-
type Translator = ({ dictionary, locale, projectLocale }: {
|
|
26
|
-
dictionary: Dictionary;
|
|
27
|
-
locale: Locale;
|
|
28
|
-
projectLocale: Locale;
|
|
29
|
-
}) => Promise<Dictionary>;
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/config.d.ts
|
|
32
|
-
/**
|
|
33
|
-
* Configuration for Terai
|
|
34
|
-
*/
|
|
35
|
-
type Config = {
|
|
36
|
-
/**
|
|
37
|
-
* List of files glob to to look for your locale declarations
|
|
38
|
-
*/
|
|
39
|
-
include: string[];
|
|
40
|
-
/**
|
|
41
|
-
* List of files glob to ignore
|
|
42
|
-
*/
|
|
43
|
-
exclude?: string[];
|
|
44
|
-
/**
|
|
45
|
-
* The output directory for your locale system
|
|
46
|
-
*/
|
|
47
|
-
outDir: string;
|
|
48
|
-
/**
|
|
49
|
-
* The base locale used in your project messages
|
|
50
|
-
*/
|
|
51
|
-
projectLocale: Locale;
|
|
52
|
-
/**
|
|
53
|
-
* The aditional locales you want to support
|
|
54
|
-
*/
|
|
55
|
-
outLocales: Locale[];
|
|
56
|
-
/**
|
|
57
|
-
* The translator for your messages
|
|
58
|
-
*/
|
|
59
|
-
translator: Translator;
|
|
60
|
-
};
|
|
61
|
-
//#endregion
|
|
62
|
-
export { Translator as i, Dictionary as n, Locale as r, Config as t };
|
|
63
|
-
//# sourceMappingURL=index-DTSqS4fv.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DTSqS4fv.d.cts","names":[],"sources":["../../types/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;KAiBY;;;KAGA,aAAa;;;KAKb,gBAAgB,YAAY,QAAQ;EAC9C,YAAY;EACZ,QAAQ;EACR,eAAe;MACX,QAAQ;;;;;;KAMF;;;;EAIV;;;;EAIA;;;;EAIA;;;;EAIA,eAAe;;;;EAIf,YAAY;;;;EAIZ,YAAY"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
//#region ../types/dist/index.d.mts
|
|
2
|
-
//#region src/locale.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* BCP 47 Locale Identifiers
|
|
5
|
-
*
|
|
6
|
-
* This type represents all valid locale codes based on the Unicode CLDR v47 (2025).
|
|
7
|
-
* Format follows BCP 47 standard using hyphens (e.g., 'en-US', 'zh-Hans-CN').
|
|
8
|
-
*
|
|
9
|
-
* Structure:
|
|
10
|
-
* - language: ISO 639-1/639-3 language code (e.g., 'en', 'zh')
|
|
11
|
-
* - script: ISO 15924 script code (e.g., 'Hans', 'Latn')
|
|
12
|
-
* - region: ISO 3166-1 alpha-2 country code or UN M.49 region code (e.g., 'US', '419')
|
|
13
|
-
* - variant: Registered variant subtags (e.g., 'valencia', 'tarask')
|
|
14
|
-
*
|
|
15
|
-
* @see https://cldr.unicode.org/
|
|
16
|
-
* @see https://www.ietf.org/rfc/bcp/bcp47.txt
|
|
17
|
-
* @see https://www.iana.org/assignments/language-subtag-registry
|
|
18
|
-
*/
|
|
19
|
-
type Locale = 'aa' | 'aa-DJ' | 'aa-ER' | 'ab' | 'af' | 'af-NA' | 'af-ZA' | 'agq' | 'agq-CM' | 'ak' | 'ak-GH' | 'am' | 'am-ET' | 'an' | 'an-ES' | 'ann' | 'ann-NG' | 'apc' | 'apc-SY' | 'ar' | 'ar-001' | 'ar-AE' | 'ar-BH' | 'ar-DJ' | 'ar-DZ' | 'ar-EG' | 'ar-EH' | 'ar-ER' | 'ar-IL' | 'ar-IQ' | 'ar-JO' | 'ar-KM' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'ar-MR' | 'ar-OM' | 'ar-PS' | 'ar-QA' | 'ar-SA' | 'ar-SD' | 'ar-SO' | 'ar-SS' | 'ar-SY' | 'ar-TD' | 'ar-TN' | 'ar-YE' | 'arn' | 'arn-CL' | 'as' | 'as-IN' | 'asa' | 'asa-TZ' | 'ast' | 'ast-ES' | 'az' | 'az-Arab' | 'az-Arab-IQ' | 'az-Arab-IR' | 'az-Arab-TR' | 'az-Cyrl' | 'az-Cyrl-AZ' | 'az-Latn' | 'az-Latn-AZ' | 'ba' | 'ba-RU' | 'bal' | 'bal-Arab' | 'bal-Arab-PK' | 'bal-Latn' | 'bal-Latn-PK' | 'bas' | 'bas-CM' | 'be' | 'be-BY' | 'be-tarask' | 'bem' | 'bem-ZM' | 'bew' | 'bew-ID' | 'bez' | 'bez-TZ' | 'bg' | 'bg-BG' | 'bgc' | 'bgc-IN' | 'bgn' | 'bgn-AE' | 'bgn-AF' | 'bgn-IR' | 'bgn-OM' | 'bgn-PK' | 'bho' | 'bho-IN' | 'blo' | 'blo-BJ' | 'blt' | 'blt-VN' | 'bm' | 'bm-ML' | 'bm-Nkoo' | 'bm-Nkoo-ML' | 'bn' | 'bn-BD' | 'bn-IN' | 'bo' | 'bo-CN' | 'bo-IN' | 'bqi' | 'bqi-IR' | 'br' | 'br-FR' | 'brx' | 'brx-IN' | 'bs' | 'bs-Cyrl' | 'bs-Cyrl-BA' | 'bs-Latn' | 'bs-Latn-BA' | 'bss' | 'bss-CM' | 'bua' | 'bua-RU' | 'byn' | 'byn-ER' | 'ca' | 'ca-AD' | 'ca-ES' | 'ca-ES-valencia' | 'ca-FR' | 'ca-IT' | 'cad' | 'cad-US' | 'cch' | 'cch-NG' | 'ccp' | 'ccp-BD' | 'ccp-IN' | 'ce' | 'ce-RU' | 'ceb' | 'ceb-PH' | 'cgg' | 'cgg-UG' | 'cho' | 'cho-US' | 'chr' | 'chr-US' | 'cic' | 'cic-US' | 'ckb' | 'ckb-IQ' | 'ckb-IR' | 'co' | 'co-FR' | 'cop' | 'cop-EG' | 'cs' | 'cs-CZ' | 'csw' | 'csw-CA' | 'cu' | 'cu-RU' | 'cv' | 'cv-RU' | 'cy' | 'cy-GB' | 'da' | 'da-DK' | 'da-GL' | 'dav' | 'dav-KE' | 'de' | 'de-AT' | 'de-BE' | 'de-CH' | 'de-DE' | 'de-IT' | 'de-LI' | 'de-LU' | 'dje' | 'dje-NE' | 'doi' | 'doi-IN' | 'dsb' | 'dsb-DE' | 'dua' | 'dua-CM' | 'dv' | 'dv-MV' | 'dyo' | 'dyo-SN' | 'dz' | 'dz-BT' | 'ebu' | 'ebu-KE' | 'ee' | 'ee-GH' | 'ee-TG' | 'el' | 'el-CY' | 'el-GR' | 'el-polyton' | 'en' | 'en-001' | 'en-150' | 'en-AE' | 'en-AG' | 'en-AI' | 'en-AS' | 'en-AT' | 'en-AU' | 'en-BB' | 'en-BE' | 'en-BI' | 'en-BM' | 'en-BS' | 'en-BW' | 'en-BZ' | 'en-CA' | 'en-CC' | 'en-CH' | 'en-CK' | 'en-CM' | 'en-CX' | 'en-CY' | 'en-CZ' | 'en-DE' | 'en-DG' | 'en-DK' | 'en-DM' | 'en-Dsrt' | 'en-Dsrt-US' | 'en-EE' | 'en-ER' | 'en-ES' | 'en-FI' | 'en-FJ' | 'en-FK' | 'en-FM' | 'en-FR' | 'en-GB' | 'en-GD' | 'en-GE' | 'en-GG' | 'en-GH' | 'en-GI' | 'en-GM' | 'en-GS' | 'en-GU' | 'en-GY' | 'en-HK' | 'en-HU' | 'en-ID' | 'en-IE' | 'en-IL' | 'en-IM' | 'en-IN' | 'en-IO' | 'en-IT' | 'en-JE' | 'en-JM' | 'en-JP' | 'en-KE' | 'en-KI' | 'en-KN' | 'en-KY' | 'en-LC' | 'en-LR' | 'en-LS' | 'en-LT' | 'en-LV' | 'en-MG' | 'en-MH' | 'en-MO' | 'en-MP' | 'en-MS' | 'en-MT' | 'en-MU' | 'en-MV' | 'en-MW' | 'en-MY' | 'en-NA' | 'en-NF' | 'en-NG' | 'en-NL' | 'en-NO' | 'en-NR' | 'en-NU' | 'en-NZ' | 'en-PG' | 'en-PH' | 'en-PK' | 'en-PL' | 'en-PN' | 'en-PR' | 'en-PT' | 'en-PW' | 'en-RO' | 'en-RW' | 'en-SB' | 'en-SC' | 'en-SD' | 'en-SE' | 'en-SG' | 'en-SH' | 'en-SI' | 'en-SK' | 'en-SL' | 'en-SS' | 'en-SX' | 'en-SZ' | 'en-Shaw' | 'en-Shaw-GB' | 'en-TC' | 'en-TK' | 'en-TO' | 'en-TT' | 'en-TV' | 'en-TZ' | 'en-UA' | 'en-UG' | 'en-UM' | 'en-US' | 'en-US-POSIX' | 'en-VC' | 'en-VG' | 'en-VI' | 'en-VU' | 'en-WS' | 'en-ZA' | 'en-ZM' | 'en-ZW' | 'eo' | 'eo-001' | 'es' | 'es-419' | 'es-AR' | 'es-BO' | 'es-BR' | 'es-BZ' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-CU' | 'es-DO' | 'es-EA' | 'es-EC' | 'es-ES' | 'es-GQ' | 'es-GT' | 'es-HN' | 'es-IC' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PE' | 'es-PH' | 'es-PR' | 'es-PY' | 'es-SV' | 'es-US' | 'es-UY' | 'es-VE' | 'et' | 'et-EE' | 'eu' | 'eu-ES' | 'ewo' | 'ewo-CM' | 'fa' | 'fa-AF' | 'fa-IR' | 'ff' | 'ff-Adlm' | 'ff-Adlm-BF' | 'ff-Adlm-CM' | 'ff-Adlm-GH' | 'ff-Adlm-GM' | 'ff-Adlm-GN' | 'ff-Adlm-GW' | 'ff-Adlm-LR' | 'ff-Adlm-MR' | 'ff-Adlm-NE' | 'ff-Adlm-NG' | 'ff-Adlm-SL' | 'ff-Adlm-SN' | 'ff-Latn' | 'ff-Latn-BF' | 'ff-Latn-CM' | 'ff-Latn-GH' | 'ff-Latn-GM' | 'ff-Latn-GN' | 'ff-Latn-GW' | 'ff-Latn-LR' | 'ff-Latn-MR' | 'ff-Latn-NE' | 'ff-Latn-NG' | 'ff-Latn-SL' | 'ff-Latn-SN' | 'fi' | 'fi-FI' | 'fil' | 'fil-PH' | 'fo' | 'fo-DK' | 'fo-FO' | 'fr' | 'fr-BE' | 'fr-BF' | 'fr-BI' | 'fr-BJ' | 'fr-BL' | 'fr-CA' | 'fr-CD' | 'fr-CF' | 'fr-CG' | 'fr-CH' | 'fr-CI' | 'fr-CM' | 'fr-DJ' | 'fr-DZ' | 'fr-FR' | 'fr-GA' | 'fr-GF' | 'fr-GN' | 'fr-GP' | 'fr-GQ' | 'fr-HT' | 'fr-KM' | 'fr-LU' | 'fr-MA' | 'fr-MC' | 'fr-MF' | 'fr-MG' | 'fr-ML' | 'fr-MQ' | 'fr-MR' | 'fr-MU' | 'fr-NC' | 'fr-NE' | 'fr-PF' | 'fr-PM' | 'fr-RE' | 'fr-RW' | 'fr-SC' | 'fr-SN' | 'fr-SY' | 'fr-TD' | 'fr-TG' | 'fr-TN' | 'fr-VU' | 'fr-WF' | 'fr-YT' | 'frr' | 'frr-DE' | 'fur' | 'fur-IT' | 'fy' | 'fy-NL' | 'ga' | 'ga-GB' | 'ga-IE' | 'gaa' | 'gaa-GH' | 'gd' | 'gd-GB' | 'gez' | 'gez-ER' | 'gez-ET' | 'gl' | 'gl-ES' | 'gn' | 'gn-PY' | 'gsw' | 'gsw-CH' | 'gsw-FR' | 'gsw-LI' | 'gu' | 'gu-IN' | 'guz' | 'guz-KE' | 'gv' | 'gv-IM' | 'ha' | 'ha-Arab' | 'ha-Arab-NG' | 'ha-Arab-SD' | 'ha-GH' | 'ha-NE' | 'ha-NG' | 'haw' | 'haw-US' | 'he' | 'he-IL' | 'hi' | 'hi-IN' | 'hi-Latn' | 'hi-Latn-IN' | 'hnj' | 'hnj-Hmnp' | 'hnj-Hmnp-US' | 'hr' | 'hr-BA' | 'hr-HR' | 'hsb' | 'hsb-DE' | 'ht' | 'ht-HT' | 'hu' | 'hu-HU' | 'hy' | 'hy-AM' | 'ia' | 'ia-001' | 'id' | 'id-ID' | 'ie' | 'ie-EE' | 'ig' | 'ig-NG' | 'ii' | 'ii-CN' | 'io' | 'io-001' | 'is' | 'is-IS' | 'it' | 'it-CH' | 'it-IT' | 'it-SM' | 'it-VA' | 'iu' | 'iu-CA' | 'iu-Latn' | 'iu-Latn-CA' | 'ja' | 'ja-JP' | 'jbo' | 'jbo-001' | 'jgo' | 'jgo-CM' | 'jmc' | 'jmc-TZ' | 'jv' | 'jv-ID' | 'ka' | 'ka-GE' | 'kaa' | 'kaa-Cyrl' | 'kaa-Cyrl-UZ' | 'kaa-Latn' | 'kaa-Latn-UZ' | 'kab' | 'kab-DZ' | 'kaj' | 'kaj-NG' | 'kam' | 'kam-KE' | 'kcg' | 'kcg-NG' | 'kde' | 'kde-TZ' | 'kea' | 'kea-CV' | 'kek' | 'kek-GT' | 'ken' | 'ken-CM' | 'kgp' | 'kgp-BR' | 'khq' | 'khq-ML' | 'ki' | 'ki-KE' | 'kk' | 'kk-Arab' | 'kk-Arab-CN' | 'kk-Cyrl' | 'kk-Cyrl-KZ' | 'kk-KZ' | 'kkj' | 'kkj-CM' | 'kl' | 'kl-GL' | 'kln' | 'kln-KE' | 'km' | 'km-KH' | 'kn' | 'kn-IN' | 'ko' | 'ko-CN' | 'ko-KP' | 'ko-KR' | 'kok' | 'kok-Deva' | 'kok-Deva-IN' | 'kok-IN' | 'kok-Latn' | 'kok-Latn-IN' | 'kpe' | 'kpe-GN' | 'kpe-LR' | 'ks' | 'ks-Arab' | 'ks-Arab-IN' | 'ks-Deva' | 'ks-Deva-IN' | 'ksb' | 'ksb-TZ' | 'ksf' | 'ksf-CM' | 'ksh' | 'ksh-DE' | 'ku' | 'ku-Arab' | 'ku-Arab-IQ' | 'ku-Arab-IR' | 'ku-Latn' | 'ku-Latn-IQ' | 'ku-Latn-SY' | 'ku-Latn-TR' | 'ku-TR' | 'kw' | 'kw-GB' | 'kxv' | 'kxv-Deva' | 'kxv-Deva-IN' | 'kxv-Latn' | 'kxv-Latn-IN' | 'kxv-Orya' | 'kxv-Orya-IN' | 'kxv-Telu' | 'kxv-Telu-IN' | 'ky' | 'ky-KG' | 'la' | 'la-VA' | 'lag' | 'lag-TZ' | 'lb' | 'lb-LU' | 'lg' | 'lg-UG' | 'lij' | 'lij-IT' | 'lkt' | 'lkt-US' | 'lld' | 'lld-IT' | 'lmo' | 'lmo-IT' | 'ln' | 'ln-AO' | 'ln-CD' | 'ln-CF' | 'ln-CG' | 'lo' | 'lo-LA' | 'lrc' | 'lrc-IQ' | 'lrc-IR' | 'lt' | 'lt-LT' | 'ltg' | 'ltg-LV' | 'lu' | 'lu-CD' | 'luo' | 'luo-KE' | 'luy' | 'luy-KE' | 'lv' | 'lv-LV' | 'lzz' | 'lzz-TR' | 'mai' | 'mai-IN' | 'mas' | 'mas-KE' | 'mas-TZ' | 'mdf' | 'mdf-RU' | 'mer' | 'mer-KE' | 'mfe' | 'mfe-MU' | 'mg' | 'mg-MG' | 'mgh' | 'mgh-MZ' | 'mgo' | 'mgo-CM' | 'mhn' | 'mhn-IT' | 'mi' | 'mi-NZ' | 'mic' | 'mic-CA' | 'mk' | 'mk-MK' | 'ml' | 'ml-IN' | 'mn' | 'mn-MN' | 'mn-Mong' | 'mn-Mong-CN' | 'mn-Mong-MN' | 'mni' | 'mni-Beng' | 'mni-Beng-IN' | 'mni-Mtei' | 'mni-Mtei-IN' | 'moh' | 'moh-CA' | 'mr' | 'mr-IN' | 'ms' | 'ms-Arab' | 'ms-Arab-BN' | 'ms-Arab-MY' | 'ms-BN' | 'ms-ID' | 'ms-MY' | 'ms-SG' | 'mt' | 'mt-MT' | 'mua' | 'mua-CM' | 'mus' | 'mus-US' | 'mww' | 'mww-Hmnp' | 'mww-Hmnp-US' | 'my' | 'my-MM' | 'myv' | 'myv-RU' | 'mzn' | 'mzn-IR' | 'naq' | 'naq-NA' | 'nb' | 'nb-NO' | 'nb-SJ' | 'nd' | 'nd-ZW' | 'nds' | 'nds-DE' | 'nds-NL' | 'ne' | 'ne-IN' | 'ne-NP' | 'nl' | 'nl-AW' | 'nl-BE' | 'nl-BQ' | 'nl-CW' | 'nl-NL' | 'nl-SR' | 'nl-SX' | 'nmg' | 'nmg-CM' | 'nn' | 'nn-NO' | 'nnh' | 'nnh-CM' | 'no' | 'no-NO' | 'nqo' | 'nqo-GN' | 'nr' | 'nr-ZA' | 'nso' | 'nso-ZA' | 'nus' | 'nus-SS' | 'nv' | 'nv-US' | 'ny' | 'ny-MW' | 'nyn' | 'nyn-UG' | 'oc' | 'oc-ES' | 'oc-FR' | 'oka' | 'oka-CA' | 'oka-US' | 'om' | 'om-ET' | 'om-KE' | 'or' | 'or-IN' | 'os' | 'os-GE' | 'os-RU' | 'osa' | 'osa-US' | 'pa' | 'pa-Arab' | 'pa-Arab-PK' | 'pa-Guru' | 'pa-Guru-IN' | 'pap' | 'pap-AW' | 'pap-CW' | 'pcm' | 'pcm-NG' | 'pi' | 'pi-Latn' | 'pi-Latn-TH' | 'pis' | 'pis-SB' | 'pl' | 'pl-PL' | 'pms' | 'pms-IT' | 'prg' | 'prg-001' | 'ps' | 'ps-AF' | 'ps-PK' | 'pt' | 'pt-AO' | 'pt-BR' | 'pt-CH' | 'pt-CV' | 'pt-GQ' | 'pt-GW' | 'pt-LU' | 'pt-MO' | 'pt-MZ' | 'pt-PT' | 'pt-ST' | 'pt-TL' | 'qu' | 'qu-BO' | 'qu-EC' | 'qu-PE' | 'quc' | 'quc-GT' | 'raj' | 'raj-IN' | 'rhg' | 'rhg-Rohg' | 'rhg-Rohg-BD' | 'rhg-Rohg-MM' | 'rif' | 'rif-MA' | 'rm' | 'rm-CH' | 'rn' | 'rn-BI' | 'ro' | 'ro-MD' | 'ro-RO' | 'rof' | 'rof-TZ' | 'root' | 'ru' | 'ru-BY' | 'ru-KG' | 'ru-KZ' | 'ru-MD' | 'ru-RU' | 'ru-UA' | 'rw' | 'rw-RW' | 'rwk' | 'rwk-TZ' | 'sa' | 'sa-IN' | 'sah' | 'sah-RU' | 'saq' | 'saq-KE' | 'sat' | 'sat-Deva' | 'sat-Deva-IN' | 'sat-Olck' | 'sat-Olck-IN' | 'sbp' | 'sbp-TZ' | 'sc' | 'sc-IT' | 'scn' | 'scn-IT' | 'sd' | 'sd-Arab' | 'sd-Arab-PK' | 'sd-Deva' | 'sd-Deva-IN' | 'sdh' | 'sdh-IQ' | 'sdh-IR' | 'se' | 'se-FI' | 'se-NO' | 'se-SE' | 'seh' | 'seh-MZ' | 'ses' | 'ses-ML' | 'sg' | 'sg-CF' | 'sgs' | 'sgs-LT' | 'shi' | 'shi-Latn' | 'shi-Latn-MA' | 'shi-Tfng' | 'shi-Tfng-MA' | 'shn' | 'shn-MM' | 'shn-TH' | 'si' | 'si-LK' | 'sid' | 'sid-ET' | 'sk' | 'sk-SK' | 'skr' | 'skr-PK' | 'sl' | 'sl-SI' | 'sma' | 'sma-NO' | 'sma-SE' | 'smj' | 'smj-NO' | 'smj-SE' | 'smn' | 'smn-FI' | 'sms' | 'sms-FI' | 'sn' | 'sn-ZW' | 'so' | 'so-DJ' | 'so-ET' | 'so-KE' | 'so-SO' | 'sq' | 'sq-AL' | 'sq-MK' | 'sq-XK' | 'sr' | 'sr-Cyrl' | 'sr-Cyrl-BA' | 'sr-Cyrl-ME' | 'sr-Cyrl-RS' | 'sr-Cyrl-XK' | 'sr-Latn' | 'sr-Latn-BA' | 'sr-Latn-ME' | 'sr-Latn-RS' | 'sr-Latn-XK' | 'ss' | 'ss-SZ' | 'ss-ZA' | 'ssy' | 'ssy-ER' | 'st' | 'st-LS' | 'st-ZA' | 'su' | 'su-Latn' | 'su-Latn-ID' | 'suz' | 'suz-Deva' | 'suz-Deva-NP' | 'suz-Sunu' | 'suz-Sunu-NP' | 'sv' | 'sv-AX' | 'sv-FI' | 'sv-SE' | 'sw' | 'sw-CD' | 'sw-KE' | 'sw-TZ' | 'sw-UG' | 'syr' | 'syr-IQ' | 'syr-SY' | 'szl' | 'szl-PL' | 'ta' | 'ta-IN' | 'ta-LK' | 'ta-MY' | 'ta-SG' | 'te' | 'te-IN' | 'teo' | 'teo-KE' | 'teo-UG' | 'tg' | 'tg-TJ' | 'th' | 'th-TH' | 'ti' | 'ti-ER' | 'ti-ET' | 'tig' | 'tig-ER' | 'tk' | 'tk-TM' | 'tn' | 'tn-BW' | 'tn-ZA' | 'to' | 'to-TO' | 'tok' | 'tok-001' | 'tpi' | 'tpi-PG' | 'tr' | 'tr-CY' | 'tr-TR' | 'trv' | 'trv-TW' | 'trw' | 'trw-PK' | 'ts' | 'ts-ZA' | 'tt' | 'tt-RU' | 'twq' | 'twq-NE' | 'tyv' | 'tyv-RU' | 'tzm' | 'tzm-MA' | 'ug' | 'ug-CN' | 'uk' | 'uk-UA' | 'und' | 'ur' | 'ur-IN' | 'ur-PK' | 'uz' | 'uz-Arab' | 'uz-Arab-AF' | 'uz-Cyrl' | 'uz-Cyrl-UZ' | 'uz-Latn' | 'uz-Latn-UZ' | 'vai' | 'vai-Latn' | 'vai-Latn-LR' | 'vai-Vaii' | 'vai-Vaii-LR' | 've' | 've-ZA' | 'vec' | 'vec-IT' | 'vi' | 'vi-VN' | 'vmw' | 'vmw-MZ' | 'vo' | 'vo-001' | 'vun' | 'vun-TZ' | 'wa' | 'wa-BE' | 'wae' | 'wae-CH' | 'wal' | 'wal-ET' | 'wbp' | 'wbp-AU' | 'wo' | 'wo-SN' | 'xh' | 'xh-ZA' | 'xnr' | 'xnr-IN' | 'xog' | 'xog-UG' | 'yav' | 'yav-CM' | 'yi' | 'yi-001' | 'yo' | 'yo-BJ' | 'yo-NG' | 'yrl' | 'yrl-BR' | 'yrl-CO' | 'yrl-VE' | 'yue' | 'yue-Hans' | 'yue-Hans-CN' | 'yue-Hant' | 'yue-Hant-CN' | 'yue-Hant-HK' | 'yue-Hant-MO' | 'za' | 'za-CN' | 'zgh' | 'zgh-MA' | 'zh' | 'zh-Hans' | 'zh-Hans-CN' | 'zh-Hans-HK' | 'zh-Hans-MO' | 'zh-Hans-MY' | 'zh-Hans-SG' | 'zh-Hant' | 'zh-Hant-HK' | 'zh-Hant-MO' | 'zh-Hant-MY' | 'zh-Hant-TW' | 'zh-Latn' | 'zh-Latn-CN' | 'zu' | 'zu-ZA';
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/dictionary.d.ts
|
|
22
|
-
type Dictionary = Record<string, string>;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/translator.d.ts
|
|
25
|
-
type Translator = ({ dictionary, locale, projectLocale }: {
|
|
26
|
-
dictionary: Dictionary;
|
|
27
|
-
locale: Locale;
|
|
28
|
-
projectLocale: Locale;
|
|
29
|
-
}) => Promise<Dictionary>;
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/config.d.ts
|
|
32
|
-
/**
|
|
33
|
-
* Configuration for Terai
|
|
34
|
-
*/
|
|
35
|
-
type Config = {
|
|
36
|
-
/**
|
|
37
|
-
* List of files glob to to look for your locale declarations
|
|
38
|
-
*/
|
|
39
|
-
include: string[];
|
|
40
|
-
/**
|
|
41
|
-
* List of files glob to ignore
|
|
42
|
-
*/
|
|
43
|
-
exclude?: string[];
|
|
44
|
-
/**
|
|
45
|
-
* The output directory for your locale system
|
|
46
|
-
*/
|
|
47
|
-
outDir: string;
|
|
48
|
-
/**
|
|
49
|
-
* The base locale used in your project messages
|
|
50
|
-
*/
|
|
51
|
-
projectLocale: Locale;
|
|
52
|
-
/**
|
|
53
|
-
* The aditional locales you want to support
|
|
54
|
-
*/
|
|
55
|
-
outLocales: Locale[];
|
|
56
|
-
/**
|
|
57
|
-
* The translator for your messages
|
|
58
|
-
*/
|
|
59
|
-
translator: Translator;
|
|
60
|
-
};
|
|
61
|
-
//#endregion
|
|
62
|
-
export { Translator as i, Dictionary as n, Locale as r, Config as t };
|
|
63
|
-
//# sourceMappingURL=index-DTSqS4fv.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DTSqS4fv.d.mts","names":[],"sources":["../../types/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;KAiBY;;;KAGA,aAAa;;;KAKb,gBAAgB,YAAY,QAAQ;EAC9C,YAAY;EACZ,QAAQ;EACR,eAAe;MACX,QAAQ;;;;;;KAMF;;;;EAIV;;;;EAIA;;;;EAIA;;;;EAIA,eAAe;;;;EAIf,YAAY;;;;EAIZ,YAAY"}
|