@oxog/i18n 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,242 +1,139 @@
1
1
  # @oxog/i18n
2
2
 
3
- A modern, lightweight, and framework-agnostic internationalization library with TypeScript support.
4
-
5
- ## Features
6
-
7
- - 🚀 **Lightweight**: Small bundle size with zero dependencies
8
- - 🔥 **Fast**: Optimized performance with memoization
9
- - 🌐 **Framework Agnostic**: Works with any JavaScript framework
10
- - 📦 **TypeScript First**: Full TypeScript support with type safety
11
- - 🔌 **Extensible**: Plugin system for custom functionality
12
- - 🎯 **Simple API**: Easy to learn and use
13
- - 💾 **Flexible Storage**: Support for multiple locale loading strategies
3
+ A small, dependency-free and framework-agnostic internationalization library with
4
+ TypeScript key checking, CLDR plural rules, fallback locales and an optional ICU
5
+ MessageFormat plugin.
14
6
 
15
7
  ## Installation
16
8
 
17
9
  ```bash
18
10
  npm install @oxog/i18n
19
- # or
20
- pnpm add @oxog/i18n
21
- # or
22
- yarn add @oxog/i18n
23
11
  ```
24
12
 
25
- ## Quick Start
13
+ Ships ESM and CommonJS builds with matching type declarations. Node.js 18+ and modern
14
+ browsers (it relies on `Intl.PluralRules`, `Intl.NumberFormat` and `structuredClone`).
26
15
 
27
- ```typescript
16
+ ## Quick start
17
+
18
+ ```ts
28
19
  import { createI18n } from '@oxog/i18n';
29
20
 
30
- // Create i18n instance
31
21
  const i18n = createI18n({
32
22
  locale: 'en',
33
23
  fallbackLocale: 'en',
34
24
  messages: {
35
- en: {
36
- greeting: 'Hello, {name}!',
37
- messages: {
38
- welcome: 'Welcome to our app'
39
- }
40
- },
41
- es: {
42
- greeting: '¡Hola, {name}!',
43
- messages: {
44
- welcome: 'Bienvenido a nuestra aplicación'
45
- }
46
- }
47
- }
25
+ en: { greeting: 'Hello, {{name}}!', messages: { welcome: 'Welcome to our app' } },
26
+ es: { greeting: '¡Hola, {{name}}!', messages: { welcome: 'Bienvenido a nuestra aplicación' } },
27
+ },
48
28
  });
49
29
 
50
- // Use translations
51
- console.log(i18n.t('greeting', { name: 'World' })); // Hello, World!
52
- console.log(i18n.t('messages.welcome')); // Welcome to our app
30
+ i18n.t('greeting', { name: 'World' }); // "Hello, World!"
31
+ i18n.t('messages.welcome'); // "Welcome to our app"
53
32
 
54
- // Change locale
55
33
  i18n.setLocale('es');
56
- console.log(i18n.t('greeting', { name: 'Mundo' })); // ¡Hola, Mundo!
34
+ i18n.t('greeting', { name: 'Mundo' }); // "¡Hola, Mundo!"
57
35
  ```
58
36
 
59
- ## API Reference
60
-
61
- ### `createI18n(options)`
62
-
63
- Creates a new i18n instance.
64
-
65
- #### Options
66
-
67
- - `locale`: Current locale (default: 'en')
68
- - `fallbackLocale`: Fallback locale when translation is missing
69
- - `messages`: Translation messages object
70
- - `plugins`: Array of plugins to use
71
- - `interpolation`: Custom interpolation options
72
- - `missing`: Custom missing translation handler
37
+ ## Options
73
38
 
74
- ### Instance Methods
39
+ | Option | Description |
40
+ | --- | --- |
41
+ | `locale` | Active locale (required). |
42
+ | `fallbackLocale` | Catalog used when a key is missing in the active locale and its base languages. |
43
+ | `messages` | `{ [locale]: catalog }`; catalogs may nest objects (`user.profile.title`). |
44
+ | `plugins` | Plugins such as `icuPlugin` or `markdownPlugin`. |
45
+ | `pluralizationRules` | Custom rules per locale or language, e.g. `{ ar: count => ... }`. |
46
+ | `formats` | Named `Intl.NumberFormat` / `Intl.DateTimeFormat` options: `{{value:number}}` uses `default`, `{{value:number:percent}}` / `{{value:date:short}}` a named one. |
47
+ | `warnOnMissingTranslations` | Log missing keys outside production. |
48
+ | `onError` | Called with errors from plugins, formatters and listeners. |
75
49
 
76
- #### `t(key, params?, options?)`
50
+ Keys are looked up BCP 47 style: the active locale, then its base languages
51
+ (`zh-Hant-TW` → `zh-Hant` → `zh`, `en-US` → `en`), then `fallbackLocale` and its base
52
+ languages. So `locale: 'en-US'` works with an `en` catalog, and `pt-BR` uses `pt` before
53
+ the fallback. A missing key returns the key itself. Lookups only use own string values: nested groups,
54
+ `constructor`, `toString` and other `Object.prototype` members are never returned as
55
+ translations, and `__proto__` keys in loaded JSON cannot modify `Object.prototype`.
77
56
 
78
- Get a translation for the given key.
79
-
80
- ```typescript
81
- i18n.t('greeting', { name: 'Alice' });
82
- i18n.t('user.profile.title');
83
- ```
84
-
85
- #### `setLocale(locale)`
86
-
87
- Change the current locale.
88
-
89
- ```typescript
90
- i18n.setLocale('fr');
91
- ```
57
+ ## Interpolation
92
58
 
93
- #### `getLocale()`
59
+ `{{name}}` placeholders are replaced with the matching parameter; unknown placeholders are
60
+ left as they are. `t()` returns plain text and does not escape HTML: render it as text (React
61
+ does) or escape it before inserting it as HTML.
94
62
 
95
- Get the current locale.
96
-
97
- ```typescript
98
- const currentLocale = i18n.getLocale(); // 'en'
99
- ```
100
-
101
- #### `hasTranslation(key, locale?)`
102
-
103
- Check if a translation exists.
104
-
105
- ```typescript
106
- if (i18n.hasTranslation('feature.title')) {
107
- // Translation exists
108
- }
109
- ```
110
-
111
- #### `addMessages(locale, messages)`
112
-
113
- Add translations for a locale.
114
-
115
- ```typescript
116
- i18n.addMessages('de', {
117
- greeting: 'Hallo, {name}!'
118
- });
119
- ```
63
+ ## Pluralization
120
64
 
121
- ## Advanced Features
122
-
123
- ### Interpolation
124
-
125
- ```typescript
126
- // Basic interpolation
127
- i18n.t('greeting', { name: 'World' }); // Hello, World!
128
-
129
- // Custom interpolation pattern
130
- const i18n = createI18n({
131
- interpolation: {
132
- prefix: '{{',
133
- suffix: '}}'
134
- }
135
- });
136
- ```
137
-
138
- ### Pluralization
139
-
140
- ```typescript
141
- const messages = {
142
- items: {
143
- zero: 'No items',
144
- one: 'One item',
145
- other: '{count} items'
146
- }
147
- };
148
-
149
- i18n.t('items', { count: 0 }); // No items
150
- i18n.t('items', { count: 1 }); // One item
151
- i18n.t('items', { count: 5 }); // 5 items
152
- ```
153
-
154
- ### Plugins
155
-
156
- ```typescript
157
- import { createI18n, ICUPlugin } from '@oxog/i18n';
65
+ Pass `count` and group the forms under the key. Categories follow the CLDR rules of the
66
+ catalog's language via `Intl.PluralRules` (`zero`, `one`, `two`, `few`, `many`, `other`), so
67
+ Russian, Polish, Arabic, Welsh and every other language select the right form. An explicit
68
+ `zero` form is used for `count: 0` when present, and `other` is the last resort.
158
69
 
70
+ ```ts
159
71
  const i18n = createI18n({
160
- plugins: [ICUPlugin()],
72
+ locale: 'ru',
161
73
  messages: {
162
- en: {
163
- greeting: 'Hello, {name}! You have {count, plural, =0 {no messages} =1 {one message} other {# messages}}.'
164
- }
165
- }
74
+ ru: { apples: { one: '{{count}} яблоко', few: '{{count}} яблока', many: '{{count}} яблок', other: '{{count}} яблока' } },
75
+ },
166
76
  });
77
+ i18n.t('apples', { count: 21 }); // "21 яблоко"
78
+ i18n.t('apples', { count: 5 }); // "5 яблок"
167
79
  ```
168
80
 
169
- ### Missing Translations
81
+ When the text comes from the fallback catalog, the fallback language's rules are used.
170
82
 
171
- ```typescript
172
- const i18n = createI18n({
173
- missing: (key, locale) => {
174
- console.warn(`Missing translation: ${key} for locale: ${locale}`);
175
- return key; // Return the key as fallback
176
- }
177
- });
178
- ```
83
+ ## ICU MessageFormat plugin
179
84
 
180
- ## TypeScript Support
85
+ ```ts
86
+ import { createI18n, icuPlugin } from '@oxog/i18n';
181
87
 
182
- ```typescript
183
- // Define your message schema
184
- type MessageSchema = {
185
- greeting: string;
186
- user: {
187
- profile: {
188
- title: string;
189
- description: string;
190
- };
191
- };
192
- };
193
-
194
- // Create typed i18n instance
195
- const i18n = createI18n<MessageSchema>({
88
+ const i18n = createI18n({
196
89
  locale: 'en',
90
+ plugins: [icuPlugin],
197
91
  messages: {
198
- en: {
199
- greeting: 'Hello!',
200
- user: {
201
- profile: {
202
- title: 'Profile',
203
- description: 'User profile page'
204
- }
205
- }
206
- }
207
- }
92
+ en: { inbox: 'Hello, {name}! You have {count, plural, =0 {no messages} one {# message} other {# messages}}.' },
93
+ },
208
94
  });
209
95
 
210
- // Now you get full type safety
211
- i18n.t('greeting'); // ✅ Valid
212
- i18n.t('user.profile.title'); // ✅ Valid
213
- i18n.t('invalid.key'); // ❌ TypeScript error
96
+ i18n.t('inbox', { name: 'Ada', count: 2 }); // "Hello, Ada! You have 2 messages."
214
97
  ```
215
98
 
216
- ## Performance
99
+ Supports named arguments, `plural`/`selectordinal` with exact selectors and `offset`, and
100
+ nested `select`. `{{name}}` interpolation keeps working.
217
101
 
218
- The library is optimized for performance with:
102
+ ## Instance API
219
103
 
220
- - Memoization of translation lookups
221
- - Efficient message traversal
222
- - Minimal bundle size
223
- - No runtime dependencies
104
+ - `t(key, params?)` – translate.
105
+ - `setLocale(locale)`, `getLocale()`, `locale`, `fallbackLocale`.
106
+ - `hasTranslation(key, locale?, { exact }?)` – whether `t()` finds a string for the key in
107
+ `locale` (default: the active locale), following the same lookup chain (base languages,
108
+ then the fallback locale). `{ exact: true }` checks only that locale's own catalog.
109
+ - `addMessages(locale, messages)` – deep-merge messages (e.g. after a lazy `import()`).
110
+ - `subscribe(listener)` – called after a locale switch, after `addMessages()` for a locale
111
+ in the lookup chain, and after `addPlugin()` / `removePlugin()`; returns an unsubscribe
112
+ function. `revision` increments on each
113
+ such change.
114
+ - `addPlugin(plugin)`, `removePlugin(name)`.
115
+ - `formatNumber(value, format?)`, `formatDate(date, format?)`, `formatRelativeTime(date, base?)`.
224
116
 
225
- ## Browser Support
117
+ ## TypeScript
226
118
 
227
- - Modern browsers (Chrome, Firefox, Safari, Edge)
228
- - Node.js 18+
119
+ Catalog types may be inferred, declared as `type`s or plain `interface`s, and nested:
229
120
 
230
- ## License
121
+ ```ts
122
+ interface MessageSchema {
123
+ greeting: string;
124
+ user: { profile: { title: string; description: string } };
125
+ }
231
126
 
232
- MIT © Ersin Koç
127
+ const i18n = createI18n<MessageSchema>({ locale: 'en', messages: { en: { /* ... */ } as MessageSchema } });
233
128
 
234
- ## Contributing
129
+ i18n.t('greeting'); // ✅
130
+ i18n.t('user.profile.title'); // ✅
131
+ i18n.t('invalid.key'); // ❌ type error
132
+ ```
235
133
 
236
- Contributions are welcome! Please read our [Contributing Guide](https://github.com/ersinkoc/i18n/blob/main/CONTRIBUTING.md) for details.
134
+ With `as const` catalogs, placeholders become required parameters
135
+ (`'Hi {{name}}'` requires `{ name }`, `{{n:number}}` requires a number).
237
136
 
238
- ## Links
137
+ ## License
239
138
 
240
- - [GitHub Repository](https://github.com/ersinkoc/i18n)
241
- - [NPM Package](https://www.npmjs.com/package/@oxog/i18n)
242
- - [Documentation](https://github.com/ersinkoc/i18n#readme)
139
+ MIT © Ersin Koç
package/dist/index.d.mts CHANGED
@@ -5,65 +5,148 @@ type ParseKeys<T> = T extends `${infer _Start}{{${infer Param}}}${infer Rest}` ?
5
5
  [K in Key]: Type extends 'number' ? number : Type extends 'boolean' ? boolean : Type extends 'date' ? Date : string;
6
6
  } & ParseKeys<Rest> : {
7
7
  [K in Param]: TranslationValue;
8
- } & ParseKeys<Rest> : {};
9
- type TranslationFunction<TMessages extends Messages> = <TKey extends keyof TMessages, TParams extends ParseKeys<TMessages[TKey]>>(key: TKey, ...args: keyof TParams extends never ? [] : [params: TParams]) => string;
10
- type Messages = Record<string, string>;
11
- type LocaleMessages<TMessages extends Messages = Messages> = Record<LocaleCode, TMessages>;
12
- interface I18nPlugin<TMessages extends Messages = Messages> {
8
+ } & ParseKeys<Rest> : object;
9
+ /**
10
+ * Shape of a translation catalog: string messages, optionally grouped in nested objects
11
+ * (`{ user: { profile: { title: '...' } } }`) or plural groups (`{ items: { one, other } }`).
12
+ */
13
+ interface MessageTree {
14
+ [key: string]: string | MessageTree;
15
+ }
16
+ /**
17
+ * Default (untyped) message catalog type. Typed catalogs may be any object type,
18
+ * including plain `interface`s without an index signature.
19
+ */
20
+ type Messages = MessageTree;
21
+ type PrevDepth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8];
22
+ type JoinKey<K extends string, P> = P extends string ? `${K}.${P}` : never;
23
+ /**
24
+ * Dotted translation keys of a catalog: leaf keys (`'user.profile.title'`) and the keys
25
+ * of nested groups (`'items'`, used for plural groups such as `{ items: { one, other } }`).
26
+ * Catalogs with a string index signature accept any string key.
27
+ */
28
+ type TranslationKey<T, Depth extends number = 8> = [Depth] extends [never] ? never : T extends string ? never : string extends keyof T ? string : {
29
+ [K in keyof T & string]: NonNullable<T[K]> extends string ? K : NonNullable<T[K]> extends object ? K | JoinKey<K, TranslationKey<NonNullable<T[K]>, PrevDepth[Depth]>> : never;
30
+ }[keyof T & string];
31
+ /** Type of the catalog entry at a dotted key. */
32
+ type TranslationValueAt<T, P extends string> = P extends keyof T ? T[P] : P extends `${infer Head}.${infer Rest}` ? Head extends keyof T ? TranslationValueAt<NonNullable<T[Head]>, Rest> : unknown : unknown;
33
+ type TranslationArgs<V> = V extends string ? keyof ParseKeys<V> extends never ? [params?: TranslationParams] : [params: ParseKeys<V> & TranslationParams] : [params?: TranslationParams];
34
+ type TranslationFunction<TMessages extends object = Messages> = <TKey extends TranslationKey<TMessages>>(key: TKey, ...args: TranslationArgs<TranslationValueAt<TMessages, TKey>>) => string;
35
+ type LocaleMessages<TMessages extends object = Messages> = Record<LocaleCode, TMessages>;
36
+ /** Recursive `Partial`, used for incremental catalogs passed to `addMessages`. */
37
+ type DeepPartial<T> = T extends string ? T : {
38
+ [K in keyof T]?: DeepPartial<T[K]>;
39
+ };
40
+ interface I18nPlugin<TMessages extends object = Messages> {
13
41
  name: string;
14
- transform?: (key: keyof TMessages, value: string, params: TranslationParams, locale: LocaleCode) => string;
42
+ /** The optional message locale identifies the catalog that supplied the text after fallback. */
43
+ transform?: (key: string, value: string, params: TranslationParams, locale: LocaleCode, messageLocale?: LocaleCode) => string;
15
44
  beforeLoad?: (locale: LocaleCode, messages: TMessages) => TMessages;
16
45
  afterLoad?: (locale: LocaleCode, messages: TMessages) => void;
17
46
  format?: (value: TranslationValue, format: string, locale: LocaleCode) => string;
47
+ /**
48
+ * Escapes every value inserted by `{{placeholder}}` interpolation. Plugins whose
49
+ * `transform` produces HTML (such as `markdownPlugin`) set it so parameters cannot inject
50
+ * markup into that HTML.
51
+ */
52
+ escapeValue?: (value: string) => string;
18
53
  }
19
- interface I18nConfig<TMessages extends Messages = Messages> {
54
+ interface I18nConfig<TMessages extends object = Messages> {
20
55
  locale: LocaleCode;
21
56
  fallbackLocale?: LocaleCode;
22
57
  messages: LocaleMessages<TMessages>;
23
58
  plugins?: I18nPlugin<TMessages>[];
24
59
  warnOnMissingTranslations?: boolean;
60
+ /**
61
+ * Custom plural rules keyed by locale or language (`'pt-BR'` or `'pt'`). They take
62
+ * precedence over the built-in CLDR rules (`Intl.PluralRules`) for those locales only.
63
+ */
25
64
  pluralizationRules?: Record<LocaleCode, (count: number) => string>;
26
65
  formats?: {
27
66
  number?: Record<string, Intl.NumberFormatOptions>;
28
67
  date?: Record<string, Intl.DateTimeFormatOptions>;
29
68
  };
69
+ onError?: (error: Error, context: string) => void;
30
70
  }
31
- interface I18nInstance<TMessages extends Messages = Messages> {
71
+ interface I18nInstance<TMessages extends object = Messages> {
32
72
  readonly locale: LocaleCode;
33
73
  readonly fallbackLocale?: LocaleCode;
34
74
  readonly messages: LocaleMessages<TMessages>;
35
75
  readonly t: TranslationFunction<TMessages>;
76
+ /**
77
+ * Incremented whenever the visible translations change (locale switch, messages added
78
+ * for a locale in the lookup chain, plugin added or removed). Useful as a snapshot for UI
79
+ * bindings.
80
+ */
81
+ readonly revision?: number;
36
82
  setLocale(locale: LocaleCode): void;
37
83
  getLocale(): LocaleCode;
38
- hasTranslation(key: keyof TMessages, locale?: LocaleCode): boolean;
39
- addMessages(locale: LocaleCode, messages: Partial<TMessages>): void;
84
+ /**
85
+ * Whether `t()` finds a string for `key` in `locale` (default: the active locale), following
86
+ * the same lookup chain: the locale, its base languages (`en-US` → `en`), then
87
+ * `fallbackLocale` and its base languages. Pass `{ exact: true }` to check only that
88
+ * locale's own catalog (e.g. to list keys still missing from a translation).
89
+ */
90
+ hasTranslation(key: TranslationKey<TMessages>, locale?: LocaleCode, options?: {
91
+ exact?: boolean;
92
+ }): boolean;
93
+ addMessages(locale: LocaleCode, messages: DeepPartial<TMessages>): void;
40
94
  addPlugin(plugin: I18nPlugin<TMessages>): void;
41
95
  removePlugin(pluginName: string): void;
42
96
  formatNumber(value: number, format?: string): string;
43
97
  formatDate(value: Date, format?: string): string;
44
98
  formatRelativeTime(value: Date, baseDate?: Date): string;
99
+ /**
100
+ * Subscribes to translation changes: called with the active locale after `setLocale`
101
+ * switches locale, after `addMessages` adds messages for a locale in the lookup chain
102
+ * (the active locale, its base languages, the fallback locale and its base languages) and
103
+ * after `addPlugin` / `removePlugin`.
104
+ */
45
105
  subscribe(listener: (locale: LocaleCode) => void): () => void;
46
106
  }
47
- type ExtractTranslationKeys<T> = T extends Messages ? keyof T : never;
48
- type ExtractTranslationParams<TMessages extends Messages, TKey extends keyof TMessages> = TMessages[TKey] extends string ? ParseKeys<TMessages[TKey]> : never;
107
+ type ExtractTranslationKeys<T> = TranslationKey<T>;
108
+ type ExtractTranslationParams<TMessages extends object, TKey extends string> = TranslationValueAt<TMessages, TKey> extends infer V ? V extends string ? ParseKeys<V> & TranslationParams : TranslationParams : TranslationParams;
49
109
 
50
- declare function createI18n<TMessages extends Messages = Messages>(config: I18nConfig<TMessages>): I18nInstance<TMessages>;
110
+ declare function createI18n<TMessages extends object = Messages>(config: I18nConfig<TMessages>): I18nInstance<TMessages>;
51
111
 
52
- declare function interpolate(template: string, params: TranslationParams, formatters?: Map<string, (value: TranslationValue, format?: string, locale?: string) => string>, locale?: string): string;
53
- declare function deepMerge<T extends Record<string, any>>(target: T, source: Partial<T>): T;
54
- declare function getNestedValue<T>(obj: Record<string, any>, path: string): T | undefined;
55
- declare function createCache<T>(): {
112
+ /**
113
+ * Replaces `{{name}}` / `{{name:format}}` placeholders with `params`. When `escape` is given
114
+ * (e.g. by a plugin that produces HTML), every inserted value is passed through it.
115
+ */
116
+ declare function interpolate(template: string, params: TranslationParams, formatters?: Map<string, (value: TranslationValue, format?: string, locale?: string) => string>, locale?: string, escape?: (value: string) => string): string;
117
+ declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
118
+ declare function getNestedValue<T>(obj: Record<string, unknown>, path: string): T | undefined;
119
+ interface CacheOptions {
120
+ maxSize?: number;
121
+ }
122
+ declare function createCache<T>(options?: CacheOptions): {
56
123
  get: (key: string) => T | undefined;
57
124
  set: (key: string, value: T) => void;
58
125
  clear: () => void;
126
+ size: () => number;
59
127
  };
128
+ /**
129
+ * @deprecated Kept for backwards compatibility. Plural categories are now resolved with
130
+ * `Intl.PluralRules` (CLDR), which covers every locale; these hand-written rules are no
131
+ * longer used by `getPluralForm` or `createI18n`.
132
+ */
60
133
  declare const defaultPluralRules: Record<string, (count: number) => string>;
134
+ /**
135
+ * Returns the CLDR plural category (`zero`, `one`, `two`, `few`, `many` or `other`)
136
+ * for `count` in `locale`.
137
+ *
138
+ * Custom rules are looked up by the exact locale first and then by its language
139
+ * subtag (`pt-BR` → `pt`); otherwise `Intl.PluralRules` decides.
140
+ */
61
141
  declare function getPluralForm(locale: string, count: number, customRules?: Record<string, (count: number) => string>): string;
62
142
 
63
143
  /**
64
- * Markdown plugin for basic markdown syntax transformation
144
+ * Markdown plugin for basic markdown syntax transformation.
65
145
  */
66
146
  declare const markdownPlugin: I18nPlugin;
147
+ /**
148
+ * ICU MessageFormat plugin for named arguments, plural forms and select branches.
149
+ */
67
150
  declare const icuPlugin: I18nPlugin;
68
151
 
69
- export { type ExtractTranslationKeys, type ExtractTranslationParams, type I18nConfig, type I18nInstance, type I18nPlugin, type LocaleCode, type LocaleMessages, type Messages, type ParseKeys, type TranslationFunction, type TranslationParams, type TranslationValue, createCache, createI18n, deepMerge, defaultPluralRules, getNestedValue, getPluralForm, icuPlugin, interpolate, markdownPlugin };
152
+ export { type CacheOptions, type DeepPartial, type ExtractTranslationKeys, type ExtractTranslationParams, type I18nConfig, type I18nInstance, type I18nPlugin, type LocaleCode, type LocaleMessages, type MessageTree, type Messages, type ParseKeys, type TranslationFunction, type TranslationKey, type TranslationParams, type TranslationValue, type TranslationValueAt, createCache, createI18n, deepMerge, defaultPluralRules, getNestedValue, getPluralForm, icuPlugin, interpolate, markdownPlugin };