@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,739 @@
|
|
|
1
|
+
// Internal Helpers
|
|
2
|
+
import type { $Dictionary, $NormalizeIntoArray } from './typescript/helpers.js';
|
|
3
|
+
import type {
|
|
4
|
+
DefaultNamespace,
|
|
5
|
+
FlatNamespace,
|
|
6
|
+
FormatFunction,
|
|
7
|
+
InitOptions,
|
|
8
|
+
InterpolationOptions,
|
|
9
|
+
Namespace,
|
|
10
|
+
Resource,
|
|
11
|
+
ResourceKey,
|
|
12
|
+
ResourceLanguage,
|
|
13
|
+
TOptions,
|
|
14
|
+
TypeOptions,
|
|
15
|
+
} from './typescript/options.js';
|
|
16
|
+
import type {
|
|
17
|
+
KeyPrefix,
|
|
18
|
+
KeyPrefixSelector,
|
|
19
|
+
TFunction,
|
|
20
|
+
KeyFromSelectorFn,
|
|
21
|
+
SelectorKey,
|
|
22
|
+
} from './typescript/t.js';
|
|
23
|
+
|
|
24
|
+
export interface WithT<Ns extends Namespace = DefaultNamespace> {
|
|
25
|
+
// Expose parameterized t in the i18next interface hierarchy
|
|
26
|
+
t: TFunction<Ns>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Interpolator {
|
|
30
|
+
init(options: InterpolationOptions, reset: boolean): undefined;
|
|
31
|
+
reset(): undefined;
|
|
32
|
+
resetRegExp(): undefined;
|
|
33
|
+
interpolate(str: string, data: object, lng: string, options: InterpolationOptions): string;
|
|
34
|
+
nest(str: string, fc: (...args: any[]) => any, options: InterpolationOptions): string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class ResourceStore {
|
|
38
|
+
constructor(data: Resource, options: InitOptions);
|
|
39
|
+
|
|
40
|
+
public data: Resource;
|
|
41
|
+
|
|
42
|
+
public options: InitOptions;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Gets fired when resources got added or removed
|
|
46
|
+
*/
|
|
47
|
+
on(event: 'added' | 'removed', callback: (lng: string, ns: string) => void): void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Remove event listener
|
|
51
|
+
* removes all callback when callback not specified
|
|
52
|
+
*/
|
|
53
|
+
off(event: 'added' | 'removed', callback?: (lng: string, ns: string) => void): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe to an event, but only once. The listener is removed after the first call.
|
|
57
|
+
*/
|
|
58
|
+
once(event: 'added' | 'removed', callback: (lng: string, ns: string) => void): this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface Formatter {
|
|
62
|
+
init(services: Services, i18nextOptions: InitOptions): void;
|
|
63
|
+
add(name: string, fc: (value: any, lng: string | undefined, options: any) => string): void;
|
|
64
|
+
addCached(
|
|
65
|
+
name: string,
|
|
66
|
+
fc: (lng: string | undefined, options: any) => (value: any) => string,
|
|
67
|
+
): void;
|
|
68
|
+
format: FormatFunction;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface Services {
|
|
72
|
+
backendConnector: any;
|
|
73
|
+
i18nFormat: any;
|
|
74
|
+
interpolator: Interpolator;
|
|
75
|
+
languageDetector: any;
|
|
76
|
+
languageUtils: any;
|
|
77
|
+
logger: any;
|
|
78
|
+
pluralResolver: any;
|
|
79
|
+
resourceStore: ResourceStore;
|
|
80
|
+
formatter?: Formatter;
|
|
81
|
+
/** Calls bound to the i18next instance, for plugins */
|
|
82
|
+
utils?: {
|
|
83
|
+
hasLoadedNamespace: i18n['hasLoadedNamespace'];
|
|
84
|
+
/** Reloads resources through the backend, as `i18next.reloadResources()` (since v26.7.0) */
|
|
85
|
+
reloadResources: i18n['reloadResources'];
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type ModuleType =
|
|
90
|
+
| 'backend'
|
|
91
|
+
| 'logger'
|
|
92
|
+
| 'languageDetector'
|
|
93
|
+
| 'postProcessor'
|
|
94
|
+
| 'i18nFormat'
|
|
95
|
+
| 'formatter'
|
|
96
|
+
| '3rdParty';
|
|
97
|
+
|
|
98
|
+
export interface Module {
|
|
99
|
+
type: ModuleType;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type CallbackError = Error | string | null | undefined;
|
|
103
|
+
export type ReadCallback = (
|
|
104
|
+
err: CallbackError,
|
|
105
|
+
data: ResourceKey | boolean | null | undefined,
|
|
106
|
+
) => void;
|
|
107
|
+
export type MultiReadCallback = (err: CallbackError, data: Resource | null | undefined) => void;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Used to load data for i18next.
|
|
111
|
+
* Can be provided as a singleton or as a prototype constructor (preferred for supporting multiple instances of i18next).
|
|
112
|
+
* For singleton set property `type` to `'backend'` For a prototype constructor set static property.
|
|
113
|
+
*/
|
|
114
|
+
export interface BackendModule<Options = object> extends Module {
|
|
115
|
+
type: 'backend';
|
|
116
|
+
/**
|
|
117
|
+
* Declares how i18next calls `read` and `create` (since v26.7.0; as an instance or static property):
|
|
118
|
+
* - `true`: `read(language, namespace, callback)` and
|
|
119
|
+
* `create(languages, namespace, key, fallbackValue, callback, options)`
|
|
120
|
+
* - `false`: `read(language, namespace)` and `create(languages, namespace, key, fallbackValue, options)`
|
|
121
|
+
* return a promise or a value
|
|
122
|
+
*
|
|
123
|
+
* Left out, i18next guesses it from the number of parameters, which is deprecated.
|
|
124
|
+
*/
|
|
125
|
+
callbackApi?: boolean;
|
|
126
|
+
init(services: Services, backendOptions: Options, i18nextOptions: InitOptions): void;
|
|
127
|
+
/**
|
|
128
|
+
* Load a namespace. With `callbackApi: false`, implement it as `read(language, namespace)`
|
|
129
|
+
* returning the data or a promise of it (the `void` return type accepts both forms).
|
|
130
|
+
*/
|
|
131
|
+
read(language: string, namespace: string, callback: ReadCallback): void;
|
|
132
|
+
/**
|
|
133
|
+
* Save the missing translation. Called as `create(languages, namespace, key, fallbackValue, callback, options)`
|
|
134
|
+
* with `callbackApi: true`, as `create(languages, namespace, key, fallbackValue, options)` returning a promise
|
|
135
|
+
* or a value with `callbackApi: false`. `options` are the options of the `t` call plus `isUpdate`.
|
|
136
|
+
*/
|
|
137
|
+
create?(
|
|
138
|
+
languages: readonly string[],
|
|
139
|
+
namespace: string,
|
|
140
|
+
key: string,
|
|
141
|
+
fallbackValue: string,
|
|
142
|
+
// `any`, not a union of both shapes, so implementations typed either way keep compiling
|
|
143
|
+
callbackOrOptions?: any,
|
|
144
|
+
options?: any,
|
|
145
|
+
): void;
|
|
146
|
+
/**
|
|
147
|
+
* Load multiple languages and namespaces. For backends supporting multiple resources loading.
|
|
148
|
+
* With `callbackApi: false`, implement it as `readMulti(languages, namespaces)` returning the data or a promise of it.
|
|
149
|
+
*/
|
|
150
|
+
readMulti?(
|
|
151
|
+
languages: readonly string[],
|
|
152
|
+
namespaces: readonly string[],
|
|
153
|
+
callback: MultiReadCallback,
|
|
154
|
+
): void;
|
|
155
|
+
/** Store the translation. For backends acting as cache layer */
|
|
156
|
+
save?(language: string, namespace: string, data: ResourceLanguage): void;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Used to detect language in user land.
|
|
161
|
+
* Can be provided as a singleton or as a prototype constructor (preferred for supporting multiple instances of i18next).
|
|
162
|
+
* For singleton set property `type` to `'languageDetector'` For a prototype constructor set static property.
|
|
163
|
+
*/
|
|
164
|
+
export interface LanguageDetectorModule extends Module {
|
|
165
|
+
type: 'languageDetector';
|
|
166
|
+
init?(services: Services, detectorOptions: object, i18nextOptions: InitOptions): void;
|
|
167
|
+
/** Must return detected language */
|
|
168
|
+
detect(): string | readonly string[] | undefined;
|
|
169
|
+
cacheUserLanguage?(lng: string): void;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Used to detect language in user land.
|
|
174
|
+
* Can be provided as a singleton or as a prototype constructor (preferred for supporting multiple instances of i18next).
|
|
175
|
+
* For singleton set property `type` to `'languageDetector'` For a prototype constructor set static property.
|
|
176
|
+
*/
|
|
177
|
+
export interface LanguageDetectorAsyncModule extends Module {
|
|
178
|
+
type: 'languageDetector';
|
|
179
|
+
/** Set to true to enable async detection */
|
|
180
|
+
async: true;
|
|
181
|
+
/**
|
|
182
|
+
* Declares how the async `detect` answers (since v26.7.0; as an instance or static property):
|
|
183
|
+
* `true` for `detect(callback)`, `false` for `detect()` returning a promise.
|
|
184
|
+
* Left out, i18next guesses it from the number of parameters, which is deprecated.
|
|
185
|
+
*/
|
|
186
|
+
callbackApi?: boolean;
|
|
187
|
+
init?(services: Services, detectorOptions: object, i18nextOptions: InitOptions): void;
|
|
188
|
+
/** Must call callback passing detected language or return a Promise */
|
|
189
|
+
detect(
|
|
190
|
+
callback: (lng: string | readonly string[] | undefined) => void | undefined,
|
|
191
|
+
): void | Promise<string | readonly string[] | undefined>;
|
|
192
|
+
cacheUserLanguage?(lng: string): void | Promise<void>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Used to extend or manipulate the translated values before returning them in `t` function.
|
|
197
|
+
* Need to be a singleton object.
|
|
198
|
+
*/
|
|
199
|
+
export interface PostProcessorModule extends Module {
|
|
200
|
+
/** Unique name */
|
|
201
|
+
name: string;
|
|
202
|
+
type: 'postProcessor';
|
|
203
|
+
process(value: string, key: string | string[], options: TOptions, translator: any): string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Override the built-in console logger.
|
|
208
|
+
* Do not need to be a prototype function.
|
|
209
|
+
*/
|
|
210
|
+
export interface LoggerModule extends Module {
|
|
211
|
+
type: 'logger';
|
|
212
|
+
/** i18next passes the arguments of each log call as one array */
|
|
213
|
+
log(args: any[]): void;
|
|
214
|
+
warn(args: any[]): void;
|
|
215
|
+
error(args: any[]): void;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Replaces the i18next message format with another syntax (like i18next-icu or i18next-mf2).
|
|
220
|
+
* Only one per i18next instance.
|
|
221
|
+
*/
|
|
222
|
+
export interface I18nFormatModule extends Module {
|
|
223
|
+
type: 'i18nFormat';
|
|
224
|
+
/** Called on `i18next.init` with the instance; by convention the options are in `i18next.options.i18nFormat` */
|
|
225
|
+
init?(i18next: i18n): void;
|
|
226
|
+
/**
|
|
227
|
+
* Called instead of interpolation and nesting; the return value goes through post processing and is
|
|
228
|
+
* returned by `t`. `res` is the found value, or the default value or key if nothing was found.
|
|
229
|
+
*/
|
|
230
|
+
parse?(
|
|
231
|
+
res: any,
|
|
232
|
+
options: any,
|
|
233
|
+
lng: string | undefined,
|
|
234
|
+
ns: string | undefined,
|
|
235
|
+
key: string | undefined,
|
|
236
|
+
info: { resolved: any },
|
|
237
|
+
): any;
|
|
238
|
+
/**
|
|
239
|
+
* Called instead of the plural and context suffix lookup, for each language code and namespace;
|
|
240
|
+
* push more keys to `finalKeys` (the last one is looked up first).
|
|
241
|
+
*/
|
|
242
|
+
addLookupKeys?(finalKeys: string[], key: string, code: string, ns: string, options: any): void;
|
|
243
|
+
/** If true, i18next handles objects and arrays as usual (`returnObjects`, `joinArrays`); else they go to `parse` */
|
|
244
|
+
handleAsObject?: boolean;
|
|
245
|
+
/** Replaces the lookup in the resource store */
|
|
246
|
+
getResource?(code: string, ns: string, key: string, options: any): any;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface FormatterModule extends Module, Formatter {
|
|
250
|
+
type: 'formatter';
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface ThirdPartyModule extends Module {
|
|
254
|
+
type: '3rdParty';
|
|
255
|
+
init(i18next: i18n): void;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface Modules {
|
|
259
|
+
backend?: BackendModule;
|
|
260
|
+
logger?: LoggerModule;
|
|
261
|
+
languageDetector?: LanguageDetectorModule | LanguageDetectorAsyncModule;
|
|
262
|
+
i18nFormat?: I18nFormatModule;
|
|
263
|
+
formatter?: FormatterModule;
|
|
264
|
+
external: ThirdPartyModule[];
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// helper to identify class https://stackoverflow.com/a/45983481/2363935
|
|
268
|
+
export interface Newable<T> {
|
|
269
|
+
new (...args: any[]): T;
|
|
270
|
+
}
|
|
271
|
+
export interface NewableModule<T extends Module> extends Newable<T> {
|
|
272
|
+
type: T['type'];
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export type Callback = (error: any, t: TFunction) => void;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Uses similar args as the t function and returns true if a key exists.
|
|
279
|
+
*
|
|
280
|
+
* Note: this shape intentionally does not include a type-guard overload so it
|
|
281
|
+
* remains easy to assign arrow functions to. The type guard narrowing to
|
|
282
|
+
* {@link SelectorKey} is declared directly on `i18n.exists` instead. If you
|
|
283
|
+
* need narrowing in your own code, call `i18next.exists` directly or forward
|
|
284
|
+
* the function by reference (e.g. `const exists: typeof i18next.exists =
|
|
285
|
+
* i18next.exists`). Wrapping it in an arrow function will lose the narrowing —
|
|
286
|
+
* there is currently no way to keep type-guard narrowing through an
|
|
287
|
+
* arrow-function wrapper, which is why `ExistsFunction` deliberately omits the
|
|
288
|
+
* predicate overload.
|
|
289
|
+
*/
|
|
290
|
+
export interface ExistsFunction<
|
|
291
|
+
TKeys extends string = string,
|
|
292
|
+
TInterpolationMap extends object = $Dictionary,
|
|
293
|
+
> {
|
|
294
|
+
(key: TKeys | TKeys[], options?: TOptions<TInterpolationMap>): boolean;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface CloneOptions extends InitOptions {
|
|
298
|
+
/**
|
|
299
|
+
* Will create a new instance of the resource store and import the existing translation resources.
|
|
300
|
+
* This way it will not shared the resource store instance.
|
|
301
|
+
* @default false
|
|
302
|
+
*/
|
|
303
|
+
forkResourceStore?: boolean;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface CustomInstanceExtensions {}
|
|
307
|
+
|
|
308
|
+
// Used just here to exclude `DefaultNamespace` which can be both string or array from `FlatNamespace`
|
|
309
|
+
// in TFunction declaration below.
|
|
310
|
+
// Due to this only very special usage I'm not moving this inside helpers.
|
|
311
|
+
type InferArrayValuesElseReturnType<T> = T extends (infer A)[] ? A : T;
|
|
312
|
+
|
|
313
|
+
export interface i18n extends CustomInstanceExtensions {
|
|
314
|
+
// Expose parameterized t in the i18next interface hierarchy
|
|
315
|
+
t: TFunction<
|
|
316
|
+
[
|
|
317
|
+
...$NormalizeIntoArray<DefaultNamespace>,
|
|
318
|
+
...Exclude<FlatNamespace, InferArrayValuesElseReturnType<DefaultNamespace>>[],
|
|
319
|
+
]
|
|
320
|
+
>;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* The default of the i18next module is an i18next instance ready to be initialized by calling init.
|
|
324
|
+
* You can create additional instances using the createInstance function.
|
|
325
|
+
*
|
|
326
|
+
* @param options - Initial options.
|
|
327
|
+
* @param callback - will be called after all translations were loaded or with an error when failed (in case of using a backend).
|
|
328
|
+
*/
|
|
329
|
+
init(callback?: Callback): Promise<TFunction>;
|
|
330
|
+
init<T>(options: InitOptions<T>, callback?: Callback): Promise<TFunction>;
|
|
331
|
+
|
|
332
|
+
loadResources(callback?: (err: any) => void): void;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* The use function is there to load additional plugins to i18next.
|
|
336
|
+
* For available module see the plugins page and don't forget to read the documentation of the plugin.
|
|
337
|
+
*
|
|
338
|
+
* @param module Accepts a class or object
|
|
339
|
+
*/
|
|
340
|
+
use<T extends Module>(module: T | NewableModule<T> | Newable<T>): this;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* List of modules used
|
|
344
|
+
*/
|
|
345
|
+
modules: Modules;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Internal container for all used plugins and implementation details like languageUtils, pluralResolvers, etc.
|
|
349
|
+
*/
|
|
350
|
+
services: Services;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Internal container for translation resources
|
|
354
|
+
*/
|
|
355
|
+
store: ResourceStore;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Uses similar args as the t function and returns true if a key exists.
|
|
359
|
+
* Acts as a type guard on single-key calls, narrowing the key to
|
|
360
|
+
* {@link SelectorKey} so it can be passed to `t()`.
|
|
361
|
+
*/
|
|
362
|
+
exists: {
|
|
363
|
+
<K extends string>(key: K, options?: TOptions): key is K & SelectorKey;
|
|
364
|
+
(key: string | string[], options?: TOptions): boolean;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Returns a resource data by language.
|
|
369
|
+
*/
|
|
370
|
+
getDataByLanguage(lng: string): { [key: string]: { [key: string]: string } } | undefined;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Returns a t function that defaults to given language or namespace.
|
|
374
|
+
* Both params could be arrays of languages or namespaces and will be treated as fallbacks in that case.
|
|
375
|
+
* On the returned function you can like in the t function override the languages or namespaces by passing them in options or by prepending namespace.
|
|
376
|
+
*
|
|
377
|
+
* Accepts optional keyPrefix that will be automatically applied to returned t function.
|
|
378
|
+
*
|
|
379
|
+
* Accepts optional fixedOpts: `scopeNs` is the full namespace list the t function is bound to
|
|
380
|
+
* (react-i18next passes the namespaces of `useTranslation`); selector keys use it to find a namespace prefix,
|
|
381
|
+
* lookups still use `ns`.
|
|
382
|
+
*/
|
|
383
|
+
getFixedT<
|
|
384
|
+
Ns extends Namespace | null,
|
|
385
|
+
const TKPrefixFn extends (TypeOptions['enableSelector'] extends true | 'optimize' | 'strict'
|
|
386
|
+
? KeyPrefixSelector<ActualNs>
|
|
387
|
+
: never),
|
|
388
|
+
ActualNs extends Namespace = Ns extends null ? DefaultNamespace : Ns,
|
|
389
|
+
>(
|
|
390
|
+
lng: string | readonly string[] | null,
|
|
391
|
+
ns: Ns,
|
|
392
|
+
keyPrefix: TKPrefixFn,
|
|
393
|
+
fixedOpts?: { scopeNs?: readonly string[] },
|
|
394
|
+
): TFunction<ActualNs, TKPrefixFn>;
|
|
395
|
+
|
|
396
|
+
getFixedT<
|
|
397
|
+
Ns extends Namespace | null = DefaultNamespace,
|
|
398
|
+
TKPrefix extends KeyPrefix<ActualNs> = undefined,
|
|
399
|
+
ActualNs extends Namespace = Ns extends null ? DefaultNamespace : Ns,
|
|
400
|
+
>(
|
|
401
|
+
...args:
|
|
402
|
+
| [
|
|
403
|
+
lng: string | readonly string[],
|
|
404
|
+
ns?: Ns,
|
|
405
|
+
keyPrefix?: TKPrefix | (($: any) => any),
|
|
406
|
+
fixedOpts?: { scopeNs?: readonly string[] },
|
|
407
|
+
]
|
|
408
|
+
| [
|
|
409
|
+
lng: null,
|
|
410
|
+
ns: Ns,
|
|
411
|
+
keyPrefix?: TKPrefix | (($: any) => any),
|
|
412
|
+
fixedOpts?: { scopeNs?: readonly string[] },
|
|
413
|
+
]
|
|
414
|
+
): TFunction<ActualNs, TKPrefix>;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Changes the language. The callback will be called as soon translations were loaded or an error occurs while loading.
|
|
418
|
+
* HINT: For easy testing - setting lng to 'cimode' will set t function to always return the key.
|
|
419
|
+
*/
|
|
420
|
+
changeLanguage(lng?: string, callback?: Callback): Promise<TFunction>;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Is set to the current detected or set language.
|
|
424
|
+
* If you need the primary used language depending on your configuration (supportedLngs, load) you will prefer using i18next.languages[0].
|
|
425
|
+
*/
|
|
426
|
+
language: string;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Is set to an array of language-codes that will be used it order to lookup the translation value.
|
|
430
|
+
*/
|
|
431
|
+
languages: readonly string[];
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Is set to the current resolved language.
|
|
435
|
+
* It can be used as primary used language, for example in a language switcher.
|
|
436
|
+
*/
|
|
437
|
+
resolvedLanguage?: string;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Checks if namespace has loaded yet.
|
|
441
|
+
* i.e. used by react-i18next
|
|
442
|
+
*/
|
|
443
|
+
hasLoadedNamespace(
|
|
444
|
+
ns: string | readonly string[],
|
|
445
|
+
options?: {
|
|
446
|
+
lng?: string | readonly string[];
|
|
447
|
+
fallbackLng?: InitOptions['fallbackLng'];
|
|
448
|
+
/**
|
|
449
|
+
* if `undefined` is returned default checks are performed.
|
|
450
|
+
*/
|
|
451
|
+
precheck?: (
|
|
452
|
+
i18n: i18n,
|
|
453
|
+
/**
|
|
454
|
+
* Check if the language namespace provided are not in loading status:
|
|
455
|
+
* returns `true` if load is completed successfully or with an error.
|
|
456
|
+
*/
|
|
457
|
+
loadNotPending: (
|
|
458
|
+
lng: string | readonly string[],
|
|
459
|
+
ns: string | readonly string[],
|
|
460
|
+
) => boolean,
|
|
461
|
+
) => boolean | undefined;
|
|
462
|
+
},
|
|
463
|
+
): boolean;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Loads additional namespaces not defined in init options.
|
|
467
|
+
*/
|
|
468
|
+
loadNamespaces(ns: string | readonly string[], callback?: Callback): Promise<void>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Loads additional languages not defined in init options (preload).
|
|
472
|
+
*/
|
|
473
|
+
loadLanguages(lngs: string | readonly string[], callback?: Callback): Promise<void>;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Reloads resources on given state. Optionally you can pass an array of languages and namespaces as params if you don't want to reload all.
|
|
477
|
+
* Without languages it reloads the current languages and every language the backend loaded or tried to load, for this
|
|
478
|
+
* instance and its clones (since v26.7.1), and it retries the bundles that failed.
|
|
479
|
+
*/
|
|
480
|
+
reloadResources(
|
|
481
|
+
lngs?: string | readonly string[],
|
|
482
|
+
ns?: string | readonly string[],
|
|
483
|
+
callback?: () => void,
|
|
484
|
+
): Promise<void>;
|
|
485
|
+
reloadResources(lngs: null, ns: string | readonly string[], callback?: () => void): Promise<void>;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Changes the default namespace.
|
|
489
|
+
*/
|
|
490
|
+
setDefaultNamespace(ns: string | readonly string[]): void;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Returns rtl or ltr depending on languages read direction.
|
|
494
|
+
*/
|
|
495
|
+
dir(lng?: string): 'ltr' | 'rtl';
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Puts resources rendered on the server into the store and changes to the server's language, each
|
|
499
|
+
* only the first time (sets `initializedStoreOnce` and `initializedLanguageOnce`). For SSR
|
|
500
|
+
* integrations like react-i18next's `useSSR`. Call it after `init()`. Since v26.7.0.
|
|
501
|
+
*/
|
|
502
|
+
hydrate(resources?: Resource, lng?: string): i18n;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Exposes interpolation.format function added on init.
|
|
506
|
+
*/
|
|
507
|
+
format: FormatFunction;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Will return a new i18next instance.
|
|
511
|
+
* Please read the options page for details on configuration options.
|
|
512
|
+
* Providing a callback will automatically call init.
|
|
513
|
+
* The callback will be called after all translations were loaded or with an error when failed (in case of using a backend).
|
|
514
|
+
*/
|
|
515
|
+
createInstance(options?: InitOptions, callback?: Callback): i18n;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Creates a clone of the current instance. Shares store, plugins and initial configuration.
|
|
519
|
+
* Can be used to create an instance sharing storage but being independent on set language or namespaces.
|
|
520
|
+
*/
|
|
521
|
+
cloneInstance(options?: CloneOptions, callback?: Callback): i18n;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Returns a JSON representation of the i18next instance for serialization.
|
|
525
|
+
*/
|
|
526
|
+
toJSON(): {
|
|
527
|
+
options: InitOptions;
|
|
528
|
+
store: ResourceStore;
|
|
529
|
+
language: string;
|
|
530
|
+
languages: readonly string[];
|
|
531
|
+
resolvedLanguage?: string;
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Gets fired after initialization.
|
|
536
|
+
*/
|
|
537
|
+
on(event: 'initialized', callback: (options: InitOptions) => void): this;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Gets fired on loaded resources.
|
|
541
|
+
*/
|
|
542
|
+
on(
|
|
543
|
+
event: 'loaded',
|
|
544
|
+
callback: (loaded: { [language: string]: { [namespace: string]: boolean } }) => void,
|
|
545
|
+
): this;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Gets fired if loading resources failed.
|
|
549
|
+
*/
|
|
550
|
+
on(event: 'failedLoading', callback: (lng: string, ns: string, msg: string) => void): this;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Gets fired on accessing a key not existing.
|
|
554
|
+
*/
|
|
555
|
+
on(
|
|
556
|
+
event: 'missingKey',
|
|
557
|
+
callback: (lngs: readonly string[], namespace: string, key: string, res: string) => void,
|
|
558
|
+
): this;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Gets fired when changeLanguage got called.
|
|
562
|
+
*/
|
|
563
|
+
on(event: 'languageChanged', callback: (lng: string) => void): this;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Event listener
|
|
567
|
+
*/
|
|
568
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Remove event listener
|
|
572
|
+
* removes all callback when callback not specified
|
|
573
|
+
*/
|
|
574
|
+
off(event: string, listener?: (...args: any[]) => void): void;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Subscribe to an event, but only once. The listener is removed after the first call.
|
|
578
|
+
*/
|
|
579
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Gets one value by given key.
|
|
583
|
+
*/
|
|
584
|
+
getResource(
|
|
585
|
+
lng: string,
|
|
586
|
+
ns: string,
|
|
587
|
+
key: string,
|
|
588
|
+
options?: Pick<InitOptions, 'keySeparator' | 'ignoreJSONStructure'>,
|
|
589
|
+
): any;
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Adds one key/value.
|
|
593
|
+
*/
|
|
594
|
+
addResource(
|
|
595
|
+
lng: string,
|
|
596
|
+
ns: string,
|
|
597
|
+
key: string,
|
|
598
|
+
value: string,
|
|
599
|
+
options?: { keySeparator?: string; silent?: boolean },
|
|
600
|
+
): i18n;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Adds multiple key/values.
|
|
604
|
+
*/
|
|
605
|
+
addResources(lng: string, ns: string, resources: any): i18n;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Adds a complete bundle.
|
|
609
|
+
* Setting deep param to true will extend existing translations in that file.
|
|
610
|
+
* Setting overwrite to true it will overwrite existing translations in that file.
|
|
611
|
+
*/
|
|
612
|
+
addResourceBundle(
|
|
613
|
+
lng: string,
|
|
614
|
+
ns: string,
|
|
615
|
+
resources: any,
|
|
616
|
+
deep?: boolean,
|
|
617
|
+
overwrite?: boolean,
|
|
618
|
+
options?: { silent?: boolean; skipCopy?: boolean },
|
|
619
|
+
): i18n;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Checks if a resource bundle exists.
|
|
623
|
+
*/
|
|
624
|
+
hasResourceBundle(lng: string, ns: string): boolean;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Returns a resource bundle.
|
|
628
|
+
*/
|
|
629
|
+
getResourceBundle(lng: string, ns: string): any;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Removes an existing bundle.
|
|
633
|
+
*/
|
|
634
|
+
removeResourceBundle(lng: string, ns: string): i18n;
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Current options
|
|
638
|
+
*/
|
|
639
|
+
options: InitOptions;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Is initialized. Set by `init()` and `hydrate()`; writing it from outside is deprecated (still
|
|
643
|
+
* possible in v27), SSR integrations should call `hydrate()` instead.
|
|
644
|
+
*/
|
|
645
|
+
isInitialized: boolean;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Is initializing
|
|
649
|
+
*/
|
|
650
|
+
isInitializing: boolean;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Store was initialized. Set by `hydrate()`; writing it from outside is deprecated (still possible in
|
|
654
|
+
* v27), SSR integrations should call `hydrate()` instead.
|
|
655
|
+
*/
|
|
656
|
+
initializedStoreOnce: boolean;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Language was initialized. Set by `hydrate()`; writing it from outside is deprecated (still possible
|
|
660
|
+
* in v27), SSR integrations should call `hydrate()` instead.
|
|
661
|
+
*/
|
|
662
|
+
initializedLanguageOnce: boolean;
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Emit event
|
|
666
|
+
*/
|
|
667
|
+
emit(eventName: string, ...args: any[]): void;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export type * from './typescript/options.js';
|
|
671
|
+
export type {
|
|
672
|
+
// we need to explicitely export some types, to prevent some issues with next-i18next and interpolation variable validation, etc...
|
|
673
|
+
FallbackLngObjList,
|
|
674
|
+
FallbackLng,
|
|
675
|
+
InitOptions,
|
|
676
|
+
TypeOptions,
|
|
677
|
+
CustomTypeOptions,
|
|
678
|
+
ResourceNamespaceMap,
|
|
679
|
+
CustomPluginOptions,
|
|
680
|
+
PluginOptions,
|
|
681
|
+
FormatFunction,
|
|
682
|
+
InterpolationOptions,
|
|
683
|
+
ReactOptions,
|
|
684
|
+
ResourceKey,
|
|
685
|
+
ResourceLanguage,
|
|
686
|
+
Resource,
|
|
687
|
+
TOptions,
|
|
688
|
+
Namespace,
|
|
689
|
+
DefaultNamespace,
|
|
690
|
+
FlatNamespace,
|
|
691
|
+
} from './typescript/options.js';
|
|
692
|
+
export type * from './typescript/t.js';
|
|
693
|
+
export type {
|
|
694
|
+
TFunction,
|
|
695
|
+
ParseKeys,
|
|
696
|
+
TFunctionReturn,
|
|
697
|
+
TFunctionDetailedResult,
|
|
698
|
+
KeyPrefix,
|
|
699
|
+
KeyPrefixSelector,
|
|
700
|
+
NsResource,
|
|
701
|
+
InterpolationMap,
|
|
702
|
+
SelectorKey,
|
|
703
|
+
ParseKeysWithoutVariables,
|
|
704
|
+
// used by react-i18next
|
|
705
|
+
SelectorFn,
|
|
706
|
+
ApplyTarget,
|
|
707
|
+
ConstrainTarget,
|
|
708
|
+
GetSource,
|
|
709
|
+
} from './typescript/t.js';
|
|
710
|
+
|
|
711
|
+
declare const i18next: i18n;
|
|
712
|
+
export default i18next;
|
|
713
|
+
|
|
714
|
+
export const createInstance: i18n['createInstance'];
|
|
715
|
+
|
|
716
|
+
export const dir: i18n['dir'];
|
|
717
|
+
export const init: i18n['init'];
|
|
718
|
+
export const loadResources: i18n['loadResources'];
|
|
719
|
+
export const reloadResources: i18n['reloadResources'];
|
|
720
|
+
export const use: i18n['use'];
|
|
721
|
+
export const changeLanguage: i18n['changeLanguage'];
|
|
722
|
+
export const getFixedT: i18n['getFixedT'];
|
|
723
|
+
export const t: i18n['t'];
|
|
724
|
+
export const exists: i18n['exists'];
|
|
725
|
+
export const setDefaultNamespace: i18n['setDefaultNamespace'];
|
|
726
|
+
export const hasLoadedNamespace: i18n['hasLoadedNamespace'];
|
|
727
|
+
export const loadNamespaces: i18n['loadNamespaces'];
|
|
728
|
+
export const loadLanguages: i18n['loadLanguages'];
|
|
729
|
+
|
|
730
|
+
export declare const keyFromSelector: KeyFromSelectorFn;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Whether a language code has the shape i18next accepts from outside (`lng`, `changeLanguage()`,
|
|
734
|
+
* language detectors) without it being configured: letters, digits, `-`, `_`, `@` and `.` (no `..`), at
|
|
735
|
+
* most 128 characters, not a prototype key. Since v27 other codes are refused unless they are listed in
|
|
736
|
+
* `supportedLngs`, `fallbackLng`, `preload` or the resources. Not a BCP 47 check: `'en_US'` and
|
|
737
|
+
* `'sr@latin'` pass. For plugins that take a language from a request, a URL or storage. Since v26.7.0.
|
|
738
|
+
*/
|
|
739
|
+
export declare const isSafeLanguageCode: (code: unknown) => boolean;
|