@teammy/server 0.2.23 → 0.2.24
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/LICENSE +21 -0
- package/README.md +11 -7
- package/dist/main.js +20331 -13329
- package/dist/native-pi-entry.js +755 -19
- package/dist/project-pi-entry.js +758 -22
- package/dist/runtime/en/shared/system.md +9 -0
- package/dist/runtime/en/shared/tools.json +22 -0
- package/dist/runtime/en/workflows/directory-analysis/prompt.md +11 -0
- package/dist/runtime/en/workflows/file-summary/prompt.md +7 -0
- package/dist/runtime/en/workflows/session-handoff/prompt.md +31 -0
- package/dist/runtime/en/workflows/session-overview/prompt.md +26 -0
- package/dist/runtime/en/workflows/task-bootstrap/prompt.md +84 -0
- package/dist/runtime/shared/system.md +1 -1
- package/dist/runtime/workflows/session-handoff/prompt.md +1 -1
- package/dist/runtime/workflows/session-overview/prompt.md +1 -1
- package/dist/web/THIRD-PARTY-LICENSES.md +2025 -0
- package/dist/web/assets/Assistant-BeWIo88A.js +1 -0
- package/dist/web/assets/{Computers-BtcIsnDD.css → Computers-BJKv9oJv.css} +1 -1
- package/dist/web/assets/Computers-CEBC9xd4.js +14 -0
- package/dist/web/assets/Conversation-BMA0djTl.js +1 -0
- package/dist/web/assets/Dashboard-DtNpBYI5.js +1 -0
- package/dist/web/assets/Files-C-00txBh.js +1 -0
- package/dist/web/assets/Help-C5yLJzSE.js +2392 -0
- package/dist/web/assets/MessageComposer-D7ml-LaD.js +1 -0
- package/dist/web/assets/MessageComposer-DqcbXBIG.css +1 -0
- package/dist/web/assets/ResourceLibrary-Ceon9f0i.js +6 -0
- package/dist/web/assets/TerminalPane-CZYb0vIG.js +22 -0
- package/dist/web/assets/WorkspaceTree-C2sVptdG.js +1 -0
- package/dist/web/assets/file-links-CQ6ShuxD.js +1 -0
- package/dist/web/assets/index-B9gF6reY.css +1 -0
- package/dist/web/assets/index-BCj5CDtq.js +40 -0
- package/dist/web/assets/project-links-BwYckk7L.js +105 -0
- package/dist/web/assets/workflow-DR-M8YZx.svg +111 -0
- package/dist/web/downloads/teammy-inbox-skill.zip +0 -0
- package/dist/web/downloads/teammy-skill.zip +0 -0
- package/dist/web/index.html +4 -4
- package/dist/web/notification-worker.js +2 -10
- package/node_modules/i18next/LICENSE +21 -0
- package/node_modules/i18next/README.md +77 -0
- package/node_modules/i18next/dist/cjs/i18next.js +2495 -0
- package/node_modules/i18next/dist/esm/i18next.js +2505 -0
- package/node_modules/i18next/dist/esm/package.json +1 -0
- package/node_modules/i18next/dist/umd/i18next.js +2501 -0
- package/node_modules/i18next/dist/umd/i18next.min.js +1 -0
- package/node_modules/i18next/i18next.js +2501 -0
- package/node_modules/i18next/i18next.min.js +1 -0
- package/node_modules/i18next/index.d.mts +71 -0
- package/node_modules/i18next/index.d.ts +739 -0
- package/node_modules/i18next/package.json +125 -0
- package/node_modules/i18next/typescript/helpers.d.ts +73 -0
- package/node_modules/i18next/typescript/options.d.ts +871 -0
- package/node_modules/i18next/typescript/t.d.ts +1449 -0
- package/node_modules/jose/LICENSE.md +21 -0
- package/node_modules/jose/README.md +150 -0
- package/node_modules/jose/dist/types/index.d.ts +55 -0
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +25 -0
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +40 -0
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +25 -0
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +46 -0
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +29 -0
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +51 -0
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +10 -0
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +15 -0
- package/node_modules/jose/dist/types/jwks/local.d.ts +17 -0
- package/node_modules/jose/dist/types/jwks/remote.d.ts +94 -0
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +21 -0
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +25 -0
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +23 -0
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +26 -0
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +41 -0
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +31 -0
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +38 -0
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +57 -0
- package/node_modules/jose/dist/types/jwt/sign.d.ts +21 -0
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +21 -0
- package/node_modules/jose/dist/types/jwt/verify.d.ts +36 -0
- package/node_modules/jose/dist/types/key/export.d.ts +19 -0
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +33 -0
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +30 -0
- package/node_modules/jose/dist/types/key/import.d.ts +67 -0
- package/node_modules/jose/dist/types/types.d.ts +802 -0
- package/node_modules/jose/dist/types/util/base64url.d.ts +16 -0
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +9 -0
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +10 -0
- package/node_modules/jose/dist/types/util/errors.d.ts +182 -0
- package/node_modules/jose/dist/webapi/index.js +70 -0
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -0
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +26 -0
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +15 -0
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +35 -0
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +41 -0
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +105 -0
- package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -0
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +55 -0
- package/node_modules/jose/dist/webapi/jwks/local.js +60 -0
- package/node_modules/jose/dist/webapi/jwks/remote.js +103 -0
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +20 -0
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +8 -0
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +23 -0
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +12 -0
- package/node_modules/jose/dist/webapi/jws/general/sign.js +58 -0
- package/node_modules/jose/dist/webapi/jws/general/verify.js +42 -0
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -0
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +42 -0
- package/node_modules/jose/dist/webapi/jwt/sign.js +19 -0
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +34 -0
- package/node_modules/jose/dist/webapi/jwt/verify.js +13 -0
- package/node_modules/jose/dist/webapi/key/export.js +35 -0
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +35 -0
- package/node_modules/jose/dist/webapi/key/generate_secret.js +36 -0
- package/node_modules/jose/dist/webapi/key/import.js +53 -0
- package/node_modules/jose/dist/webapi/lib/asn1.js +138 -0
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +75 -0
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +90 -0
- package/node_modules/jose/dist/webapi/lib/deflate.js +41 -0
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +116 -0
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +190 -0
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +75 -0
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +74 -0
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +46 -0
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +89 -0
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +150 -0
- package/node_modules/jose/dist/webapi/lib/key.js +157 -0
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +15 -0
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +9 -0
- package/node_modules/jose/dist/webapi/lib/key_management.js +195 -0
- package/node_modules/jose/dist/webapi/lib/validate.js +122 -0
- package/node_modules/jose/dist/webapi/util/base64url.js +16 -0
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +33 -0
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +19 -0
- package/node_modules/jose/dist/webapi/util/errors.js +109 -0
- package/node_modules/jose/package.json +134 -0
- package/node_modules/oauth4webapi/LICENSE.md +21 -0
- package/node_modules/oauth4webapi/README.md +104 -0
- package/node_modules/oauth4webapi/build/index.d.ts +3046 -0
- package/node_modules/oauth4webapi/build/index.js +2530 -0
- package/node_modules/oauth4webapi/build/index.js.map +1 -0
- package/node_modules/oauth4webapi/package.json +112 -0
- package/node_modules/openid-client/LICENSE.md +21 -0
- package/node_modules/openid-client/README.md +258 -0
- package/node_modules/openid-client/build/index.d.ts +2478 -0
- package/node_modules/openid-client/build/index.js +1347 -0
- package/node_modules/openid-client/build/index.js.map +1 -0
- package/node_modules/openid-client/build/passport.d.ts +258 -0
- package/node_modules/openid-client/build/passport.js +264 -0
- package/node_modules/openid-client/build/passport.js.map +1 -0
- package/node_modules/openid-client/package.json +130 -0
- package/package.json +5 -1
- package/dist/web/assets/Assistant-Dks48Y5w.js +0 -1
- package/dist/web/assets/Computers-CaCzZeCc.js +0 -13
- package/dist/web/assets/Conversation-kAMzKADw.js +0 -1
- package/dist/web/assets/Dashboard-ComNJNOg.js +0 -1
- package/dist/web/assets/Dropdown-DGFI68Vd.js +0 -55
- package/dist/web/assets/Files-Blsq_C-B.js +0 -1
- package/dist/web/assets/Help-BM23uS-t.js +0 -1079
- package/dist/web/assets/Markdown-CXnZDm5J.js +0 -29
- package/dist/web/assets/MessageComposer-BoOgfyPA.js +0 -1
- package/dist/web/assets/MessageComposer-hKEluJsT.css +0 -1
- package/dist/web/assets/ResourceLibrary-C12_47kE.js +0 -6
- package/dist/web/assets/TerminalPane-BTRM-36z.js +0 -22
- package/dist/web/assets/WorkspaceTree-Co7XG2RG.js +0 -1
- package/dist/web/assets/file-links-CoVqmrXg.js +0 -1
- package/dist/web/assets/index-CeKzFsxV.css +0 -1
- package/dist/web/assets/index-mhJ33-bH.js +0 -10
- package/dist/web/assets/task-links-BE36-8mc.js +0 -1
- /package/dist/web/assets/{Dropdown-ktgqMqAD.css → project-links-ktgqMqAD.css} +0 -0
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
import type { $MergeBy, $PreservedValue, $Dictionary } from './helpers.js';
|
|
2
|
+
|
|
3
|
+
// Only the declarations marked `export` are public: without an export list, every declaration of a
|
|
4
|
+
// .d.ts module counts as exported, and the `_` helpers below were importable.
|
|
5
|
+
export {};
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This interface can be augmented by users to add types to `i18next` default TypeOptions.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```ts
|
|
12
|
+
* // i18next.d.ts
|
|
13
|
+
* import 'i18next';
|
|
14
|
+
* declare module 'i18next' {
|
|
15
|
+
* interface CustomTypeOptions {
|
|
16
|
+
* defaultNS: 'custom';
|
|
17
|
+
* returnNull: false;
|
|
18
|
+
* returnObjects: false;
|
|
19
|
+
* nsSeparator: ':';
|
|
20
|
+
* keySeparator: '.';
|
|
21
|
+
* allowObjectInHTMLChildren: false;
|
|
22
|
+
* resources: {
|
|
23
|
+
* custom: {
|
|
24
|
+
* foo: 'foo';
|
|
25
|
+
* };
|
|
26
|
+
* };
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export interface CustomTypeOptions {}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Per-package namespace types for monorepos. Augment this in each package's
|
|
35
|
+
* `i18next.d.ts` instead of `CustomTypeOptions.resources` when several packages
|
|
36
|
+
* need their own namespaces — otherwise TypeScript reports TS2717 on merge.
|
|
37
|
+
*
|
|
38
|
+
* Works alongside the legacy `CustomTypeOptions.resources` field; both end up
|
|
39
|
+
* in `TypeOptions['resources']`.
|
|
40
|
+
*
|
|
41
|
+
* Scalar type options like `defaultNS`, `returnNull`, `enableSelector`, etc.,
|
|
42
|
+
* still belong on `CustomTypeOptions` — this interface is for namespace
|
|
43
|
+
* resource types only.
|
|
44
|
+
*
|
|
45
|
+
* @see https://github.com/i18next/i18next/issues/2409
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* // packages/ui/i18next.d.ts
|
|
50
|
+
* declare module 'i18next' {
|
|
51
|
+
* interface ResourceNamespaceMap {
|
|
52
|
+
* '@repo/ui': typeof uiTranslations;
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export interface ResourceNamespaceMap {}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* This interface can be augmented by users to add types to `i18next` default PluginOptions.
|
|
61
|
+
*/
|
|
62
|
+
export interface CustomPluginOptions {}
|
|
63
|
+
|
|
64
|
+
type _LegacyResources = CustomTypeOptions extends { resources: infer R } ? R : object;
|
|
65
|
+
|
|
66
|
+
// Per-property merge of two object types. Unlike `L & R`, which TypeScript
|
|
67
|
+
// collapses to `never` whenever ANY property has incompatible literals (so a
|
|
68
|
+
// single same-key/different-literal conflict wipes out the whole namespace),
|
|
69
|
+
// this iterates keys and intersects them individually — the conflicting key
|
|
70
|
+
// becomes `never`, the rest survive.
|
|
71
|
+
type _PerPropMerge<L, R> = {
|
|
72
|
+
[K in keyof L | keyof R]: K extends keyof L
|
|
73
|
+
? K extends keyof R
|
|
74
|
+
? L[K] & R[K]
|
|
75
|
+
: L[K]
|
|
76
|
+
: K extends keyof R
|
|
77
|
+
? R[K]
|
|
78
|
+
: never;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Drop properties whose value resolved to `never`. Without this, the
|
|
82
|
+
// conflict key would leak into `keyof Resources[ns]`, then poison
|
|
83
|
+
// `KeysBuilder` recursion (it tries to walk a `never` value) and break
|
|
84
|
+
// `t()` overload resolution for the entire namespace.
|
|
85
|
+
// NOTE: must use the `Pick<T, NonNeverKeys>` form. A `[K in keyof T as ...]`
|
|
86
|
+
// remap does NOT eagerly evaluate `T[K]` for intersection types, so conflict
|
|
87
|
+
// keys would survive the filter.
|
|
88
|
+
type _NonNeverKeys<T> = {
|
|
89
|
+
[K in keyof T]: [T[K]] extends [never] ? never : K;
|
|
90
|
+
}[keyof T];
|
|
91
|
+
type _DropConflictKeys<T> = Pick<T, _NonNeverKeys<T>>;
|
|
92
|
+
|
|
93
|
+
// When the same namespace exists on both sides, deep-merge per property and
|
|
94
|
+
// strip same-key/different-literal conflicts. Otherwise pick from whichever
|
|
95
|
+
// side has it.
|
|
96
|
+
type _MergeNamespaces<L, R> = {
|
|
97
|
+
[K in keyof L | keyof R]: K extends keyof L
|
|
98
|
+
? K extends keyof R
|
|
99
|
+
? _DropConflictKeys<_PerPropMerge<L[K], R[K]>>
|
|
100
|
+
: L[K]
|
|
101
|
+
: K extends keyof R
|
|
102
|
+
? R[K]
|
|
103
|
+
: never;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// NOTE: empty legacy + empty registry must stay `object` so unconfigured projects
|
|
107
|
+
// still get `$IsResourcesDefined === false`.
|
|
108
|
+
type _MergedResources = [keyof _LegacyResources] extends [never]
|
|
109
|
+
? [keyof ResourceNamespaceMap] extends [never]
|
|
110
|
+
? object
|
|
111
|
+
: ResourceNamespaceMap
|
|
112
|
+
: [keyof ResourceNamespaceMap] extends [never]
|
|
113
|
+
? _LegacyResources
|
|
114
|
+
: _MergeNamespaces<_LegacyResources, ResourceNamespaceMap>;
|
|
115
|
+
|
|
116
|
+
export type TypeOptions = $MergeBy<
|
|
117
|
+
$MergeBy<
|
|
118
|
+
{
|
|
119
|
+
/** @see {InitOptions.returnNull} */
|
|
120
|
+
returnNull: false;
|
|
121
|
+
|
|
122
|
+
/** @see {InitOptions.returnEmptyString} */
|
|
123
|
+
returnEmptyString: false;
|
|
124
|
+
|
|
125
|
+
/** @see {InitOptions.returnObjects} */
|
|
126
|
+
returnObjects: false;
|
|
127
|
+
|
|
128
|
+
/** @see {InitOptions.keySeparator} */
|
|
129
|
+
keySeparator: '.';
|
|
130
|
+
|
|
131
|
+
/** @see {InitOptions.nsSeparator} */
|
|
132
|
+
nsSeparator: ':';
|
|
133
|
+
|
|
134
|
+
/** @see {InitOptions.pluralSeparator} */
|
|
135
|
+
pluralSeparator: '_';
|
|
136
|
+
|
|
137
|
+
/** @see {InitOptions.contextSeparator} */
|
|
138
|
+
contextSeparator: '_';
|
|
139
|
+
|
|
140
|
+
/** @see {InitOptions.defaultNS} */
|
|
141
|
+
defaultNS: 'translation';
|
|
142
|
+
|
|
143
|
+
/** @see {InitOptions.fallbackNS} */
|
|
144
|
+
fallbackNS: false;
|
|
145
|
+
|
|
146
|
+
/** @see {InitOptions.resources} */
|
|
147
|
+
resources: object;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Flag that allows HTML elements to receive objects. This is only useful for React applications
|
|
151
|
+
* where you pass objects to HTML elements so they can be replaced to their respective interpolation
|
|
152
|
+
* values (mostly with Trans component)
|
|
153
|
+
*/
|
|
154
|
+
allowObjectInHTMLChildren: false;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Flag that enables strict key checking even if a `defaultValue` has been provided.
|
|
158
|
+
* This ensures all calls of `t` function don't accidentally use implicitly missing keys.
|
|
159
|
+
*/
|
|
160
|
+
strictKeyChecks: false;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Flag that makes the `t()` options required for a string with interpolation
|
|
164
|
+
* variables, so that `{{name}}` cannot be left out of a call. Applies to the
|
|
165
|
+
* string-key API (with `strictKeyChecks`, also to `t(key, defaultValue)`) and
|
|
166
|
+
* to the selector API. Messages under `parseInterpolation: 'icu'` or `'mf2'`
|
|
167
|
+
* require their arguments regardless of this flag.
|
|
168
|
+
*
|
|
169
|
+
* On by default since v27; set it to `false` to keep the v26 types.
|
|
170
|
+
* @default true
|
|
171
|
+
*/
|
|
172
|
+
strictInterpolationChecks: true;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Prefix for interpolation
|
|
176
|
+
*/
|
|
177
|
+
interpolationPrefix: '{{';
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Suffix for interpolation
|
|
181
|
+
*/
|
|
182
|
+
interpolationSuffix: '}}';
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Separates the variable from its format, as in `{{price, currency}}` (since v26.7.0)
|
|
186
|
+
* @see {InterpolationOptions.formatSeparator}
|
|
187
|
+
*/
|
|
188
|
+
interpolationFormatSeparator: ',';
|
|
189
|
+
|
|
190
|
+
/** @see {InterpolationOptions.unescapePrefix} */
|
|
191
|
+
unescapePrefix: '-';
|
|
192
|
+
|
|
193
|
+
/** @see {InterpolationOptions.unescapeSuffix} */
|
|
194
|
+
unescapeSuffix: '';
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Whether to extract interpolation variables from translation strings at
|
|
198
|
+
* the type level. When `true` (default), the type system parses each
|
|
199
|
+
* resource value for `{{variable}}` patterns and types the `t()` options
|
|
200
|
+
* accordingly.
|
|
201
|
+
*
|
|
202
|
+
* Set to `false` when your translation strings use a different
|
|
203
|
+
* interpolation syntax that the i18next type extractor cannot understand
|
|
204
|
+
* — e.g. ICU MessageFormat plurals like `{count, plural, one {{count} row}
|
|
205
|
+
* other {{count} rows}}` would otherwise produce phantom variable names
|
|
206
|
+
* because the default extractor naively matches the outermost `{{` …
|
|
207
|
+
* `}}`. This flag is type-only; runtime interpolation is governed by
|
|
208
|
+
* `InterpolationOptions` and is unaffected.
|
|
209
|
+
*
|
|
210
|
+
* Set to `'icu'` with `i18next-icu` to type `t()` options from the ICU
|
|
211
|
+
* MessageFormat arguments instead: `{name}` takes `string | number`,
|
|
212
|
+
* `{n, number}`, `plural` and `selectordinal` take `number`, `{d, date}`
|
|
213
|
+
* and `{t, time}` take `Date`, `select` takes its case keys or any string
|
|
214
|
+
* (for `other`), and arguments nested in cases are required too.
|
|
215
|
+
* `interpolationFormatTypeMap` overrides a type by its format name (e.g.
|
|
216
|
+
* `date: Date | number`). Options become required for a message with
|
|
217
|
+
* arguments.
|
|
218
|
+
*
|
|
219
|
+
* Set to `'mf2'` with `i18next-mf2` to type `t()` options from the
|
|
220
|
+
* MessageFormat 2 variables: `{$name}` takes `string | number`, a
|
|
221
|
+
* variable annotated with `:number`, `:integer`, `:currency`, `:percent`
|
|
222
|
+
* or `:unit` (directly or through `.input`/`.local`) takes `number`,
|
|
223
|
+
* `:datetime`, `:date` and `:time` take `Date`, `:string` takes `string`,
|
|
224
|
+
* option and markup variables (`minimumFractionDigits=$digits`,
|
|
225
|
+
* `{#link href=$url}`) take `string | number`, and `.local` variables are
|
|
226
|
+
* not arguments. `interpolationFormatTypeMap` overrides a type by its
|
|
227
|
+
* function name.
|
|
228
|
+
*
|
|
229
|
+
* @default true
|
|
230
|
+
*/
|
|
231
|
+
parseInterpolation: true;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Use a proxy-based selector to select a translation.
|
|
235
|
+
*
|
|
236
|
+
* Enables features like go-to definition, and better DX/faster autocompletion
|
|
237
|
+
* for TypeScript developers.
|
|
238
|
+
*
|
|
239
|
+
* If you're working with an especially large set of translations and aren't
|
|
240
|
+
* using context, you set `enableSelector` to `"optimize"` and i18next won't do
|
|
241
|
+
* any type-level processing of your translations at all.
|
|
242
|
+
*
|
|
243
|
+
* With `enableSelector` set to `"optimize"`, i18next is capable of supporting
|
|
244
|
+
* arbitrarily large/deep translation sets without causing any IDE slowdown
|
|
245
|
+
* whatsoever.
|
|
246
|
+
*
|
|
247
|
+
* Set `enableSelector` to `"strict"` to require an explicit namespace as the
|
|
248
|
+
* first selector path segment in every call. The selector proxy stops
|
|
249
|
+
* exposing the primary namespace's keys flat on `$` — even
|
|
250
|
+
* `useTranslation('only')` must use `$.only.foo`, never `$.foo`. At runtime,
|
|
251
|
+
* a leading segment matching the scope's namespace list (primary included)
|
|
252
|
+
* is always rewritten as a namespace prefix, fully decoupling selector
|
|
253
|
+
* shape from resolution scope. Use this when you want a single mental model
|
|
254
|
+
* for selector paths regardless of how many namespaces a hook was created
|
|
255
|
+
* with, and to remove the silent miss that flat-primary paths can otherwise
|
|
256
|
+
* cause in multi-ns hooks (see [#2429](https://github.com/i18next/i18next/issues/2429)).
|
|
257
|
+
*
|
|
258
|
+
* `"strict"` mode is incompatible with the `"optimize"` shortcut. If you
|
|
259
|
+
* have keys whose names match sibling namespaces (the
|
|
260
|
+
* [#2405](https://github.com/i18next/i18next/issues/2405) pattern), do not
|
|
261
|
+
* enable strict mode — the leading-segment rewrite would route those keys
|
|
262
|
+
* into the wrong namespace.
|
|
263
|
+
*
|
|
264
|
+
* @default false
|
|
265
|
+
*/
|
|
266
|
+
enableSelector: false;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Maps interpolation format specifiers to their expected value types.
|
|
270
|
+
*
|
|
271
|
+
* By default, i18next infers types from built-in formatter names:
|
|
272
|
+
* - `number`, `currency` → `number`
|
|
273
|
+
* - `datetime` → `Date`
|
|
274
|
+
* - `relativetime` → `number`
|
|
275
|
+
* - `list` → `readonly string[]`
|
|
276
|
+
* - No format specifier → `string | number` (since i18next stringifies values at runtime)
|
|
277
|
+
*
|
|
278
|
+
* Use this option to add mappings for custom formatters or to override
|
|
279
|
+
* the built-in defaults.
|
|
280
|
+
*
|
|
281
|
+
* @default {} (empty — built-in defaults apply)
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* interface CustomTypeOptions {
|
|
286
|
+
* interpolationFormatTypeMap: {
|
|
287
|
+
* // custom formatter
|
|
288
|
+
* uppercase: string;
|
|
289
|
+
* // override built-in
|
|
290
|
+
* currency: string;
|
|
291
|
+
* };
|
|
292
|
+
* }
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
interpolationFormatTypeMap: {};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* The variables `interpolation.defaultVariables` fills in at runtime (since v26.7.0). They
|
|
299
|
+
* become optional in the `t()` options, also with `strictInterpolationChecks`.
|
|
300
|
+
*
|
|
301
|
+
* @default {}
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* interface CustomTypeOptions {
|
|
306
|
+
* defaultVariables: { appName: string };
|
|
307
|
+
* }
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
defaultVariables: {};
|
|
311
|
+
},
|
|
312
|
+
CustomTypeOptions
|
|
313
|
+
>,
|
|
314
|
+
// HACK: apply merged resources *after* CustomTypeOptions so registry contributions
|
|
315
|
+
// survive when CustomTypeOptions.resources is also defined. Without this
|
|
316
|
+
// second step, the inner $MergeBy would replace the default `resources: object`
|
|
317
|
+
// with CustomTypeOptions['resources'] alone, dropping the registry namespaces.
|
|
318
|
+
{ resources: _MergedResources }
|
|
319
|
+
>;
|
|
320
|
+
|
|
321
|
+
export type PluginOptions<T> = $MergeBy<
|
|
322
|
+
{
|
|
323
|
+
/**
|
|
324
|
+
* Options for language detection - check documentation of plugin
|
|
325
|
+
* @default undefined
|
|
326
|
+
*/
|
|
327
|
+
detection?: object;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Options for backend - check documentation of plugin
|
|
331
|
+
* @default undefined
|
|
332
|
+
*/
|
|
333
|
+
backend?: T;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Options for cache layer - check documentation of plugin
|
|
337
|
+
* @default undefined
|
|
338
|
+
*/
|
|
339
|
+
cache?: object;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Options for i18n message format - check documentation of plugin
|
|
343
|
+
* @default undefined
|
|
344
|
+
*/
|
|
345
|
+
i18nFormat?: object;
|
|
346
|
+
},
|
|
347
|
+
CustomPluginOptions
|
|
348
|
+
>;
|
|
349
|
+
|
|
350
|
+
export type FormatFunction = (
|
|
351
|
+
value: any,
|
|
352
|
+
format?: string,
|
|
353
|
+
lng?: string,
|
|
354
|
+
options?: InterpolationOptions & $Dictionary<any>,
|
|
355
|
+
) => string;
|
|
356
|
+
|
|
357
|
+
export interface InterpolationOptions {
|
|
358
|
+
/**
|
|
359
|
+
* Used to separate format from interpolation value
|
|
360
|
+
* @default ','
|
|
361
|
+
*/
|
|
362
|
+
formatSeparator?: string;
|
|
363
|
+
/**
|
|
364
|
+
* Escape function
|
|
365
|
+
* @default str => str
|
|
366
|
+
*/
|
|
367
|
+
escape?(str: string): string;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Always format interpolated values.
|
|
371
|
+
* @default false
|
|
372
|
+
*/
|
|
373
|
+
alwaysFormat?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Escape passed in values to avoid xss injection
|
|
376
|
+
* @default true
|
|
377
|
+
*/
|
|
378
|
+
escapeValue?: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* If true, then value passed into escape function is not casted to string, use with custom escape function that does its own type check
|
|
381
|
+
* @default false
|
|
382
|
+
*/
|
|
383
|
+
useRawValueToEscape?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Prefix for interpolation
|
|
386
|
+
* @default '{{'
|
|
387
|
+
*/
|
|
388
|
+
prefix?: string;
|
|
389
|
+
/**
|
|
390
|
+
* Suffix for interpolation
|
|
391
|
+
* @default '}}'
|
|
392
|
+
*/
|
|
393
|
+
suffix?: string;
|
|
394
|
+
/**
|
|
395
|
+
* Suffix to unescaped mode
|
|
396
|
+
* @default undefined
|
|
397
|
+
*/
|
|
398
|
+
unescapeSuffix?: string;
|
|
399
|
+
/**
|
|
400
|
+
* Prefix to unescaped mode
|
|
401
|
+
* @default '-'
|
|
402
|
+
*/
|
|
403
|
+
unescapePrefix?: string;
|
|
404
|
+
/**
|
|
405
|
+
* Prefix for nesting
|
|
406
|
+
* @default '$t('
|
|
407
|
+
*/
|
|
408
|
+
nestingPrefix?: string;
|
|
409
|
+
/**
|
|
410
|
+
* Suffix for nesting
|
|
411
|
+
* @default ')'
|
|
412
|
+
*/
|
|
413
|
+
nestingSuffix?: string;
|
|
414
|
+
/**
|
|
415
|
+
* Separates options from key
|
|
416
|
+
* @default ','
|
|
417
|
+
*/
|
|
418
|
+
nestingOptionsSeparator?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Global variables to use in interpolation replacements
|
|
421
|
+
* @default undefined
|
|
422
|
+
*/
|
|
423
|
+
|
|
424
|
+
defaultVariables?: { [index: string]: any };
|
|
425
|
+
/**
|
|
426
|
+
* After how many interpolation runs to break out before throwing a stack overflow
|
|
427
|
+
* @default 1000
|
|
428
|
+
*/
|
|
429
|
+
maxReplaces?: number;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* If true, it will skip to interpolate the variables
|
|
433
|
+
* @default true
|
|
434
|
+
*/
|
|
435
|
+
skipOnVariables?: boolean;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export interface FallbackLngObjList {
|
|
439
|
+
[language: string]: readonly string[];
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export type FallbackLng =
|
|
443
|
+
| string
|
|
444
|
+
| readonly string[]
|
|
445
|
+
| FallbackLngObjList
|
|
446
|
+
| ((code: string) => string | readonly string[] | FallbackLngObjList);
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* The `react` options of react-i18next, which fills in this interface (since v27; before, i18next
|
|
450
|
+
* declared them). Without react-i18next in the program, `react` takes any object.
|
|
451
|
+
*/
|
|
452
|
+
export interface ReactOptions {}
|
|
453
|
+
|
|
454
|
+
export type ResourceKey =
|
|
455
|
+
| string
|
|
456
|
+
| {
|
|
457
|
+
[key: string]: any;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
export interface ResourceLanguage {
|
|
461
|
+
[namespace: string]: ResourceKey;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export interface Resource {
|
|
465
|
+
[language: string]: ResourceLanguage;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export interface InitOptions<T = object> extends PluginOptions<T> {
|
|
469
|
+
/**
|
|
470
|
+
* Logs info level to console output. Helps finding issues with loading not working.
|
|
471
|
+
* @default false
|
|
472
|
+
*/
|
|
473
|
+
debug?: boolean;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Resources to initialize with (if not using loading or not appending using addResourceBundle)
|
|
477
|
+
* @default undefined
|
|
478
|
+
*/
|
|
479
|
+
resources?: Resource;
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Allow initializing with bundled resources while using a backend to load non bundled ones.
|
|
483
|
+
* @default false
|
|
484
|
+
*/
|
|
485
|
+
partialBundledLanguages?: boolean;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Language to use (overrides language detection)
|
|
489
|
+
* @default undefined
|
|
490
|
+
*/
|
|
491
|
+
lng?: string;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Language to use if translations in user language are not available.
|
|
495
|
+
* Since v27 there is none by default; `'dev'` was the default before.
|
|
496
|
+
* @default false
|
|
497
|
+
*/
|
|
498
|
+
fallbackLng?: false | FallbackLng;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Array of allowed languages
|
|
502
|
+
* @default false
|
|
503
|
+
*/
|
|
504
|
+
supportedLngs?: false | readonly string[];
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* If true will pass eg. en-US if finding en in supportedLngs
|
|
508
|
+
* @default false
|
|
509
|
+
*/
|
|
510
|
+
nonExplicitSupportedLngs?: boolean;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Language codes to lookup, given set language is 'en-US' and fallbackLng 'dev':
|
|
514
|
+
* 'all' --> ['en-US', 'en', 'dev'],
|
|
515
|
+
* 'currentOnly' --> 'en-US',
|
|
516
|
+
* 'languageOnly' --> 'en'
|
|
517
|
+
* @default 'all'
|
|
518
|
+
*/
|
|
519
|
+
load?: 'all' | 'currentOnly' | 'languageOnly';
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Array of languages to preload. Important on server-side to assert translations are loaded before rendering views.
|
|
523
|
+
* @default false
|
|
524
|
+
*/
|
|
525
|
+
preload?: false | readonly string[];
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Language will be lowercased eg. en-US --> en-us
|
|
529
|
+
* @default false
|
|
530
|
+
*/
|
|
531
|
+
lowerCaseLng?: boolean;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Since v27, codes without a region get their canonical casing (`'EN'` → `'en'`); aliases like
|
|
535
|
+
* `'tl'` or `'iw'` stay. `false` keeps them as they are, as before v27. `true` also lower-cases a
|
|
536
|
+
* code that is not BCP 47.
|
|
537
|
+
* @deprecated canonical codes are the default since v27
|
|
538
|
+
* @default undefined
|
|
539
|
+
*/
|
|
540
|
+
cleanCode?: boolean;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* String or array of namespaces to load
|
|
544
|
+
* @default 'translation'
|
|
545
|
+
*/
|
|
546
|
+
ns?: string | readonly string[];
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Default namespace used if not passed to translation function
|
|
550
|
+
* @default 'translation'
|
|
551
|
+
*/
|
|
552
|
+
defaultNS?: string | false | readonly string[];
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* String or array of namespaces to lookup key if not found in given namespace.
|
|
556
|
+
* @default false
|
|
557
|
+
*/
|
|
558
|
+
fallbackNS?: false | string | readonly string[];
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Calls the backend's `create()` for keys that are not found, so new keys
|
|
562
|
+
* reach your translation files or service while you develop (keep it off
|
|
563
|
+
* in production). `i18next-http-backend` posts them to its `addPath`;
|
|
564
|
+
* `i18next-locize-backend` (https://www.locize.com/i18next?from=i18next_types__savemissing)
|
|
565
|
+
* sends them to Locize, the translation management service by the i18next
|
|
566
|
+
* maintainers, where they can be translated automatically.
|
|
567
|
+
* @default false
|
|
568
|
+
*/
|
|
569
|
+
saveMissing?: boolean;
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Calls save missing key function on backend if key not found also for plural forms.
|
|
573
|
+
* @default true
|
|
574
|
+
*/
|
|
575
|
+
saveMissingPlurals?: boolean;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Experimental: enable to update default values using the saveMissing
|
|
579
|
+
* (Works only if defaultValue different from translated value.
|
|
580
|
+
* Only useful on initial development or when keeping code as source of truth not changing values outside of code.
|
|
581
|
+
* Only supported if backend supports it already)
|
|
582
|
+
* @default false
|
|
583
|
+
*/
|
|
584
|
+
updateMissing?: boolean;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* @default 'fallback'
|
|
588
|
+
*/
|
|
589
|
+
saveMissingTo?: 'current' | 'all' | 'fallback';
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Used to not fallback to the key as default value, when using saveMissing functionality.
|
|
593
|
+
* i.e. when using with i18next-http-backend this will result in having a key with an empty string value.
|
|
594
|
+
* @default false
|
|
595
|
+
*/
|
|
596
|
+
missingKeyNoValueFallbackToKey?: boolean;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Used for custom missing key handling (needs saveMissing set to true!)
|
|
600
|
+
* @default false
|
|
601
|
+
*/
|
|
602
|
+
missingKeyHandler?:
|
|
603
|
+
| false
|
|
604
|
+
| ((
|
|
605
|
+
lngs: readonly string[],
|
|
606
|
+
ns: string,
|
|
607
|
+
key: string,
|
|
608
|
+
fallbackValue: string,
|
|
609
|
+
updateMissing: boolean,
|
|
610
|
+
options: any,
|
|
611
|
+
) => void);
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Receives a key that was not found in `t()` and returns a value, that will be returned by `t()`
|
|
615
|
+
* @default noop
|
|
616
|
+
*/
|
|
617
|
+
parseMissingKeyHandler?(key: string, defaultValue?: string, options?: any): any;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Appends namespace to missing key
|
|
621
|
+
* @default false
|
|
622
|
+
*/
|
|
623
|
+
appendNamespaceToMissingKey?: boolean;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Gets called in case a interpolation value is undefined. This method will not be called if the value is empty string or null
|
|
627
|
+
* @default noop
|
|
628
|
+
*/
|
|
629
|
+
missingInterpolationHandler?: (text: string, value: any, options: InitOptions) => any;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* String or array of postProcessors to apply per default
|
|
633
|
+
* @default false
|
|
634
|
+
*/
|
|
635
|
+
postProcess?: false | string | readonly string[];
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* passthrough the resolved object including 'usedNS', 'usedLang' etc into options object of postprocessors as 'i18nResolved' property
|
|
639
|
+
* @default false
|
|
640
|
+
*/
|
|
641
|
+
postProcessPassResolved?: boolean;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Allows null values as valid translation
|
|
645
|
+
* @default false
|
|
646
|
+
*/
|
|
647
|
+
returnNull?: boolean;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Allows empty string as valid translation. Since v27 an empty string falls back like a missing value
|
|
651
|
+
* by default.
|
|
652
|
+
* @default false
|
|
653
|
+
*/
|
|
654
|
+
returnEmptyString?: boolean;
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Allows objects as valid translation result
|
|
658
|
+
* @default false
|
|
659
|
+
*/
|
|
660
|
+
returnObjects?: boolean;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Returns an object that includes information about the used language, namespace, key and value
|
|
664
|
+
* @default false
|
|
665
|
+
*/
|
|
666
|
+
returnDetails?: boolean;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Gets called if object was passed in as key but returnObjects was set to false.
|
|
670
|
+
* What it returns is what `t()` returns; without it, `t()` returns the key (since v27).
|
|
671
|
+
* @default noop
|
|
672
|
+
*/
|
|
673
|
+
returnedObjectHandler?(key: string, value: string, options: any): unknown;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Char, eg. '\n' that arrays will be joined by
|
|
677
|
+
* @default false
|
|
678
|
+
*/
|
|
679
|
+
joinArrays?: false | string;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Sets defaultValue
|
|
683
|
+
* @default args => ({ defaultValue: args[1] })
|
|
684
|
+
*/
|
|
685
|
+
overloadTranslationOptionHandler?(args: string[]): TOptions;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* @see https://www.i18next.com/translation-function/interpolation
|
|
689
|
+
*/
|
|
690
|
+
interpolation?: InterpolationOptions;
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Options for react - check documentation of plugin
|
|
694
|
+
* @default undefined
|
|
695
|
+
*/
|
|
696
|
+
react?: ReactOptions;
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Triggers resource loading in init function inside a setTimeout (default async behaviour).
|
|
700
|
+
* Set it to false if your backend loads resources sync - that way calling i18next.t after
|
|
701
|
+
* init is possible without relaying on the init callback.
|
|
702
|
+
* @default true
|
|
703
|
+
*/
|
|
704
|
+
initAsync?: boolean;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Char to separate keys
|
|
708
|
+
* @default '.'
|
|
709
|
+
*/
|
|
710
|
+
keySeparator?: false | string;
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Char to split namespace from key
|
|
714
|
+
* @default ':'
|
|
715
|
+
*/
|
|
716
|
+
nsSeparator?: false | string;
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Selector-API mode. Mirrors `CustomTypeOptions['enableSelector']`.
|
|
720
|
+
*
|
|
721
|
+
* - `false` (default): selector API disabled.
|
|
722
|
+
* - `true` / `'optimize'`: selector resolution enabled.
|
|
723
|
+
* - `'strict'`: require an explicit namespace as the first selector
|
|
724
|
+
* path segment in every call. The resolver always rewrites a leading
|
|
725
|
+
* namespace-matching segment as a namespace prefix.
|
|
726
|
+
*
|
|
727
|
+
* @default false
|
|
728
|
+
*/
|
|
729
|
+
enableSelector?: false | true | 'optimize' | 'strict';
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Char to split plural from key
|
|
733
|
+
* @default '_'
|
|
734
|
+
*/
|
|
735
|
+
pluralSeparator?: string;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Char to split context from key
|
|
739
|
+
* @default '_'
|
|
740
|
+
*/
|
|
741
|
+
contextSeparator?: string;
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Prefixes the namespace to the returned key when using `cimode`
|
|
745
|
+
* @default false
|
|
746
|
+
*/
|
|
747
|
+
appendNamespaceToCIMode?: boolean;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Automatically lookup for a flat key if a nested key is not found an vice-versa
|
|
751
|
+
* @default true
|
|
752
|
+
*/
|
|
753
|
+
ignoreJSONStructure?: boolean;
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Limit parallelism of calls to backend
|
|
757
|
+
* This is needed to prevent trying to open thousands of
|
|
758
|
+
* sockets or file descriptors, which can cause failures
|
|
759
|
+
* and actually make the entire process take longer.
|
|
760
|
+
* @default 10
|
|
761
|
+
*/
|
|
762
|
+
maxParallelReads?: number;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* The maximum number of retries to perform.
|
|
766
|
+
* Note that retries are only performed when a request has no response
|
|
767
|
+
* and throws an error.
|
|
768
|
+
* The default value is used if value is set below 0.
|
|
769
|
+
* @default 5
|
|
770
|
+
*/
|
|
771
|
+
maxRetries?: number;
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Set how long to wait, in milliseconds, between retries of failed requests.
|
|
775
|
+
* This number is compounded by a factor of 2 for subsequent retry.
|
|
776
|
+
* The default value is used if value is set below 1ms.
|
|
777
|
+
* @default 350
|
|
778
|
+
*/
|
|
779
|
+
retryTimeout?: number;
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Initializes the internal formatter for the in-built formats as cached version.
|
|
783
|
+
* Can be set to false for this type of issues: https://github.com/i18next/i18next/issues/2227
|
|
784
|
+
* @default true
|
|
785
|
+
*/
|
|
786
|
+
cacheInBuiltFormats?: boolean;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
export interface TOptionsBase {
|
|
790
|
+
/**
|
|
791
|
+
* Default value to return if a translation was not found
|
|
792
|
+
*/
|
|
793
|
+
defaultValue?: unknown;
|
|
794
|
+
/**
|
|
795
|
+
* Count value used for plurals
|
|
796
|
+
*/
|
|
797
|
+
count?: number;
|
|
798
|
+
/**
|
|
799
|
+
* Ordinal flag for ordinal plurals
|
|
800
|
+
*/
|
|
801
|
+
ordinal?: boolean;
|
|
802
|
+
/**
|
|
803
|
+
* Used for contexts (eg. male\female)
|
|
804
|
+
*/
|
|
805
|
+
context?: unknown;
|
|
806
|
+
/**
|
|
807
|
+
* Object with vars for interpolation - or put them directly in options
|
|
808
|
+
*/
|
|
809
|
+
replace?: any;
|
|
810
|
+
/**
|
|
811
|
+
* Override language to use
|
|
812
|
+
*/
|
|
813
|
+
lng?: string;
|
|
814
|
+
/**
|
|
815
|
+
* Override languages to use
|
|
816
|
+
*/
|
|
817
|
+
lngs?: readonly string[];
|
|
818
|
+
/**
|
|
819
|
+
* Override language to lookup key if not found see fallbacks for details
|
|
820
|
+
*/
|
|
821
|
+
fallbackLng?: false | FallbackLng;
|
|
822
|
+
/**
|
|
823
|
+
* Override namespaces (string or array)
|
|
824
|
+
*/
|
|
825
|
+
ns?: Namespace;
|
|
826
|
+
/**
|
|
827
|
+
* Override char to separate keys
|
|
828
|
+
*/
|
|
829
|
+
keySeparator?: false | string;
|
|
830
|
+
/**
|
|
831
|
+
* Override char to split namespace from key
|
|
832
|
+
*/
|
|
833
|
+
nsSeparator?: false | string;
|
|
834
|
+
/**
|
|
835
|
+
* Accessing an object not a translation string (can be set globally too)
|
|
836
|
+
*/
|
|
837
|
+
returnObjects?: boolean;
|
|
838
|
+
/**
|
|
839
|
+
* Returns an object that includes information about the used language, namespace, key and value
|
|
840
|
+
*/
|
|
841
|
+
returnDetails?: boolean;
|
|
842
|
+
/**
|
|
843
|
+
* Char, eg. '\n' that arrays will be joined by (can be set globally too)
|
|
844
|
+
*/
|
|
845
|
+
joinArrays?: string;
|
|
846
|
+
/**
|
|
847
|
+
* String or array of postProcessors to apply see interval plurals as a sample
|
|
848
|
+
*/
|
|
849
|
+
postProcess?: string | readonly string[];
|
|
850
|
+
/**
|
|
851
|
+
* Override interpolation options
|
|
852
|
+
*/
|
|
853
|
+
interpolation?: InterpolationOptions;
|
|
854
|
+
/**
|
|
855
|
+
* Skip interpolation and nesting for this call (since v26.7.0 in the types)
|
|
856
|
+
*/
|
|
857
|
+
skipInterpolation?: boolean;
|
|
858
|
+
/**
|
|
859
|
+
* Optional keyPrefix that will be applied to the key before resolving.
|
|
860
|
+
* Accepts a string or a selector function (e.g. `$ => $.deeply.nested`).
|
|
861
|
+
* Only supported on the TFunction returned by getFixedT().
|
|
862
|
+
*/
|
|
863
|
+
keyPrefix?: string | (($: any) => any);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
export type TOptions<TInterpolationMap extends object = $Dictionary> = TOptionsBase &
|
|
867
|
+
TInterpolationMap;
|
|
868
|
+
|
|
869
|
+
export type FlatNamespace = $PreservedValue<keyof TypeOptions['resources'], string>;
|
|
870
|
+
export type Namespace<T = FlatNamespace> = T | readonly T[];
|
|
871
|
+
export type DefaultNamespace = TypeOptions['defaultNS'];
|