@juit/vue-i18n 0.4.0 → 1.0.0

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.d.ts CHANGED
@@ -1,29 +1,27 @@
1
1
  import { App } from 'vue';
2
2
 
3
- /** Base translations, either required when languages are set or all optional */
3
+ /** Base languages are required for a configured subset; otherwise all are optional. */
4
4
  declare type BaseTranslation = ISOLanguage extends Language ? {
5
- readonly [key in ISOLanguage]?: string;
5
+ readonly [key in ISOLanguage]?: TranslationMessage;
6
6
  } : {
7
- readonly [key in Language]: string;
7
+ readonly [key in Language]: TranslationMessage;
8
8
  };
9
9
 
10
10
  /**
11
- * The date input type for date and time translation
11
+ * Accepted inputs for date and time formatting.
12
12
  *
13
- * When the input is a non-empty `string`, or a `number`, it will be constructed
14
- * into a `Date` object before being formatted.
13
+ * A non-empty string or a number is passed to the `Date` constructor before
14
+ * formatting. Numbers represent milliseconds since the Unix epoch.
15
15
  *
16
- * When the input is `null`, `undefined`, or an empty string, formatted result
17
- * will be a simple empty string.
16
+ * A `null`, `undefined`, or empty string input produces an empty string.
18
17
  */
19
18
  export declare type DateInput = Date | string | number | null | undefined;
20
19
 
21
20
  /**
22
- * All known date and time formats aliases.
21
+ * Supported date and time format aliases.
23
22
  *
24
- * When the `I18nConfig` interface is properly merged with and its contains
25
- * the `dateTimeFormats` property, this type will represent the list of
26
- * date and time formats available to the `d(...)` method.
23
+ * `I18nConfiguration.dateTimeFormats` defines the custom aliases accepted
24
+ * by `d(...)`. Built-in aliases remain available.
27
25
  *
28
26
  * When left unconfigured, this type will be `string`.
29
27
  */
@@ -43,14 +41,14 @@ export declare type DateTimeFormatAlias = ExtractConfig<I18nConfiguration, strin
43
41
  * long: { dateStyle: 'long', timeStyle: 'long' },
44
42
  * full: { dateStyle: 'full', timeStyle: 'full' },
45
43
  *
46
- * // date only formats
44
+ * // Formats for dates only
47
45
  * date: { dateStyle: 'medium' },
48
46
  * shortDate: { dateStyle: 'short' },
49
47
  * mediumDate: { dateStyle: 'medium' },
50
48
  * longDate: { dateStyle: 'long' },
51
49
  * fullDate: { dateStyle: 'full' },
52
50
  *
53
- * // time only formats
51
+ * // Formats for times only
54
52
  * time: { timeStyle: 'medium' },
55
53
  * shortTime: { timeStyle: 'short' },
56
54
  * mediumTime: { timeStyle: 'medium' },
@@ -63,15 +61,15 @@ export declare interface DateTimeFormats {
63
61
  readonly [key: string]: Intl.DateTimeFormatOptions;
64
62
  }
65
63
 
66
- /** The language or locale to use at construction */
64
+ /** The initial language or locale; only its language and region are retained. */
67
65
  export declare type DefaultLanguage = ISOLanguage | `${ISOLanguage}-${string}` | Intl.Locale;
68
66
 
69
- /** Extended translations, supporting multiple region of each language */
67
+ /** Optional regional variants of each supported language. */
70
68
  declare type ExtendedTranslation = {
71
- readonly [key in `${Language}-${string}`]?: string;
69
+ readonly [key in `${Language}-${string}`]?: TranslationMessage;
72
70
  };
73
71
 
74
- /** Extract the value associated with key `K` from type `T` if it extends `R`, otherwise return `R` */
72
+ /** Extract `T[K]` when present and assignable to `R`; otherwise fall back to `R`. */
75
73
  declare type ExtractConfig<T, R, K extends string> = T extends {
76
74
  [X in K]: infer V;
77
75
  } ? V extends R ? V : R : R;
@@ -80,24 +78,24 @@ declare type ExtractConfig<T, R, K extends string> = T extends {
80
78
  export declare function i18n(app: App, optionsOrLanguage: Language | I18nOptions): App;
81
79
 
82
80
  /**
83
- * I18n Configuration interface (to be merged with the actual configuration).
81
+ * Application configuration types, supplied through declaration merging.
84
82
  *
85
83
  * This interface (intentionally empty) is used to merge the actual per-app
86
84
  * configuration of the translation system, in order to provide the correct
87
85
  * types to the rest of the system.
88
86
  *
89
- * Two properties are expected to be defined in the configuration:
87
+ * The following properties can be defined as unions of string literals:
90
88
  *
91
- * * `languages`: the list of supported languages for the application. Those
92
- * are ISO 639-1 language codes, and when specified, _every_
93
- * translation _must_ include a translation for each.
94
- * * `translationKeys`: the list of translation keys known by the application.
89
+ * * `languages`: the supported ISO 639-1 language codes. When configured
90
+ * with a subset of codes, each translation must include
91
+ * a message for every base language in that subset.
92
+ * * `translationKeys`: the translation keys known by the application.
95
93
  * Those are the arbitrary keys used to identify the
96
- * messages to be translated with the `t` and `tc`
94
+ * messages to be translated with the `t` and `tc`
97
95
  * methods of `Translator`.
98
- * * `dateTimeFormats`: the date and time formats _aliases_ used by the
96
+ * * `dateTimeFormats`: the date and time format _aliases_ used by the
99
97
  * application.
100
- * * `numberFormats`: the number formats _aliases_ used by the application.
98
+ * * `numberFormats`: the number format _aliases_ used by the application.
101
99
  *
102
100
  * To configure the types, follow the example below:
103
101
  *
@@ -145,30 +143,30 @@ export declare interface I18nOptions {
145
143
  numberFormats?: NumberFormats;
146
144
  }
147
145
 
148
- /** Type guard to check if a value is a valid ISO-3166-1 country code */
146
+ /** Check whether a value is a country code in ISO_COUNTRIES, including XK. */
149
147
  export declare function isISOCountry(value: unknown): value is ISOCountry;
150
148
 
151
- /** Type guard to check if a value is a valid ISO-4217 currency code */
149
+ /** Check runtime currency support; the static type may differ from the runtime's codes. */
152
150
  export declare function isISOCurrency(value: unknown): value is ISOCurrency;
153
151
 
154
- /** Type guard to check if a value is a valid ISO-639-1 language code */
152
+ /** Check whether a value is an ISO 639-1 language code in ISO_LANGUAGES. */
155
153
  export declare function isISOLanguage(value: unknown): value is ISOLanguage;
156
154
 
157
- /** The array of all known ISO-3166-1 countries */
158
- export declare const ISO_COUNTRIES: ISOCountry[];
155
+ /** Frozen, sorted ISO 3166-1 country codes, plus the CLDR code XK for Kosovo. */
156
+ export declare const ISO_COUNTRIES: readonly (keyof ISOCountries)[];
159
157
 
160
- /** The array of all known ISO-639-1 languages */
161
- export declare const ISO_CURRENCIES: ISOCurrency[];
158
+ /** Frozen currency codes reported by the runtime; these may differ from the static reference type. */
159
+ export declare const ISO_CURRENCIES: readonly (keyof ISOCurrencies)[];
162
160
 
163
- /** The array of all known ISO-639-1 languages */
164
- export declare const ISO_LANGUAGES: ISOLanguage[];
161
+ /** Frozen, sorted array of ISO 639-1 language codes. */
162
+ export declare const ISO_LANGUAGES: readonly (keyof ISOLanguages)[];
165
163
 
166
- /** All known ISO-3166-1 countries and their names */
164
+ /** Reference country codes and names, including the CLDR code XK for Kosovo. */
167
165
  export declare type ISOCountries = {
168
166
  AD: 'Andorra';
169
167
  AE: 'United Arab Emirates';
170
168
  AF: 'Afghanistan';
171
- AG: 'Antigua & Barbuda';
169
+ AG: 'Antigua and Barbuda';
172
170
  AI: 'Anguilla';
173
171
  AL: 'Albania';
174
172
  AM: 'Armenia';
@@ -181,7 +179,7 @@ export declare type ISOCountries = {
181
179
  AW: 'Aruba';
182
180
  AX: 'Åland Islands';
183
181
  AZ: 'Azerbaijan';
184
- BA: 'Bosnia & Herzegovina';
182
+ BA: 'Bosnia and Herzegovina';
185
183
  BB: 'Barbados';
186
184
  BD: 'Bangladesh';
187
185
  BE: 'Belgium';
@@ -190,11 +188,11 @@ export declare type ISOCountries = {
190
188
  BH: 'Bahrain';
191
189
  BI: 'Burundi';
192
190
  BJ: 'Benin';
193
- BL: 'St. Barthélemy';
191
+ BL: 'Saint Barthélemy';
194
192
  BM: 'Bermuda';
195
- BN: 'Brunei';
196
- BO: 'Bolivia';
197
- BQ: 'Caribbean Netherlands';
193
+ BN: 'Brunei Darussalam';
194
+ BO: 'Bolivia (Plurinational State of)';
195
+ BQ: 'Bonaire, Sint Eustatius and Saba';
198
196
  BR: 'Brazil';
199
197
  BS: 'Bahamas';
200
198
  BT: 'Bhutan';
@@ -204,9 +202,9 @@ export declare type ISOCountries = {
204
202
  BZ: 'Belize';
205
203
  CA: 'Canada';
206
204
  CC: 'Cocos (Keeling) Islands';
207
- CD: 'Congo - Kinshasa';
205
+ CD: 'Congo (Democratic Republic of the)';
208
206
  CF: 'Central African Republic';
209
- CG: 'Congo - Brazzaville';
207
+ CG: 'Congo';
210
208
  CH: 'Switzerland';
211
209
  CI: 'Côte d\'Ivoire';
212
210
  CK: 'Cook Islands';
@@ -216,7 +214,7 @@ export declare type ISOCountries = {
216
214
  CO: 'Colombia';
217
215
  CR: 'Costa Rica';
218
216
  CU: 'Cuba';
219
- CV: 'Cape Verde';
217
+ CV: 'Cabo Verde';
220
218
  CW: 'Curaçao';
221
219
  CX: 'Christmas Island';
222
220
  CY: 'Cyprus';
@@ -236,12 +234,12 @@ export declare type ISOCountries = {
236
234
  ET: 'Ethiopia';
237
235
  FI: 'Finland';
238
236
  FJ: 'Fiji';
239
- FK: 'Falkland Islands';
240
- FM: 'Micronesia';
237
+ FK: 'Falkland Islands (Malvinas)';
238
+ FM: 'Micronesia (Federated States of)';
241
239
  FO: 'Faroe Islands';
242
240
  FR: 'France';
243
241
  GA: 'Gabon';
244
- GB: 'United Kingdom';
242
+ GB: 'United Kingdom of Great Britain and Northern Ireland';
245
243
  GD: 'Grenada';
246
244
  GE: 'Georgia';
247
245
  GF: 'French Guiana';
@@ -254,13 +252,13 @@ export declare type ISOCountries = {
254
252
  GP: 'Guadeloupe';
255
253
  GQ: 'Equatorial Guinea';
256
254
  GR: 'Greece';
257
- GS: 'South Georgia & South Sandwich Islands';
255
+ GS: 'South Georgia and the South Sandwich Islands';
258
256
  GT: 'Guatemala';
259
257
  GU: 'Guam';
260
258
  GW: 'Guinea-Bissau';
261
259
  GY: 'Guyana';
262
- HK: 'Hong Kong SAR China';
263
- HM: 'Heard & McDonald Islands';
260
+ HK: 'Hong Kong';
261
+ HM: 'Heard Island and McDonald Islands';
264
262
  HN: 'Honduras';
265
263
  HR: 'Croatia';
266
264
  HT: 'Haiti';
@@ -272,7 +270,7 @@ export declare type ISOCountries = {
272
270
  IN: 'India';
273
271
  IO: 'British Indian Ocean Territory';
274
272
  IQ: 'Iraq';
275
- IR: 'Iran';
273
+ IR: 'Iran (Islamic Republic of)';
276
274
  IS: 'Iceland';
277
275
  IT: 'Italy';
278
276
  JE: 'Jersey';
@@ -284,15 +282,15 @@ export declare type ISOCountries = {
284
282
  KH: 'Cambodia';
285
283
  KI: 'Kiribati';
286
284
  KM: 'Comoros';
287
- KN: 'St. Kitts & Nevis';
288
- KP: 'North Korea';
289
- KR: 'South Korea';
285
+ KN: 'Saint Kitts and Nevis';
286
+ KP: 'Korea (Democratic People\'s Republic of)';
287
+ KR: 'Korea (Republic of)';
290
288
  KW: 'Kuwait';
291
289
  KY: 'Cayman Islands';
292
290
  KZ: 'Kazakhstan';
293
- LA: 'Laos';
291
+ LA: 'Lao People\'s Democratic Republic';
294
292
  LB: 'Lebanon';
295
- LC: 'St. Lucia';
293
+ LC: 'Saint Lucia';
296
294
  LI: 'Liechtenstein';
297
295
  LK: 'Sri Lanka';
298
296
  LR: 'Liberia';
@@ -303,16 +301,16 @@ export declare type ISOCountries = {
303
301
  LY: 'Libya';
304
302
  MA: 'Morocco';
305
303
  MC: 'Monaco';
306
- MD: 'Moldova';
304
+ MD: 'Moldova (Republic of)';
307
305
  ME: 'Montenegro';
308
- MF: 'St. Martin';
306
+ MF: 'Saint Martin (French part)';
309
307
  MG: 'Madagascar';
310
308
  MH: 'Marshall Islands';
311
- MK: 'North Macedonia';
309
+ MK: 'Macedonia (the former Yugoslav Republic of)';
312
310
  ML: 'Mali';
313
- MM: 'Myanmar (Burma)';
311
+ MM: 'Myanmar';
314
312
  MN: 'Mongolia';
315
- MO: 'Macao SAR China';
313
+ MO: 'Macao';
316
314
  MP: 'Northern Mariana Islands';
317
315
  MQ: 'Martinique';
318
316
  MR: 'Mauritania';
@@ -344,10 +342,10 @@ export declare type ISOCountries = {
344
342
  PH: 'Philippines';
345
343
  PK: 'Pakistan';
346
344
  PL: 'Poland';
347
- PM: 'St. Pierre & Miquelon';
348
- PN: 'Pitcairn Islands';
345
+ PM: 'Saint Pierre and Miquelon';
346
+ PN: 'Pitcairn';
349
347
  PR: 'Puerto Rico';
350
- PS: 'Palestinian Territories';
348
+ PS: 'Palestine, State of';
351
349
  PT: 'Portugal';
352
350
  PW: 'Palau';
353
351
  PY: 'Paraguay';
@@ -355,7 +353,7 @@ export declare type ISOCountries = {
355
353
  RE: 'Réunion';
356
354
  RO: 'Romania';
357
355
  RS: 'Serbia';
358
- RU: 'Russia';
356
+ RU: 'Russian Federation';
359
357
  RW: 'Rwanda';
360
358
  SA: 'Saudi Arabia';
361
359
  SB: 'Solomon Islands';
@@ -363,9 +361,9 @@ export declare type ISOCountries = {
363
361
  SD: 'Sudan';
364
362
  SE: 'Sweden';
365
363
  SG: 'Singapore';
366
- SH: 'St. Helena';
364
+ SH: 'Saint Helena, Ascension and Tristan da Cunha';
367
365
  SI: 'Slovenia';
368
- SJ: 'Svalbard & Jan Mayen';
366
+ SJ: 'Svalbard and Jan Mayen';
369
367
  SK: 'Slovakia';
370
368
  SL: 'Sierra Leone';
371
369
  SM: 'San Marino';
@@ -373,12 +371,12 @@ export declare type ISOCountries = {
373
371
  SO: 'Somalia';
374
372
  SR: 'Suriname';
375
373
  SS: 'South Sudan';
376
- ST: 'São Tomé & Príncipe';
374
+ ST: 'Sao Tome and Principe';
377
375
  SV: 'El Salvador';
378
- SX: 'Sint Maarten';
379
- SY: 'Syria';
380
- SZ: 'Eswatini';
381
- TC: 'Turks & Caicos Islands';
376
+ SX: 'Sint Maarten (Dutch part)';
377
+ SY: 'Syrian Arab Republic';
378
+ SZ: 'Swaziland';
379
+ TC: 'Turks and Caicos Islands';
382
380
  TD: 'Chad';
383
381
  TF: 'French Southern Territories';
384
382
  TG: 'Togo';
@@ -389,25 +387,25 @@ export declare type ISOCountries = {
389
387
  TM: 'Turkmenistan';
390
388
  TN: 'Tunisia';
391
389
  TO: 'Tonga';
392
- TR: 'Türkiye';
393
- TT: 'Trinidad & Tobago';
390
+ TR: 'Turkey';
391
+ TT: 'Trinidad and Tobago';
394
392
  TV: 'Tuvalu';
395
- TW: 'Taiwan';
396
- TZ: 'Tanzania';
393
+ TW: 'Taiwan, Province of China[a]';
394
+ TZ: 'Tanzania, United Republic of';
397
395
  UA: 'Ukraine';
398
396
  UG: 'Uganda';
399
- UM: 'U.S. Outlying Islands';
400
- US: 'United States';
397
+ UM: 'United States Minor Outlying Islands';
398
+ US: 'United States of America';
401
399
  UY: 'Uruguay';
402
400
  UZ: 'Uzbekistan';
403
- VA: 'Vatican City';
404
- VC: 'St. Vincent & Grenadines';
405
- VE: 'Venezuela';
406
- VG: 'British Virgin Islands';
407
- VI: 'U.S. Virgin Islands';
408
- VN: 'Vietnam';
401
+ VA: 'Holy See';
402
+ VC: 'Saint Vincent and the Grenadines';
403
+ VE: 'Venezuela (Bolivarian Republic of)';
404
+ VG: 'Virgin Islands (British)';
405
+ VI: 'Virgin Islands (U.S.)';
406
+ VN: 'Viet Nam';
409
407
  VU: 'Vanuatu';
410
- WF: 'Wallis & Futuna';
408
+ WF: 'Wallis and Futuna';
411
409
  WS: 'Samoa';
412
410
  XK: 'Kosovo';
413
411
  YE: 'Yemen';
@@ -417,10 +415,10 @@ export declare type ISOCountries = {
417
415
  ZW: 'Zimbabwe';
418
416
  };
419
417
 
420
- /** Array of all known ISO-3166-1 country names */
418
+ /** Country code union derived from the reference table, including XK. */
421
419
  export declare type ISOCountry = keyof ISOCountries;
422
420
 
423
- /** All known ISO-4217 currencies and their name */
421
+ /** Static reference currency codes and their names. */
424
422
  export declare type ISOCurrencies = {
425
423
  AED: 'United Arab Emirates Dirham';
426
424
  AFN: 'Afghan Afghani';
@@ -545,6 +543,7 @@ export declare type ISOCurrencies = {
545
543
  SEK: 'Swedish Krona';
546
544
  SGD: 'Singapore Dollar';
547
545
  SHP: 'St. Helena Pound';
546
+ SLE: 'Sierra Leonean Leone';
548
547
  SLL: 'Sierra Leonean Leone (1964—2022)';
549
548
  SOS: 'Somali Shilling';
550
549
  SRD: 'Surinamese Dollar';
@@ -573,6 +572,7 @@ export declare type ISOCurrencies = {
573
572
  WST: 'Samoan Tala';
574
573
  XAF: 'Central African CFA Franc';
575
574
  XCD: 'East Caribbean Dollar';
575
+ XCG: 'Caribbean Guilder';
576
576
  XDR: 'Special Drawing Rights';
577
577
  XOF: 'West African CFA Franc';
578
578
  XPF: 'CFP Franc';
@@ -580,19 +580,20 @@ export declare type ISOCurrencies = {
580
580
  YER: 'Yemeni Rial';
581
581
  ZAR: 'South African Rand';
582
582
  ZMW: 'Zambian Kwacha';
583
+ ZWG: 'Zimbabwe Gold';
583
584
  ZWL: 'Zimbabwean Dollar (2009)';
584
585
  };
585
586
 
586
- /** All known ISO-4217 currency codes */
587
+ /** Currency code union derived from the static reference table. */
587
588
  export declare type ISOCurrency = keyof ISOCurrencies;
588
589
 
589
- /** All known ISO-639-1 language codes */
590
+ /** Language code union derived from the reference table. */
590
591
  export declare type ISOLanguage = keyof ISOLanguages;
591
592
 
592
- /** All known ISO-639-1 languages and their name */
593
+ /** ISO 639-1 language codes and their names. */
593
594
  export declare type ISOLanguages = {
594
595
  aa: 'Afar';
595
- ab: 'Abkhazian';
596
+ ab: 'Abkhaz';
596
597
  ae: 'Avestan';
597
598
  af: 'Afrikaans';
598
599
  ak: 'Akan';
@@ -606,11 +607,11 @@ export declare type ISOLanguages = {
606
607
  ba: 'Bashkir';
607
608
  be: 'Belarusian';
608
609
  bg: 'Bulgarian';
609
- bh: 'Bhojpuri';
610
+ bh: 'Bihari';
610
611
  bi: 'Bislama';
611
612
  bm: 'Bambara';
612
- bn: 'Bangla';
613
- bo: 'Tibetan';
613
+ bn: 'Bengali, Bangla';
614
+ bo: 'Tibetan Standard, Tibetan, Central';
614
615
  br: 'Breton';
615
616
  bs: 'Bosnian';
616
617
  ca: 'Catalan';
@@ -619,39 +620,39 @@ export declare type ISOLanguages = {
619
620
  co: 'Corsican';
620
621
  cr: 'Cree';
621
622
  cs: 'Czech';
622
- cu: 'Church Slavic';
623
+ cu: 'Old Church Slavonic, Church Slavonic, Old Bulgarian';
623
624
  cv: 'Chuvash';
624
625
  cy: 'Welsh';
625
626
  da: 'Danish';
626
627
  de: 'German';
627
- dv: 'Divehi';
628
+ dv: 'Divehi, Dhivehi, Maldivian';
628
629
  dz: 'Dzongkha';
629
630
  ee: 'Ewe';
630
- el: 'Greek';
631
+ el: 'Greek (modern)';
631
632
  en: 'English';
632
633
  eo: 'Esperanto';
633
634
  es: 'Spanish';
634
635
  et: 'Estonian';
635
636
  eu: 'Basque';
636
- fa: 'Persian';
637
- ff: 'Fula';
637
+ fa: 'Persian (Farsi)';
638
+ ff: 'Fula, Fulah, Pulaar, Pular';
638
639
  fi: 'Finnish';
639
640
  fj: 'Fijian';
640
641
  fo: 'Faroese';
641
642
  fr: 'French';
642
643
  fy: 'Western Frisian';
643
644
  ga: 'Irish';
644
- gd: 'Scottish Gaelic';
645
+ gd: 'Scottish Gaelic, Gaelic';
645
646
  gl: 'Galician';
646
- gn: 'Guarani';
647
+ gn: 'Guaraní';
647
648
  gu: 'Gujarati';
648
649
  gv: 'Manx';
649
650
  ha: 'Hausa';
650
- he: 'Hebrew';
651
+ he: 'Hebrew (modern)';
651
652
  hi: 'Hindi';
652
653
  ho: 'Hiri Motu';
653
654
  hr: 'Croatian';
654
- ht: 'Haitian Creole';
655
+ ht: 'Haitian, Haitian Creole';
655
656
  hu: 'Hungarian';
656
657
  hy: 'Armenian';
657
658
  hz: 'Herero';
@@ -659,7 +660,7 @@ export declare type ISOLanguages = {
659
660
  id: 'Indonesian';
660
661
  ie: 'Interlingue';
661
662
  ig: 'Igbo';
662
- ii: 'Sichuan Yi';
663
+ ii: 'Nuosu';
663
664
  ik: 'Inupiaq';
664
665
  io: 'Ido';
665
666
  is: 'Icelandic';
@@ -669,10 +670,10 @@ export declare type ISOLanguages = {
669
670
  jv: 'Javanese';
670
671
  ka: 'Georgian';
671
672
  kg: 'Kongo';
672
- ki: 'Kikuyu';
673
- kj: 'Kuanyama';
673
+ ki: 'Kikuyu, Gikuyu';
674
+ kj: 'Kwanyama, Kuanyama';
674
675
  kk: 'Kazakh';
675
- kl: 'Kalaallisut';
676
+ kl: 'Kalaallisut, Greenlandic';
676
677
  km: 'Khmer';
677
678
  kn: 'Kannada';
678
679
  ko: 'Korean';
@@ -683,9 +684,9 @@ export declare type ISOLanguages = {
683
684
  kw: 'Cornish';
684
685
  ky: 'Kyrgyz';
685
686
  la: 'Latin';
686
- lb: 'Luxembourgish';
687
+ lb: 'Luxembourgish, Letzeburgesch';
687
688
  lg: 'Ganda';
688
- li: 'Limburgish';
689
+ li: 'Limburgish, Limburgan, Limburger';
689
690
  ln: 'Lingala';
690
691
  lo: 'Lao';
691
692
  lt: 'Lithuanian';
@@ -697,45 +698,45 @@ export declare type ISOLanguages = {
697
698
  mk: 'Macedonian';
698
699
  ml: 'Malayalam';
699
700
  mn: 'Mongolian';
700
- mr: 'Marathi';
701
+ mr: 'Marathi (Marāṭhī)';
701
702
  ms: 'Malay';
702
703
  mt: 'Maltese';
703
704
  my: 'Burmese';
704
- na: 'Nauru';
705
+ na: 'Nauruan';
705
706
  nb: 'Norwegian Bokmål';
706
- nd: 'North Ndebele';
707
+ nd: 'Northern Ndebele';
707
708
  ne: 'Nepali';
708
709
  ng: 'Ndonga';
709
710
  nl: 'Dutch';
710
711
  nn: 'Norwegian Nynorsk';
711
712
  no: 'Norwegian';
712
- nr: 'South Ndebele';
713
- nv: 'Navajo';
714
- ny: 'Nyanja';
713
+ nr: 'Southern Ndebele';
714
+ nv: 'Navajo, Navaho';
715
+ ny: 'Chichewa, Chewa, Nyanja';
715
716
  oc: 'Occitan';
716
- oj: 'Ojibwa';
717
+ oj: 'Ojibwe, Ojibwa';
717
718
  om: 'Oromo';
718
- or: 'Odia';
719
- os: 'Ossetic';
720
- pa: 'Punjabi';
721
- pi: 'Pali';
719
+ or: 'Oriya';
720
+ os: 'Ossetian, Ossetic';
721
+ pa: '(Eastern) Punjabi';
722
+ pi: 'Pāli';
722
723
  pl: 'Polish';
723
- ps: 'Pashto';
724
+ ps: 'Pashto, Pushto';
724
725
  pt: 'Portuguese';
725
726
  qu: 'Quechua';
726
727
  rm: 'Romansh';
727
- rn: 'Rundi';
728
+ rn: 'Kirundi';
728
729
  ro: 'Romanian';
729
730
  ru: 'Russian';
730
731
  rw: 'Kinyarwanda';
731
- sa: 'Sanskrit';
732
+ sa: 'Sanskrit (Saṁskṛta)';
732
733
  sc: 'Sardinian';
733
734
  sd: 'Sindhi';
734
735
  se: 'Northern Sami';
735
736
  sg: 'Sango';
736
- si: 'Sinhala';
737
+ si: 'Sinhalese, Sinhala';
737
738
  sk: 'Slovak';
738
- sl: 'Slovenian';
739
+ sl: 'Slovene';
739
740
  sm: 'Samoan';
740
741
  sn: 'Shona';
741
742
  so: 'Somali';
@@ -752,13 +753,13 @@ export declare type ISOLanguages = {
752
753
  th: 'Thai';
753
754
  ti: 'Tigrinya';
754
755
  tk: 'Turkmen';
755
- tl: 'Filipino';
756
+ tl: 'Tagalog';
756
757
  tn: 'Tswana';
757
- to: 'Tongan';
758
+ to: 'Tonga (Tonga Islands)';
758
759
  tr: 'Turkish';
759
760
  ts: 'Tsonga';
760
761
  tt: 'Tatar';
761
- tw: 'Akan';
762
+ tw: 'Twi';
762
763
  ty: 'Tahitian';
763
764
  ug: 'Uyghur';
764
765
  uk: 'Ukrainian';
@@ -772,7 +773,7 @@ export declare type ISOLanguages = {
772
773
  xh: 'Xhosa';
773
774
  yi: 'Yiddish';
774
775
  yo: 'Yoruba';
775
- za: 'Zhuang';
776
+ za: 'Zhuang, Chuang';
776
777
  zh: 'Chinese';
777
778
  zu: 'Zulu';
778
779
  };
@@ -780,15 +781,65 @@ export declare type ISOLanguages = {
780
781
  /** The languages configured in `I18nConfiguration` or all ISO languages */
781
782
  export declare type Language = ExtractConfig<I18nConfiguration, ISOLanguage, 'languages'>;
782
783
 
784
+ /**
785
+ * A language matcher that determines the best matching language from a set
786
+ * of available languages.
787
+ */
788
+ export declare interface LanguageMatcher<T extends readonly [ISOLanguage, ...ISOLanguage[]]> {
789
+ /** The list of available languages, with the first one being the default */
790
+ readonly availableLanguages: Readonly<T>;
791
+ /** The default language */
792
+ readonly defaultLanguage: T[0];
793
+ /**
794
+ * Determine the best matching language from the available languages.
795
+ *
796
+ * The first supported language in the input preference order is returned.
797
+ * Empty input or an input with no matches returns the default language.
798
+ *
799
+ * All languages here will be *normalized* before matching (for example
800
+ * `en-US` will be normalized to `en`, and `JA` will be normalized to `ja`).
801
+ *
802
+ * @param languages The language or list of languages to match against the
803
+ * available languages.
804
+ * @returns The best matching language from the available languages, or the
805
+ * default language if no match is found.
806
+ */
807
+ match(languages: readonly string[] | string | undefined | null): T[number];
808
+ }
809
+
810
+ /** The {@link LanguageMatcher} constructor */
811
+ export declare const LanguageMatcher: LanguageMatcherConstructor;
812
+
813
+ declare interface LanguageMatcherConstructor {
814
+ /**
815
+ * Create a new {@link LanguageMatcher} instance matching *only* the single
816
+ * language specified.
817
+ *
818
+ * At runtime, the input is normalized. If it does not resolve to a valid
819
+ * ISO language code, an error is thrown.
820
+ */
821
+ new <L extends ISOLanguage>(availableLanguages: L): LanguageMatcher<[L]>;
822
+ /**
823
+ * Create a new {@link LanguageMatcher} instance matching the specified set
824
+ * of available languages.
825
+ *
826
+ * Typed inputs must be valid ISO language codes. At runtime, inputs are
827
+ * normalized and invalid entries are filtered out. The resulting list is
828
+ * copied, so later changes to the input array do not affect the matcher.
829
+ *
830
+ * If no valid ISO languages are provided, an error will be thrown.
831
+ */
832
+ new <const A extends readonly [ISOLanguage, ...ISOLanguage[]]>(availableLanguages: A): LanguageMatcher<A>;
833
+ }
834
+
783
835
  /** Create a _reactive_ translator object from the given options */
784
836
  export declare function makeTranslator(options: I18nOptions): Translator;
785
837
 
786
838
  /**
787
- * All known number formats aliases.
839
+ * Supported number format aliases.
788
840
  *
789
- * When the `I18nConfig` interface is properly merged with and its contains
790
- * the `numberFormats` property, this type will represent the list of
791
- * date and time formats available to the `n(...)` method.
841
+ * `I18nConfiguration.numberFormats` defines the custom aliases accepted
842
+ * by `n(...)`. The `default` alias and currency code types remain available.
792
843
  *
793
844
  * When left unconfigured, this type will be `string`.
794
845
  */
@@ -805,7 +856,7 @@ export declare type NumberFormatAlias = ExtractConfig<I18nConfiguration, string,
805
856
  * default: { }, // use the default number format
806
857
  * EUR: { style: 'currency', currency: 'EUR' },
807
858
  * USD: { style: 'currency', currency: 'USD' },
808
- * // ... all currency codes can be used as aliases
859
+ * // ... codes from ISO_CURRENCIES are available as aliases
809
860
  * }
810
861
  * ```
811
862
  */
@@ -813,7 +864,7 @@ export declare interface NumberFormats {
813
864
  readonly [key: string]: Intl.NumberFormatOptions;
814
865
  }
815
866
 
816
- /** Prettify our `Translations` exported type */
867
+ /** Expand the properties of the exported `Translation` type for editor hints. */
817
868
  declare type PrettifyTranslation<T> = {
818
869
  [l in keyof T]: T[l];
819
870
  };
@@ -821,25 +872,26 @@ declare type PrettifyTranslation<T> = {
821
872
  /**
822
873
  * A type describing the translations for a given translation key.
823
874
  *
824
- * When the `I18nConfig` interface is properly merged with and its contains
825
- * the `languages` property, this type will represent the list of required
826
- * translation keys (languages) required for each translation.
827
- *
828
- * When left unconfigured, all ISO languages will be considered as optional.
875
+ * When `I18nConfiguration.languages` specifies a subset of ISO languages,
876
+ * every base language in that subset is required. Regional variants are
877
+ * optional. When unconfigured, or configured with all ISO languages, every
878
+ * language is optional.
829
879
  */
830
880
  export declare type Translation = PrettifyTranslation<BaseTranslation & ExtendedTranslation>;
831
881
 
832
882
  /**
833
883
  * All known translation keys.
834
884
  *
835
- * When the `I18nConfig` interface is properly merged with and its contains
836
- * the `translationKeys` property, this type will represent the list of
837
- * translations keys available to the `t(...)` and `tc(...)` methods.
885
+ * `I18nConfiguration.translationKeys` restricts the keys accepted by the
886
+ * `t(...)` and `tc(...)` methods and by `utils.updateTranslations(...)`.
838
887
  *
839
888
  * When left unconfigured, this type will be `string`.
840
889
  */
841
890
  export declare type TranslationKey = ExtractConfig<I18nConfiguration, string, 'translationKeys'>;
842
891
 
892
+ /** A message with optional pipe-delimited variants, or a readonly tuple of one to three variants. */
893
+ export declare type TranslationMessage = string | readonly [string, string?, string?];
894
+
843
895
  /**
844
896
  * Parameters for the formatting of a translation.
845
897
  *
@@ -847,8 +899,8 @@ export declare type TranslationKey = ExtractConfig<I18nConfiguration, string, 't
847
899
  * translator, allowing for the interpolation of values into the translated
848
900
  * message.
849
901
  *
850
- * When the parameter value is a number, it will be formatted using the `n`
851
- * formatter before being interpolated into the message.
902
+ * Numeric values use the current locale and the `default` number format
903
+ * before being interpolated into the message.
852
904
  */
853
905
  export declare interface TranslationParams {
854
906
  [key: string]: string | number;
@@ -857,9 +909,8 @@ export declare interface TranslationParams {
857
909
  /**
858
910
  * Options to initialize the translations handled by the translation system.
859
911
  *
860
- * Shared translations are defined as a key-value pair, where the key is the
861
- * identifier of the translation, and the value is an object containing the
862
- * translations for each language.
912
+ * Each key identifies a message, and its value maps languages and regional
913
+ * variants to message strings or plural tuples.
863
914
  */
864
915
  export declare interface Translations {
865
916
  readonly [key: string]: Translation;
@@ -871,67 +922,74 @@ export declare interface Translations {
871
922
  * This interface provides methods to translate messages, format numbers, and
872
923
  * format dates and times.
873
924
  *
874
- * Configured instances can be accessed using the `useI18n()` composition
925
+ * Configured instances can be accessed using the `useTranslator()` composition
875
926
  * function, which will provide an instance of the translator.
876
927
  */
877
928
  export declare interface Translator {
878
929
  /** The current ISO-639-1 language code used by this translator. */
879
930
  language: ISOLanguage;
880
- /** The region (if any) used by thus translator to localize translations. */
931
+ /** The region (if any) used by this translator to localize translations. */
881
932
  region: ISOCountry | undefined;
882
- /** The `Locale` used by this translator (merges `language` and `region`) */
933
+ /** The current locale. Assignments retain only the language and region. */
883
934
  locale: Readonly<Intl.Locale>;
884
935
  /**
885
936
  * Return the (possibly parameterized) translation for the specified message
886
937
  * in the current language.
887
938
  *
888
- * Internally, this method uses the `tc(...)` function with `n=1`, in order to
889
- * avoid duplication of message keys
939
+ * Delegates to `tc(...)` with `n=1`. A supplied `params.n` overrides this
940
+ * count, including for plural selection.
890
941
  */
891
942
  t(key: TranslationKey | Translation, params?: TranslationParams): string;
892
943
  /**
893
944
  * Return the (possibly parameterized) translation for the specified message
894
945
  * in the current language, with pluralization.
895
946
  *
896
- * For pluralization, translation messages should be separated by the pipe
897
- * character, like in Vue I18N. Example:
947
+ * String messages can contain variants separated by unescaped pipes:
898
948
  *
899
949
  * * `" one apple | {n} apples "` when _two_ translations are separated by a
900
- * pipe, the first will be used for singular, the second for zero or plural
950
+ * pipe, the first is used for singular, and the second for zero or plural.
901
951
  * * `" no apples | one apple | {n} apples "` when _three_ translations are
902
952
  * separated by a pipe, the first will be used for zero, the second for
903
- * singular, the second for zero or plural
953
+ * singular, and the third for plural.
954
+ *
955
+ * Messages can also be readonly tuples: `[message]`, `[singular, plural]`,
956
+ * or `[zero, singular, plural]`. Pipes inside tuple elements are literal;
957
+ * placeholders and their escapes are still parsed.
904
958
  *
905
- * For convenience, the `{n}` message parameter will always be contextualized
906
- * with the number, unless overridden in the `params` themselves.
959
+ * The `{n}` parameter defaults to the supplied count. `params.n` overrides
960
+ * both its displayed value and plural selection. Zero and one select their
961
+ * respective variants; every other count selects the plural variant.
907
962
  */
908
963
  tc(key: TranslationKey | Translation, n: number, params?: TranslationParams): string;
909
964
  /**
910
- * Format a number according to the current language.
965
+ * Format a number according to the current locale.
911
966
  *
912
967
  * When `format` is provided, it will be used to configure the number format.
913
- * This can be one of the aliases specified at initialization, or a
914
- * fully-fledged `Intl.NumberFormatOptions` object.
968
+ * Accepts a built-in or custom alias, or an `Intl.NumberFormatOptions`
969
+ * object. Omitting it selects the `default` alias. A null or undefined
970
+ * value produces an empty string.
915
971
  */
916
972
  n(value?: number | bigint | null | undefined, format?: NumberFormatAlias | Intl.NumberFormatOptions): string;
917
973
  /**
918
- * Format date and time according to the current language.
974
+ * Format a date and time according to the current locale.
919
975
  *
920
976
  * When `format` is provided, it will be used to configure the date and time
921
- * format. This can be one of the aliases specified at initialization, or a
922
- * fully-fledged `Intl.DateTimeFormatOptions` object.
977
+ * format. Accepts a built-in or custom alias, or an
978
+ * `Intl.DateTimeFormatOptions` object. Omitting it selects the `default`
979
+ * alias. The explicit `timeZone` takes precedence over `format.timeZone`,
980
+ * then `defaultTimeZone`, then the runtime's time zone.
923
981
  */
924
982
  d(date?: DateInput, format?: DateTimeFormatAlias | Intl.DateTimeFormatOptions, timeZone?: string): string;
925
983
  /** Extra internationalization utilities */
926
984
  utils: {
927
985
  /**
928
986
  * Return the name of the language for the given ISO-639-1 code localized
929
- * using the current language
987
+ * using the current locale.
930
988
  */
931
989
  language(code: ISOLanguage): string;
932
990
  /**
933
991
  * Return the name of the country (or region) for the given ISO-3166-1 code
934
- * (or CLDR region code) using the current language
992
+ * (or CLDR region code) using the current locale.
935
993
  */
936
994
  country(code: ISOCountry | 'EU' | 'UN'): string;
937
995
  /**
@@ -940,13 +998,16 @@ export declare interface Translator {
940
998
  */
941
999
  flag(code: ISOCountry | 'EU' | 'UN'): string;
942
1000
  /**
943
- * Update the translations used by this translator.
1001
+ * Merge translations and clear cached templates. Empty strings and
1002
+ * undefined values are ignored; use a tuple containing an empty string
1003
+ * for an intentionally blank message. Tuples are copied before storing.
1004
+ * Updates affect subsequent calls but do not trigger reactive updates.
944
1005
  */
945
1006
  updateTranslations(translations: Partial<Record<TranslationKey, Partial<Translation>>>): void;
946
1007
  };
947
1008
  }
948
1009
 
949
- /** Retrieve the translator instance from the Vue app */
1010
+ /** Retrieve the translator from the current Vue injection context, or throw if none is provided. */
950
1011
  export declare function useTranslator(): Translator;
951
1012
 
952
1013
  export { }
@@ -961,11 +1022,11 @@ declare module 'vue' {
961
1022
  * in the current language, with pluralization.
962
1023
  */
963
1024
  $tc: Translator['tc'];
964
- /** Format a number into a string according to the current language */
1025
+ /** Format a number into a string according to the current locale. */
965
1026
  $n: Translator['n'];
966
1027
  /**
967
- * Format date and time using the specified style (defaults to `medium`)
968
- * according to the current language
1028
+ * Format a date and time using the current locale and the specified
1029
+ * format, or the configurable `default` alias when omitted.
969
1030
  */
970
1031
  $d: Translator['d'];
971
1032
  }