@kong-ui-public/i18n 0.3.4 → 0.3.5-pr.231.5cbb2de.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/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # @kong-ui-public/i18n
2
2
 
3
3
  - [Purpose](#purpose)
4
+ - [TypeScript Support](#typescript-support)
5
+ - [Global Registration](#global-registration)
6
+ - [Vue Plugin](#vue-plugin)
4
7
  - [Use in application](#use-in-application)
5
8
  - [Use in shared component](#use-in-shared-component)
6
9
  - [Formatting messages](#formatting-messages)
@@ -19,6 +22,52 @@ This is a wrapper around [FormatJS](https://formatjs.io/docs/intl) that allows c
19
22
  - format numbers
20
23
  - format dates
21
24
 
25
+ ## TypeScript Support
26
+
27
+ In order to provide full autocompletion for the translation keys, you need to pass the type of the `messages` object to the various init functions, as shown here:
28
+
29
+ > **Note**: type checking and autocompletion are still a work-in-progress when utilizing the `i18n-t` component.
30
+ >
31
+
32
+ ### Global Registration
33
+
34
+ ```ts
35
+ // main.ts
36
+ import { createI18n, Translation } from '@kong-ui-public/i18n'
37
+ import english from './locales/en.json'
38
+
39
+ const i18n = createI18n<typeof english>('en-us', english, true)
40
+ app.use(Translation, { i18n })
41
+
42
+ // composables/index.ts
43
+ import { useI18n as useI18nComposable } from '@kong-ui-public/i18n'
44
+ import english from './locales/en.json'
45
+
46
+
47
+ const useI18n = useI18nComposable<typeof english>
48
+
49
+ export default {
50
+ useI18n,
51
+ }
52
+
53
+ // Component.vue
54
+ import composables from './composables'
55
+ const i18n = composables.useI18n()
56
+ ```
57
+
58
+ ### Vue Plugin
59
+
60
+ ```ts
61
+ import { Translation, createI18n } from '@kong-ui-public/i18n'
62
+ import english from './locales/en.json'
63
+
64
+ const i18n = createI18n<typeof english>('en-us', english, true)
65
+ const app = createApp(App)
66
+ app.use(Translation, { i18n })
67
+
68
+ app.mount('#app')
69
+ ```
70
+
22
71
  ## Use in application
23
72
 
24
73
  When used in application we only need to instantiate `Intl` object once, during application hydration, and then we can use it anywhere in the app via `useI18n` composable.
@@ -32,7 +81,7 @@ import english from './locales/en.json'
32
81
  ...
33
82
 
34
83
  // this will create Application instance of Intl object
35
- createI18n('en-us', english, true)
84
+ createI18n<typeof english>('en-us', english, true)
36
85
  ```
37
86
 
38
87
  And then, anywhere in application code where `i18n` is needed:
@@ -48,7 +97,6 @@ const i18n = useI18n()
48
97
  </script>
49
98
  ```
50
99
 
51
-
52
100
  ## Use in shared component
53
101
 
54
102
  When used in [shared component](https://github.com/Kong/shared-ui-components/pull/118/files#diff-f296a0775f650cac9ecd4b5d7ccef015ca73587be833b40eeae1e396426b0f4fR45) (outside of application code), we need `Intl` that is local to that component, so that it is using component's own localization strings:
@@ -66,7 +114,7 @@ import english from '../locales/en.json'
66
114
 
67
115
  // this will instantiate `Intl` local to this component, using component's english messages.
68
116
  // TODO: load and pass messages based on language passed from consuming application
69
- const i18n = createI18n(props.locale || 'en-us', english)
117
+ const i18n = createI18n<typeof english>(props.locale || 'en-us', english)
70
118
  </script>
71
119
  ```
72
120
 
@@ -185,7 +233,7 @@ import english from './locales/en.json'
185
233
  ...
186
234
 
187
235
  //this will create Application instance of Intl object
188
- const i18n = createI18n('en-us', english, true)
236
+ const i18n = createI18n<typeof english>('en-us', english, true)
189
237
  // this will register <i18n-t> component
190
238
  app.use(Translation, { i18n })
191
239
  ```
@@ -249,7 +297,6 @@ And then, anywhere in application code where `i18n` is needed
249
297
 
250
298
  In some cases we do not have access to the Vue `app` and cannot relay on registered i18nT plugin. Working on standalone components in `public-ui-components` is of those cases. And for this your component will look like:
251
299
 
252
-
253
300
  ```html
254
301
  <template>
255
302
  <i18n-t
@@ -263,8 +310,8 @@ In some cases we do not have access to the Vue `app` and cannot relay on registe
263
310
  import { createI18n, i18nTComponent } from '@kong-ui-public/i18n'
264
311
  import english from './locales/en.json'
265
312
 
266
- const i18n = createI18n('en-us', english)
267
- const i18nT = i18nTComponent(i18n)
313
+ const i18n = createI18n<typeof english>('en-us', english)
314
+ const i18nT = i18nTComponent<typeof english>(i18n)
268
315
 
269
316
  </script>
270
317
  ```
@@ -289,10 +336,10 @@ Or in old `defineComponent` way
289
336
  import english from './locales/en.json'
290
337
 
291
338
  export default defineComponent({
292
- components: { i18nT: i18nTComponent() },
339
+ components: { i18nT: i18nTComponent<typeof english>() },
293
340
  setup() {
294
341
  return {
295
- i18n: createI18n('en-us', english)
342
+ i18n: createI18n<typeof english>('en-us', english)
296
343
  }
297
344
  }
298
345
  })
package/dist/i18n.es.js CHANGED
@@ -41,10 +41,10 @@ function O(e, t, n) {
41
41
  (a || !(r in t)) && (a || (a = Array.prototype.slice.call(t, 0, r)), a[r] = t[r]);
42
42
  return e.concat(a || Array.prototype.slice.call(t));
43
43
  }
44
- var g;
44
+ var p;
45
45
  (function(e) {
46
46
  e[e.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", e[e.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", e[e.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", e[e.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", e[e.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", e[e.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", e[e.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", e[e.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", e[e.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", e[e.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", e[e.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", e[e.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", e[e.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", e[e.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", e[e.INVALID_TAG = 23] = "INVALID_TAG", e[e.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", e[e.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", e[e.UNCLOSED_TAG = 27] = "UNCLOSED_TAG";
47
- })(g || (g = {}));
47
+ })(p || (p = {}));
48
48
  var d;
49
49
  (function(e) {
50
50
  e[e.literal = 0] = "literal", e[e.argument = 1] = "argument", e[e.number = 2] = "number", e[e.date = 3] = "date", e[e.time = 4] = "time", e[e.select = 5] = "select", e[e.plural = 6] = "plural", e[e.pound = 7] = "pound", e[e.tag = 8] = "tag";
@@ -330,13 +330,13 @@ function tt(e) {
330
330
  case "integer-width":
331
331
  if (i.options.length > 1)
332
332
  throw new RangeError("integer-width stems only accept a single optional option");
333
- i.options[0].replace(Ke, function(h, l, u, f, c, p) {
333
+ i.options[0].replace(Ke, function(h, l, u, f, c, g) {
334
334
  if (l)
335
335
  t.minimumIntegerDigits = u.length;
336
336
  else {
337
337
  if (f && c)
338
338
  throw new Error("We currently do not support maximum integer digits");
339
- if (p)
339
+ if (g)
340
340
  throw new Error("We currently do not support exact integer digits");
341
341
  }
342
342
  return "";
@@ -350,8 +350,8 @@ function tt(e) {
350
350
  if (oe.test(i.stem)) {
351
351
  if (i.options.length > 1)
352
352
  throw new RangeError("Fraction-precision stems only accept a single optional option");
353
- i.stem.replace(oe, function(h, l, u, f, c, p) {
354
- return u === "*" ? t.minimumFractionDigits = l.length : f && f[0] === "#" ? t.maximumFractionDigits = f.length : c && p ? (t.minimumFractionDigits = c.length, t.maximumFractionDigits = c.length + p.length) : (t.minimumFractionDigits = l.length, t.maximumFractionDigits = l.length), "";
353
+ i.stem.replace(oe, function(h, l, u, f, c, g) {
354
+ return u === "*" ? t.minimumFractionDigits = l.length : f && f[0] === "#" ? t.maximumFractionDigits = f.length : c && g ? (t.minimumFractionDigits = c.length, t.maximumFractionDigits = c.length + g.length) : (t.minimumFractionDigits = l.length, t.maximumFractionDigits = l.length), "";
355
355
  });
356
356
  var a = i.options[0];
357
357
  a === "w" ? t = m(m({}, t), { trailingZeroDisplay: "stripIfInteger" }) : a && (t = m(m({}, t), se(a)));
@@ -1877,7 +1877,7 @@ var bt = (
1877
1877
  } else if (a === 60 && !this.ignoreTag && this.peek() === 47) {
1878
1878
  if (r)
1879
1879
  break;
1880
- return this.error(g.UNMATCHED_CLOSING_TAG, v(this.clonePosition(), this.clonePosition()));
1880
+ return this.error(p.UNMATCHED_CLOSING_TAG, v(this.clonePosition(), this.clonePosition()));
1881
1881
  } else if (a === 60 && !this.ignoreTag && $(this.peek() || 0)) {
1882
1882
  var o = this.parseTag(t, n);
1883
1883
  if (o.err)
@@ -1912,9 +1912,9 @@ var bt = (
1912
1912
  var o = a.val, s = this.clonePosition();
1913
1913
  if (this.bumpIf("</")) {
1914
1914
  if (this.isEOF() || !$(this.char()))
1915
- return this.error(g.INVALID_TAG, v(s, this.clonePosition()));
1915
+ return this.error(p.INVALID_TAG, v(s, this.clonePosition()));
1916
1916
  var h = this.clonePosition(), l = this.parseTagName();
1917
- return i !== l ? this.error(g.UNMATCHED_CLOSING_TAG, v(h, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? {
1917
+ return i !== l ? this.error(p.UNMATCHED_CLOSING_TAG, v(h, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? {
1918
1918
  val: {
1919
1919
  type: d.tag,
1920
1920
  value: i,
@@ -1922,11 +1922,11 @@ var bt = (
1922
1922
  location: v(r, this.clonePosition())
1923
1923
  },
1924
1924
  err: null
1925
- } : this.error(g.INVALID_TAG, v(s, this.clonePosition())));
1925
+ } : this.error(p.INVALID_TAG, v(s, this.clonePosition())));
1926
1926
  } else
1927
- return this.error(g.UNCLOSED_TAG, v(r, this.clonePosition()));
1927
+ return this.error(p.UNCLOSED_TAG, v(r, this.clonePosition()));
1928
1928
  } else
1929
- return this.error(g.INVALID_TAG, v(r, this.clonePosition()));
1929
+ return this.error(p.INVALID_TAG, v(r, this.clonePosition()));
1930
1930
  }, e.prototype.parseTagName = function() {
1931
1931
  var t = this.offset();
1932
1932
  for (this.bump(); !this.isEOF() && dt(this.char()); )
@@ -2001,14 +2001,14 @@ var bt = (
2001
2001
  }, e.prototype.parseArgument = function(t, n) {
2002
2002
  var r = this.clonePosition();
2003
2003
  if (this.bump(), this.bumpSpace(), this.isEOF())
2004
- return this.error(g.EXPECT_ARGUMENT_CLOSING_BRACE, v(r, this.clonePosition()));
2004
+ return this.error(p.EXPECT_ARGUMENT_CLOSING_BRACE, v(r, this.clonePosition()));
2005
2005
  if (this.char() === 125)
2006
- return this.bump(), this.error(g.EMPTY_ARGUMENT, v(r, this.clonePosition()));
2006
+ return this.bump(), this.error(p.EMPTY_ARGUMENT, v(r, this.clonePosition()));
2007
2007
  var i = this.parseIdentifierIfPossible().value;
2008
2008
  if (!i)
2009
- return this.error(g.MALFORMED_ARGUMENT, v(r, this.clonePosition()));
2009
+ return this.error(p.MALFORMED_ARGUMENT, v(r, this.clonePosition()));
2010
2010
  if (this.bumpSpace(), this.isEOF())
2011
- return this.error(g.EXPECT_ARGUMENT_CLOSING_BRACE, v(r, this.clonePosition()));
2011
+ return this.error(p.EXPECT_ARGUMENT_CLOSING_BRACE, v(r, this.clonePosition()));
2012
2012
  switch (this.char()) {
2013
2013
  case 125:
2014
2014
  return this.bump(), {
@@ -2021,9 +2021,9 @@ var bt = (
2021
2021
  err: null
2022
2022
  };
2023
2023
  case 44:
2024
- return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(g.EXPECT_ARGUMENT_CLOSING_BRACE, v(r, this.clonePosition())) : this.parseArgumentOptions(t, n, i, r);
2024
+ return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(p.EXPECT_ARGUMENT_CLOSING_BRACE, v(r, this.clonePosition())) : this.parseArgumentOptions(t, n, i, r);
2025
2025
  default:
2026
- return this.error(g.MALFORMED_ARGUMENT, v(r, this.clonePosition()));
2026
+ return this.error(p.MALFORMED_ARGUMENT, v(r, this.clonePosition()));
2027
2027
  }
2028
2028
  }, e.prototype.parseIdentifierIfPossible = function() {
2029
2029
  var t = this.clonePosition(), n = this.offset(), r = Y(this.message, n), i = n + r.length;
@@ -2034,7 +2034,7 @@ var bt = (
2034
2034
  var a, o = this.clonePosition(), s = this.parseIdentifierIfPossible().value, h = this.clonePosition();
2035
2035
  switch (s) {
2036
2036
  case "":
2037
- return this.error(g.EXPECT_ARGUMENT_TYPE, v(o, h));
2037
+ return this.error(p.EXPECT_ARGUMENT_TYPE, v(o, h));
2038
2038
  case "number":
2039
2039
  case "date":
2040
2040
  case "time": {
@@ -2047,9 +2047,9 @@ var bt = (
2047
2047
  return f;
2048
2048
  var c = vt(f.val);
2049
2049
  if (c.length === 0)
2050
- return this.error(g.EXPECT_ARGUMENT_STYLE, v(this.clonePosition(), this.clonePosition()));
2051
- var p = v(u, this.clonePosition());
2052
- l = { style: c, styleLocation: p };
2050
+ return this.error(p.EXPECT_ARGUMENT_STYLE, v(this.clonePosition(), this.clonePosition()));
2051
+ var g = v(u, this.clonePosition());
2052
+ l = { style: c, styleLocation: g };
2053
2053
  }
2054
2054
  var b = this.tryParseArgumentClose(i);
2055
2055
  if (b.err)
@@ -2065,7 +2065,7 @@ var bt = (
2065
2065
  };
2066
2066
  } else {
2067
2067
  if (y.length === 0)
2068
- return this.error(g.EXPECT_DATE_TIME_SKELETON, E);
2068
+ return this.error(p.EXPECT_DATE_TIME_SKELETON, E);
2069
2069
  var x = y;
2070
2070
  this.locale && (x = rt(y, this.locale));
2071
2071
  var c = {
@@ -2095,14 +2095,14 @@ var bt = (
2095
2095
  case "select": {
2096
2096
  var T = this.clonePosition();
2097
2097
  if (this.bumpSpace(), !this.bumpIf(","))
2098
- return this.error(g.EXPECT_SELECT_ARGUMENT_OPTIONS, v(T, m({}, T)));
2098
+ return this.error(p.EXPECT_SELECT_ARGUMENT_OPTIONS, v(T, m({}, T)));
2099
2099
  this.bumpSpace();
2100
2100
  var D = this.parseIdentifierIfPossible(), L = 0;
2101
2101
  if (s !== "select" && D.value === "offset") {
2102
2102
  if (!this.bumpIf(":"))
2103
- return this.error(g.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, v(this.clonePosition(), this.clonePosition()));
2103
+ return this.error(p.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, v(this.clonePosition(), this.clonePosition()));
2104
2104
  this.bumpSpace();
2105
- var f = this.tryParseDecimalInteger(g.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, g.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
2105
+ var f = this.tryParseDecimalInteger(p.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, p.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
2106
2106
  if (f.err)
2107
2107
  return f;
2108
2108
  this.bumpSpace(), D = this.parseIdentifierIfPossible(), L = f.val;
@@ -2135,10 +2135,10 @@ var bt = (
2135
2135
  };
2136
2136
  }
2137
2137
  default:
2138
- return this.error(g.INVALID_ARGUMENT_TYPE, v(o, h));
2138
+ return this.error(p.INVALID_ARGUMENT_TYPE, v(o, h));
2139
2139
  }
2140
2140
  }, e.prototype.tryParseArgumentClose = function(t) {
2141
- return this.isEOF() || this.char() !== 125 ? this.error(g.EXPECT_ARGUMENT_CLOSING_BRACE, v(t, this.clonePosition())) : (this.bump(), { val: !0, err: null });
2141
+ return this.isEOF() || this.char() !== 125 ? this.error(p.EXPECT_ARGUMENT_CLOSING_BRACE, v(t, this.clonePosition())) : (this.bump(), { val: !0, err: null });
2142
2142
  }, e.prototype.parseSimpleArgStyleIfPossible = function() {
2143
2143
  for (var t = 0, n = this.clonePosition(); !this.isEOF(); ) {
2144
2144
  var r = this.char();
@@ -2147,7 +2147,7 @@ var bt = (
2147
2147
  this.bump();
2148
2148
  var i = this.clonePosition();
2149
2149
  if (!this.bumpUntil("'"))
2150
- return this.error(g.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, v(i, this.clonePosition()));
2150
+ return this.error(p.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, v(i, this.clonePosition()));
2151
2151
  this.bump();
2152
2152
  break;
2153
2153
  }
@@ -2179,7 +2179,7 @@ var bt = (
2179
2179
  try {
2180
2180
  r = Ye(t);
2181
2181
  } catch {
2182
- return this.error(g.INVALID_NUMBER_SKELETON, n);
2182
+ return this.error(p.INVALID_NUMBER_SKELETON, n);
2183
2183
  }
2184
2184
  return {
2185
2185
  val: {
@@ -2195,7 +2195,7 @@ var bt = (
2195
2195
  if (l.length === 0) {
2196
2196
  var f = this.clonePosition();
2197
2197
  if (n !== "select" && this.bumpIf("=")) {
2198
- var c = this.tryParseDecimalInteger(g.EXPECT_PLURAL_ARGUMENT_SELECTOR, g.INVALID_PLURAL_ARGUMENT_SELECTOR);
2198
+ var c = this.tryParseDecimalInteger(p.EXPECT_PLURAL_ARGUMENT_SELECTOR, p.INVALID_PLURAL_ARGUMENT_SELECTOR);
2199
2199
  if (c.err)
2200
2200
  return c;
2201
2201
  u = v(f, this.clonePosition()), l = this.message.slice(f.offset, this.offset());
@@ -2203,26 +2203,26 @@ var bt = (
2203
2203
  break;
2204
2204
  }
2205
2205
  if (h.has(l))
2206
- return this.error(n === "select" ? g.DUPLICATE_SELECT_ARGUMENT_SELECTOR : g.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, u);
2206
+ return this.error(n === "select" ? p.DUPLICATE_SELECT_ARGUMENT_SELECTOR : p.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, u);
2207
2207
  l === "other" && (o = !0), this.bumpSpace();
2208
- var p = this.clonePosition();
2208
+ var g = this.clonePosition();
2209
2209
  if (!this.bumpIf("{"))
2210
- return this.error(n === "select" ? g.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : g.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, v(this.clonePosition(), this.clonePosition()));
2210
+ return this.error(n === "select" ? p.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : p.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, v(this.clonePosition(), this.clonePosition()));
2211
2211
  var b = this.parseMessage(t + 1, n, r);
2212
2212
  if (b.err)
2213
2213
  return b;
2214
- var E = this.tryParseArgumentClose(p);
2214
+ var E = this.tryParseArgumentClose(g);
2215
2215
  if (E.err)
2216
2216
  return E;
2217
2217
  s.push([
2218
2218
  l,
2219
2219
  {
2220
2220
  value: b.val,
2221
- location: v(p, this.clonePosition())
2221
+ location: v(g, this.clonePosition())
2222
2222
  }
2223
2223
  ]), h.add(l), this.bumpSpace(), a = this.parseIdentifierIfPossible(), l = a.value, u = a.location;
2224
2224
  }
2225
- return s.length === 0 ? this.error(n === "select" ? g.EXPECT_SELECT_ARGUMENT_SELECTOR : g.EXPECT_PLURAL_ARGUMENT_SELECTOR, v(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !o ? this.error(g.MISSING_OTHER_CLAUSE, v(this.clonePosition(), this.clonePosition())) : { val: s, err: null };
2225
+ return s.length === 0 ? this.error(n === "select" ? p.EXPECT_SELECT_ARGUMENT_SELECTOR : p.EXPECT_PLURAL_ARGUMENT_SELECTOR, v(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !o ? this.error(p.MISSING_OTHER_CLAUSE, v(this.clonePosition(), this.clonePosition())) : { val: s, err: null };
2226
2226
  }, e.prototype.tryParseDecimalInteger = function(t, n) {
2227
2227
  var r = 1, i = this.clonePosition();
2228
2228
  this.bumpIf("+") || this.bumpIf("-") && (r = -1);
@@ -2328,7 +2328,7 @@ function xt(e, t) {
2328
2328
  t === void 0 && (t = {}), t = m({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, t);
2329
2329
  var n = new bt(e, t).parse();
2330
2330
  if (n.err) {
2331
- var r = SyntaxError(g[n.err.kind]);
2331
+ var r = SyntaxError(p[n.err.kind]);
2332
2332
  throw r.location = n.err.location, r.originalMessage = n.err.message, r;
2333
2333
  }
2334
2334
  return t != null && t.captureLocation || K(n.val), n.val;
@@ -2475,26 +2475,26 @@ function V(e, t, n, r, i, a, o) {
2475
2475
  continue;
2476
2476
  }
2477
2477
  if (de(u)) {
2478
- var p = typeof u.style == "string" ? r.date[u.style] : q(u.style) ? u.style.parsedOptions : void 0;
2478
+ var g = typeof u.style == "string" ? r.date[u.style] : q(u.style) ? u.style.parsedOptions : void 0;
2479
2479
  s.push({
2480
2480
  type: I.literal,
2481
- value: n.getDateTimeFormat(t, p).format(c)
2481
+ value: n.getDateTimeFormat(t, g).format(c)
2482
2482
  });
2483
2483
  continue;
2484
2484
  }
2485
2485
  if (ye(u)) {
2486
- var p = typeof u.style == "string" ? r.time[u.style] : q(u.style) ? u.style.parsedOptions : r.time.medium;
2486
+ var g = typeof u.style == "string" ? r.time[u.style] : q(u.style) ? u.style.parsedOptions : r.time.medium;
2487
2487
  s.push({
2488
2488
  type: I.literal,
2489
- value: n.getDateTimeFormat(t, p).format(c)
2489
+ value: n.getDateTimeFormat(t, g).format(c)
2490
2490
  });
2491
2491
  continue;
2492
2492
  }
2493
2493
  if (Ee(u)) {
2494
- var p = typeof u.style == "string" ? r.number[u.style] : Ie(u.style) ? u.style.parsedOptions : void 0;
2495
- p && p.scale && (c = c * (p.scale || 1)), s.push({
2494
+ var g = typeof u.style == "string" ? r.number[u.style] : Ie(u.style) ? u.style.parsedOptions : void 0;
2495
+ g && g.scale && (c = c * (g.scale || 1)), s.push({
2496
2496
  type: I.literal,
2497
- value: n.getNumberFormat(t, p).format(c)
2497
+ value: n.getNumberFormat(t, g).format(c)
2498
2498
  });
2499
2499
  continue;
2500
2500
  }
@@ -2923,7 +2923,7 @@ function pe(e, t) {
2923
2923
  return m(m(m({}, n), e), { date: ge(j(n.date, t), j(e.date || {}, t)), time: ge(j(n.time, t), j(e.time || {}, t)) });
2924
2924
  }
2925
2925
  var ve = function(e, t, n, r, i) {
2926
- var a = e.locale, o = e.formats, s = e.messages, h = e.defaultLocale, l = e.defaultFormats, u = e.fallbackOnEmptyString, f = e.onError, c = e.timeZone, p = e.defaultRichTextElements;
2926
+ var a = e.locale, o = e.formats, s = e.messages, h = e.defaultLocale, l = e.defaultFormats, u = e.fallbackOnEmptyString, f = e.onError, c = e.timeZone, g = e.defaultRichTextElements;
2927
2927
  n === void 0 && (n = { id: "" });
2928
2928
  var b = n.id, E = n.defaultMessage;
2929
2929
  Vt(!!b, "[@formatjs/intl] An `id` must be provided to format a message. You can either:\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\nto autofix this issue");
@@ -2935,9 +2935,9 @@ var ve = function(e, t, n, r, i) {
2935
2935
  );
2936
2936
  if (Array.isArray(x) && x.length === 1 && x[0].type === d.literal)
2937
2937
  return x[0].value;
2938
- if (!r && x && typeof x == "string" && !p)
2938
+ if (!r && x && typeof x == "string" && !g)
2939
2939
  return x.replace(/'\{(.*?)\}'/gi, "{$1}");
2940
- if (r = m(m({}, p), r || {}), o = pe(o, c), l = pe(l, c), !x) {
2940
+ if (r = m(m({}, g), r || {}), o = pe(o, c), l = pe(l, c), !x) {
2941
2941
  if (u === !1 && x === "")
2942
2942
  return x;
2943
2943
  if ((!E || a && a.toLowerCase() !== h.toLowerCase()) && f(new Dt(n, a)), E)
@@ -3227,7 +3227,7 @@ function F(e, t) {
3227
3227
  const n = t.delimiter || ".", r = t.maxDepth, i = t.transformKey || Ue, a = {};
3228
3228
  function o(s, h, l) {
3229
3229
  l = l || 1, Object.keys(s).forEach(function(u) {
3230
- const f = s[u], c = t.safe && Array.isArray(f), p = Object.prototype.toString.call(f), b = Ge(f), E = p === "[object Object]" || p === "[object Array]", y = h ? h + n + i(u) : i(u);
3230
+ const f = s[u], c = t.safe && Array.isArray(f), g = Object.prototype.toString.call(f), b = Ge(f), E = g === "[object Object]" || g === "[object Array]", y = h ? h + n + i(u) : i(u);
3231
3231
  if (!c && !b && E && Object.keys(f).length && (!t.maxDepth || l < r))
3232
3232
  return o(f, y, l + 1);
3233
3233
  a[y] = f;
@@ -3245,16 +3245,16 @@ function je(e, t) {
3245
3245
  return isNaN(f) || u.indexOf(".") !== -1 || t.object ? u : f;
3246
3246
  }
3247
3247
  function h(u, f, c) {
3248
- return Object.keys(c).reduce(function(p, b) {
3249
- return p[u + n + b] = c[b], p;
3248
+ return Object.keys(c).reduce(function(g, b) {
3249
+ return g[u + n + b] = c[b], g;
3250
3250
  }, f);
3251
3251
  }
3252
3252
  function l(u) {
3253
- const f = Object.prototype.toString.call(u), c = f === "[object Array]", p = f === "[object Object]";
3253
+ const f = Object.prototype.toString.call(u), c = f === "[object Array]", g = f === "[object Object]";
3254
3254
  if (u) {
3255
3255
  if (c)
3256
3256
  return !u.length;
3257
- if (p)
3257
+ if (g)
3258
3258
  return !Object.keys(u).length;
3259
3259
  } else
3260
3260
  return !0;
@@ -3268,14 +3268,14 @@ function je(e, t) {
3268
3268
  );
3269
3269
  }, {}), Object.keys(e).forEach(function(u) {
3270
3270
  const f = u.split(n).map(i);
3271
- let c = s(f.shift()), p = s(f[0]), b = a;
3272
- for (; p !== void 0; ) {
3271
+ let c = s(f.shift()), g = s(f[0]), b = a;
3272
+ for (; g !== void 0; ) {
3273
3273
  if (c === "__proto__")
3274
3274
  return;
3275
3275
  const E = Object.prototype.toString.call(b[c]), y = E === "[object Object]" || E === "[object Array]";
3276
3276
  if (!r && !y && typeof b[c] < "u")
3277
3277
  return;
3278
- (r && !y || !r && b[c] == null) && (b[c] = typeof p == "number" && !t.object ? [] : {}), b = b[c], f.length > 0 && (c = s(f.shift()), p = s(f[0]));
3278
+ (r && !y || !r && b[c] == null) && (b[c] = typeof g == "number" && !t.object ? [] : {}), b = b[c], f.length > 0 && (c = s(f.shift()), g = s(f[0]));
3279
3279
  }
3280
3280
  b[c] = je(e[u], t);
3281
3281
  }), a;
@@ -3292,14 +3292,14 @@ const gr = (e, t, n = !1) => {
3292
3292
  })
3293
3293
  },
3294
3294
  fr
3295
- ), s = {
3296
- t: (h, l, u) => r.formatMessage({ id: h }, l, u),
3297
- te: (h) => !!r.messages[h],
3298
- tm: (h) => r.messages[h] || [],
3299
- ...r,
3295
+ ), { $t: i, ...a } = r, o = a, u = {
3296
+ t: (f, c, g) => o.formatMessage({ id: f }, c, g),
3297
+ te: (f) => !!o.messages[f],
3298
+ tm: (f) => o.messages[f] || [],
3299
+ ...o,
3300
3300
  source: t
3301
3301
  };
3302
- return n && (Ve = s), s;
3302
+ return n && (Ve = u), u;
3303
3303
  };
3304
3304
  function pr() {
3305
3305
  return Ve;
@@ -3313,6 +3313,7 @@ const cr = (e = null) => ke({
3313
3313
  },
3314
3314
  keypath: {
3315
3315
  type: String,
3316
+ // type: String as unknown as PropType<PathToDotNotation<MessageSource, string>>, // This breaks the type interface, enable to debug
3316
3317
  required: !0
3317
3318
  },
3318
3319
  tag: {