@o3r/localization 15.3.0-prerelease.15 → 15.3.0-prerelease.17
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/fesm2022/o3r-localization-rules-engine.mjs +89 -56
- package/fesm2022/o3r-localization-rules-engine.mjs.map +1 -1
- package/fesm2022/o3r-localization.mjs +1219 -1162
- package/fesm2022/o3r-localization.mjs.map +1 -1
- package/package.json +7 -7
- package/types/o3r-localization-rules-engine.d.ts +21 -27
- package/types/o3r-localization-rules-engine.d.ts.map +1 -1
- package/types/o3r-localization.d.ts +637 -664
- package/types/o3r-localization.d.ts.map +1 -1
|
@@ -1,741 +1,719 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { LoggerService } from '@o3r/logger';
|
|
17
|
-
|
|
1
|
+
import { ConnectContentMessage, ContextualizationDevtoolsCommonOptions, DevtoolsCommonOptions, DevtoolsServiceInterface, MessageDataTypes, OtterMessageContent, RequestMessagesContentMessage, Serializer, SetStateActionPayload, Translation, Translation as Translation$1 } from "@o3r/core";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectorRef, FactoryProvider, InjectionToken, ModuleWithProviders, OnDestroy, PipeTransform } from "@angular/core";
|
|
4
|
+
import * as i6 from "@ngx-translate/core";
|
|
5
|
+
import { TranslateCompiler, TranslateDirective, TranslateLoader, TranslatePipe, TranslateService } from "@ngx-translate/core";
|
|
6
|
+
import { Options } from "intl-messageformat";
|
|
7
|
+
import { Observable, Subscription } from "rxjs";
|
|
8
|
+
import * as i8 from "@angular/common";
|
|
9
|
+
import { CurrencyPipe, DatePipe, DecimalPipe } from "@angular/common";
|
|
10
|
+
import * as i7 from "@angular/cdk/bidi";
|
|
11
|
+
import { Direction, Directionality } from "@angular/cdk/bidi";
|
|
12
|
+
import * as i1 from "@ngrx/store";
|
|
13
|
+
import { Action, ActionCreator, ActionReducer, ReducerTypes } from "@ngrx/store";
|
|
14
|
+
import { DynamicContentService } from "@o3r/dynamic-content";
|
|
15
|
+
import { LoggerService } from "@o3r/logger";
|
|
18
16
|
/**
|
|
19
17
|
* Decorator to pass localization url
|
|
20
18
|
* @param _url
|
|
21
19
|
*/
|
|
22
|
-
declare function Localization(_url: string): (target: any, key: string) => void;
|
|
23
|
-
|
|
20
|
+
export declare function Localization(_url: string): (target: any, key: string) => void;
|
|
24
21
|
/** Object mapping of a localized string */
|
|
25
|
-
interface JSONLocalization {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
export interface JSONLocalization {
|
|
23
|
+
/** The key of the localized string. */
|
|
24
|
+
key: string;
|
|
25
|
+
/** The description of the key used to give some context to the translators. */
|
|
26
|
+
description: string;
|
|
27
|
+
/** True means that the key will be mapped to a dictionary in the CMS. */
|
|
28
|
+
dictionary: boolean;
|
|
29
|
+
/** True means that the value has to be overriden in the CMS. */
|
|
30
|
+
referenceData: boolean;
|
|
31
|
+
/** Tags used to filter/categorize localization strings */
|
|
32
|
+
tags?: string[];
|
|
33
|
+
/** The default value for EN language. It is mandatory if dictionary is set to false. */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Reference to another key. */
|
|
36
|
+
ref?: string;
|
|
40
37
|
}
|
|
41
38
|
/** Localization Metadata file structure */
|
|
42
|
-
type LocalizationMetadata = JSONLocalization[];
|
|
43
|
-
|
|
39
|
+
export type LocalizationMetadata = JSONLocalization[];
|
|
44
40
|
/**
|
|
45
41
|
* Describes configuration for LocalizationModule
|
|
46
42
|
*/
|
|
47
|
-
interface LocalizationConfiguration {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
43
|
+
export interface LocalizationConfiguration {
|
|
44
|
+
/** List of available languages */
|
|
45
|
+
supportedLocales: string[];
|
|
46
|
+
/** Application display language */
|
|
47
|
+
language?: string;
|
|
48
|
+
/** Url to fetch translation bundles from */
|
|
49
|
+
endPointUrl: string;
|
|
50
|
+
/** Prefix endPoinrUrl with dynamicContentPath provided by DynamicContentPath */
|
|
51
|
+
useDynamicContent: boolean;
|
|
52
|
+
/** List of RTL language codes */
|
|
53
|
+
rtlLanguages: string[];
|
|
54
|
+
/**
|
|
55
|
+
* Fallback language map of resource in case translation in language does not exist.
|
|
56
|
+
* translate to unsupported language will try to map to supportedLocales from below property.
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* {
|
|
60
|
+
* supportedLocales: ['en-GB', 'en-US', 'fr-FR'],
|
|
61
|
+
* fallbackLocalesMap: {'en-CA': 'en-US', 'de': 'fr-FR'}
|
|
62
|
+
* }
|
|
63
|
+
* // translate to en-CA -> fallback to en-US, translate to de-DE -> fallback to fr-FR,
|
|
64
|
+
* // translate to en-NZ -> fallback to en-GB, translate to en -> fallback to en-GB.
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
fallbackLocalesMap?: {
|
|
68
|
+
[supportedLocale: string]: string;
|
|
69
|
+
};
|
|
70
|
+
/** Fallback language of resource in case translation in language does not exist */
|
|
71
|
+
fallbackLanguage: string;
|
|
72
|
+
/** Path relative to published folder where webpack will copy translation bundles */
|
|
73
|
+
bundlesOutputPath: string;
|
|
74
|
+
/** Debug mode switch */
|
|
75
|
+
debugMode: boolean;
|
|
76
|
+
/** Query parameters for fetching the localization resources */
|
|
77
|
+
queryParams?: {
|
|
78
|
+
[key: string]: string;
|
|
79
|
+
};
|
|
80
|
+
/** Fetch options object as per https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters */
|
|
81
|
+
fetchOptions?: RequestInit;
|
|
82
|
+
/** Enable the ability to switch the translations on and off at runtime. */
|
|
83
|
+
enableTranslationDeactivation: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Merge the translations from DynamicContentPath with the local translations
|
|
86
|
+
* Warning: Enable this option will download two localization bundles and can delay the display of the text on application first page
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
mergeWithLocalTranslations: boolean;
|
|
94
90
|
}
|
|
95
91
|
/**
|
|
96
92
|
* Default configuration for LocalizationModule
|
|
97
93
|
*/
|
|
98
|
-
declare const DEFAULT_LOCALIZATION_CONFIGURATION: Readonly<LocalizationConfiguration>;
|
|
99
|
-
|
|
94
|
+
export declare const DEFAULT_LOCALIZATION_CONFIGURATION: Readonly<LocalizationConfiguration>;
|
|
100
95
|
/**
|
|
101
96
|
* Translatable item
|
|
102
97
|
*/
|
|
103
|
-
interface Translatable<T extends Translation> {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
export interface Translatable<T extends Translation$1> {
|
|
99
|
+
/**
|
|
100
|
+
* translations map
|
|
101
|
+
*/
|
|
102
|
+
translations: T;
|
|
108
103
|
}
|
|
109
|
-
|
|
110
104
|
/**
|
|
111
105
|
* Options for Lazy Message Format compiler
|
|
112
106
|
*/
|
|
113
|
-
interface LazyMessageFormatConfig extends Options {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
export interface LazyMessageFormatConfig extends Options {
|
|
108
|
+
/**
|
|
109
|
+
* Enables compiled translation caching
|
|
110
|
+
* @default true
|
|
111
|
+
*/
|
|
112
|
+
enableCache?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Enables HTML in translation
|
|
115
|
+
* @default true
|
|
116
|
+
*/
|
|
117
|
+
ignoreTag?: boolean;
|
|
124
118
|
}
|
|
125
119
|
/**
|
|
126
120
|
* Message format configuration default value
|
|
127
121
|
*/
|
|
128
|
-
declare const lazyMessageDefaultConfig: Readonly<LazyMessageFormatConfig>;
|
|
122
|
+
export declare const lazyMessageDefaultConfig: Readonly<LazyMessageFormatConfig>;
|
|
129
123
|
/** Message Format configuration Token */
|
|
130
|
-
declare const MESSAGE_FORMAT_CONFIG: InjectionToken<LazyMessageFormatConfig>;
|
|
124
|
+
export declare const MESSAGE_FORMAT_CONFIG: InjectionToken<LazyMessageFormatConfig>;
|
|
131
125
|
/**
|
|
132
126
|
* This compiler expects ICU syntax and compiles the expressions with messageformat.js
|
|
133
127
|
* Compare to ngx-translate-messageformat-compiler package, the compilation of the translation is done only on demand
|
|
134
128
|
*/
|
|
135
|
-
declare class TranslateMessageFormatLazyCompiler extends TranslateCompiler {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
metadataFilePath: string;
|
|
129
|
+
export declare class TranslateMessageFormatLazyCompiler extends TranslateCompiler {
|
|
130
|
+
/** Configuration */
|
|
131
|
+
private readonly config;
|
|
132
|
+
/** Cache of compiled translations */
|
|
133
|
+
private cache;
|
|
134
|
+
constructor();
|
|
135
|
+
/**
|
|
136
|
+
* Clear the cache of the compiled translations
|
|
137
|
+
*/
|
|
138
|
+
clearCache(): void;
|
|
139
|
+
/** @inheritDoc */
|
|
140
|
+
compile(value: string, lang: string): (params: any) => string;
|
|
141
|
+
/** @inheritDoc */
|
|
142
|
+
compileTranslations(translations: {
|
|
143
|
+
[x: string]: any;
|
|
144
|
+
}, lang: string): {
|
|
145
|
+
[x: string]: (params: any) => string;
|
|
146
|
+
};
|
|
147
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslateMessageFormatLazyCompiler, never>;
|
|
148
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
149
|
+
}
|
|
150
|
+
export interface LocalizationDevtoolsServiceOptions extends DevtoolsCommonOptions, ContextualizationDevtoolsCommonOptions {
|
|
151
|
+
metadataFilePath: string;
|
|
159
152
|
}
|
|
160
153
|
/** Localizations message content */
|
|
161
|
-
interface LocalizationsContentMessage extends OtterMessageContent<'localizations'> {
|
|
162
|
-
|
|
163
|
-
|
|
154
|
+
export interface LocalizationsContentMessage extends OtterMessageContent<'localizations'> {
|
|
155
|
+
/** Localizations metadata */
|
|
156
|
+
localizations: LocalizationMetadata;
|
|
164
157
|
}
|
|
165
158
|
/** Languages message content */
|
|
166
|
-
interface LanguagesContentMessage extends OtterMessageContent<'languages'> {
|
|
167
|
-
|
|
168
|
-
|
|
159
|
+
export interface LanguagesContentMessage extends OtterMessageContent<'languages'> {
|
|
160
|
+
/** Languages available */
|
|
161
|
+
languages: string[];
|
|
169
162
|
}
|
|
170
163
|
/** Switch languages message content */
|
|
171
|
-
interface SwitchLanguageContentMessage extends OtterMessageContent<'switchLanguage'> {
|
|
172
|
-
|
|
173
|
-
|
|
164
|
+
export interface SwitchLanguageContentMessage extends OtterMessageContent<'switchLanguage'> {
|
|
165
|
+
/** Language */
|
|
166
|
+
language: string;
|
|
174
167
|
}
|
|
175
168
|
/** Display localization key message content */
|
|
176
|
-
interface DisplayLocalizationKeysContentMessage extends OtterMessageContent<'displayLocalizationKeys'> {
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
export interface DisplayLocalizationKeysContentMessage extends OtterMessageContent<'displayLocalizationKeys'> {
|
|
170
|
+
/** Toggle the display of the localization keys */
|
|
171
|
+
toggle?: boolean;
|
|
179
172
|
}
|
|
180
173
|
/** Update localization message content */
|
|
181
|
-
interface UpdateLocalizationContentMessage extends OtterMessageContent<'updateLocalization'> {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
174
|
+
export interface UpdateLocalizationContentMessage extends OtterMessageContent<'updateLocalization'> {
|
|
175
|
+
/** Localization key */
|
|
176
|
+
key: string;
|
|
177
|
+
/** Localization value */
|
|
178
|
+
value: string;
|
|
179
|
+
/** Lang */
|
|
180
|
+
lang?: string;
|
|
188
181
|
}
|
|
189
182
|
/** Reload localization Keys message content */
|
|
190
|
-
interface ReloadLocalizationKeysContentMessage extends OtterMessageContent<'reloadLocalizationKeys'> {
|
|
191
|
-
|
|
192
|
-
|
|
183
|
+
export interface ReloadLocalizationKeysContentMessage extends OtterMessageContent<'reloadLocalizationKeys'> {
|
|
184
|
+
/** Lang */
|
|
185
|
+
lang?: string;
|
|
193
186
|
}
|
|
194
|
-
interface IsTranslationDeactivationEnabledContentMessage extends OtterMessageContent<'isTranslationDeactivationEnabled'> {
|
|
195
|
-
|
|
187
|
+
export interface IsTranslationDeactivationEnabledContentMessage extends OtterMessageContent<'isTranslationDeactivationEnabled'> {
|
|
188
|
+
enabled: boolean;
|
|
196
189
|
}
|
|
197
|
-
interface GetTranslationValuesContentMessage extends OtterMessageContent<'getTranslationValuesContentMessage'> {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
190
|
+
export interface GetTranslationValuesContentMessage extends OtterMessageContent<'getTranslationValuesContentMessage'> {
|
|
191
|
+
translations: {
|
|
192
|
+
[localizationKey: string]: string;
|
|
193
|
+
};
|
|
201
194
|
}
|
|
202
195
|
type LocalizationMessageContents = LanguagesContentMessage | ReloadLocalizationKeysContentMessage | SwitchLanguageContentMessage | LocalizationsContentMessage | DisplayLocalizationKeysContentMessage | UpdateLocalizationContentMessage | IsTranslationDeactivationEnabledContentMessage | GetTranslationValuesContentMessage;
|
|
203
196
|
/** List of possible DataTypes for Localization messages */
|
|
204
|
-
type LocalizationMessageDataTypes = MessageDataTypes<LocalizationMessageContents>;
|
|
197
|
+
export type LocalizationMessageDataTypes = MessageDataTypes<LocalizationMessageContents>;
|
|
205
198
|
/** List of all messages for Localization purpose */
|
|
206
|
-
type AvailableLocalizationMessageContents = LocalizationMessageContents | ConnectContentMessage | RequestMessagesContentMessage<LocalizationMessageDataTypes>;
|
|
199
|
+
export type AvailableLocalizationMessageContents = LocalizationMessageContents | ConnectContentMessage | RequestMessagesContentMessage<LocalizationMessageDataTypes>;
|
|
207
200
|
/**
|
|
208
201
|
* Contextualization devtools exposed for localization in CMS integration
|
|
209
202
|
*/
|
|
210
|
-
interface LocalizationContextualizationDevtools {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationDevtoolsMessageService, never>;
|
|
373
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
374
|
-
}
|
|
375
|
-
|
|
203
|
+
export interface LocalizationContextualizationDevtools {
|
|
204
|
+
/**
|
|
205
|
+
* Is the translation deactivation enabled
|
|
206
|
+
*/
|
|
207
|
+
isTranslationDeactivationEnabled(): boolean | Promise<boolean>;
|
|
208
|
+
/**
|
|
209
|
+
* Show localization keys
|
|
210
|
+
* @param value value enforced by the DevTools extension
|
|
211
|
+
*/
|
|
212
|
+
showLocalizationKeys: (value?: boolean) => void | Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Returns the current language
|
|
215
|
+
*/
|
|
216
|
+
getCurrentLanguage: () => string | Promise<string>;
|
|
217
|
+
/**
|
|
218
|
+
* Switch the current language to the specified value
|
|
219
|
+
* @param language new language to switch to
|
|
220
|
+
*/
|
|
221
|
+
switchLanguage: (language: string) => Promise<{
|
|
222
|
+
previous: string;
|
|
223
|
+
requested: string;
|
|
224
|
+
current: string;
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Setup a listener on language change
|
|
228
|
+
* @param fn called when the language is changed in the app
|
|
229
|
+
*/
|
|
230
|
+
onLanguageChange: (fn: (language: string) => any) => Subscription;
|
|
231
|
+
/**
|
|
232
|
+
* Updates the specified localization key/values for the current language
|
|
233
|
+
* @param keyValues key/values to update
|
|
234
|
+
* @param language if not provided, the current language value
|
|
235
|
+
*/
|
|
236
|
+
updateLocalizationKeys: (keyValues: {
|
|
237
|
+
[key: string]: string;
|
|
238
|
+
}, language?: string) => void | Promise<void>;
|
|
239
|
+
/**
|
|
240
|
+
* Reload a language from the language file
|
|
241
|
+
* @see https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.service.ts#L490
|
|
242
|
+
* @param language language to reload
|
|
243
|
+
*/
|
|
244
|
+
reloadLocalizationKeys: (language?: string) => Promise<void>;
|
|
245
|
+
}
|
|
246
|
+
export declare class OtterLocalizationDevtools {
|
|
247
|
+
private readonly localizationService;
|
|
248
|
+
private readonly translateCompiler;
|
|
249
|
+
private readonly appRef;
|
|
250
|
+
/**
|
|
251
|
+
* Is the translation deactivation enabled
|
|
252
|
+
*/
|
|
253
|
+
isTranslationDeactivationEnabled(): boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Show localization keys
|
|
256
|
+
* @param value value enforced by the DevTools extension
|
|
257
|
+
*/
|
|
258
|
+
showLocalizationKeys(value?: boolean): void;
|
|
259
|
+
/**
|
|
260
|
+
* Returns the current language
|
|
261
|
+
*/
|
|
262
|
+
getCurrentLanguage(): string;
|
|
263
|
+
/**
|
|
264
|
+
* Setup a listener on language change
|
|
265
|
+
* @param fn called when the language is changed in the app
|
|
266
|
+
*/
|
|
267
|
+
onLanguageChange(fn: (language: string) => any): Subscription;
|
|
268
|
+
/**
|
|
269
|
+
* Switch the current language to the specified value
|
|
270
|
+
* @param language new language to switch to
|
|
271
|
+
*/
|
|
272
|
+
switchLanguage(language: string | undefined): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Updates the specified localization key/values for the current language.
|
|
275
|
+
*
|
|
276
|
+
* Recommendation: To be used with a small number of keys to update to avoid performance issues.
|
|
277
|
+
* @param keyValues key/values to update
|
|
278
|
+
* @param language if not provided, the current language value
|
|
279
|
+
*/
|
|
280
|
+
updateLocalizationKeys(keyValues: {
|
|
281
|
+
[key: string]: string;
|
|
282
|
+
}, language?: string): void | Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Reload a language from the language file
|
|
285
|
+
* @see https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.service.ts#L490
|
|
286
|
+
* @param language language to reload
|
|
287
|
+
*/
|
|
288
|
+
reloadLocalizationKeys(language?: string): Promise<void>;
|
|
289
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<OtterLocalizationDevtools, never>;
|
|
290
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
291
|
+
}
|
|
292
|
+
export declare class LocalizationDevtoolsConsoleService implements DevtoolsServiceInterface, LocalizationContextualizationDevtools {
|
|
293
|
+
/** Name of the Window property to access to the devtools */
|
|
294
|
+
static readonly windowModuleName = "localization";
|
|
295
|
+
private readonly localizationDevtools;
|
|
296
|
+
private readonly options;
|
|
297
|
+
constructor();
|
|
298
|
+
/** @inheritDoc */
|
|
299
|
+
activate(): void;
|
|
300
|
+
/**
|
|
301
|
+
* @inheritdoc
|
|
302
|
+
*/
|
|
303
|
+
isTranslationDeactivationEnabled(): boolean | Promise<boolean>;
|
|
304
|
+
/**
|
|
305
|
+
* @inheritdoc
|
|
306
|
+
*/
|
|
307
|
+
showLocalizationKeys(value?: boolean): void | Promise<void>;
|
|
308
|
+
/**
|
|
309
|
+
* @inheritdoc
|
|
310
|
+
*/
|
|
311
|
+
getCurrentLanguage(): string | Promise<string>;
|
|
312
|
+
/**
|
|
313
|
+
* @inheritdoc
|
|
314
|
+
*/
|
|
315
|
+
switchLanguage(language: string): Promise<{
|
|
316
|
+
previous: string;
|
|
317
|
+
requested: string;
|
|
318
|
+
current: string;
|
|
319
|
+
}>;
|
|
320
|
+
/**
|
|
321
|
+
* @inheritdoc
|
|
322
|
+
*/
|
|
323
|
+
onLanguageChange(fn: (language: string) => any): Subscription;
|
|
324
|
+
/**
|
|
325
|
+
* @inheritdoc
|
|
326
|
+
*/
|
|
327
|
+
updateLocalizationKeys(keyValues: {
|
|
328
|
+
[key: string]: string;
|
|
329
|
+
}, language?: string): void | Promise<void>;
|
|
330
|
+
/**
|
|
331
|
+
* @inheritdoc
|
|
332
|
+
*/
|
|
333
|
+
reloadLocalizationKeys(language?: string): Promise<void>;
|
|
334
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationDevtoolsConsoleService, never>;
|
|
335
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
336
|
+
}
|
|
337
|
+
export declare class LocalizationDevtoolsMessageService {
|
|
338
|
+
private readonly logger;
|
|
339
|
+
private readonly localizationDevTools;
|
|
340
|
+
private readonly localizationService;
|
|
341
|
+
private readonly options;
|
|
342
|
+
private readonly sendMessage;
|
|
343
|
+
private readonly destroyRef;
|
|
344
|
+
constructor();
|
|
345
|
+
private sendLocalizationsMetadata;
|
|
346
|
+
/**
|
|
347
|
+
* Function to trigger a re-send a requested messages to the Otter Chrome DevTools extension
|
|
348
|
+
* @param only restricted list of messages to re-send
|
|
349
|
+
*/
|
|
350
|
+
private handleReEmitRequest;
|
|
351
|
+
/**
|
|
352
|
+
* Function to handle the incoming messages from Otter Chrome DevTools extension
|
|
353
|
+
* @param message Message coming from the Otter Chrome DevTools extension
|
|
354
|
+
*/
|
|
355
|
+
private handleEvents;
|
|
356
|
+
/**
|
|
357
|
+
* Function to connect the plugin to the Otter Chrome DevTools extension
|
|
358
|
+
*/
|
|
359
|
+
private connectPlugin;
|
|
360
|
+
/** @inheritDoc */
|
|
361
|
+
activate(): void;
|
|
362
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationDevtoolsMessageService, never>;
|
|
363
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
364
|
+
}
|
|
376
365
|
/**
|
|
377
366
|
* Service which is wrapping the configuration logic of TranslateService from ngx-translate
|
|
378
367
|
* Any application willing to use localization just needs to inject LocalizationService
|
|
379
368
|
* in the root component and call its configure() method.
|
|
380
369
|
*/
|
|
381
|
-
declare class LocalizationService {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
370
|
+
export declare class LocalizationService {
|
|
371
|
+
private readonly translateService;
|
|
372
|
+
private readonly logger;
|
|
373
|
+
private readonly configuration;
|
|
374
|
+
private readonly store;
|
|
375
|
+
private readonly localeSplitIdentifier;
|
|
376
|
+
/**
|
|
377
|
+
* Internal subject that we use to track changes between keys only and translation mode
|
|
378
|
+
*/
|
|
379
|
+
private readonly _showKeys$;
|
|
380
|
+
/**
|
|
381
|
+
* Map of localization keys to replace a key to another
|
|
382
|
+
*/
|
|
383
|
+
private readonly keyMapping$?;
|
|
384
|
+
/**
|
|
385
|
+
* _showKeys$ exposed as an Observable
|
|
386
|
+
*/
|
|
387
|
+
showKeys$: Observable<boolean>;
|
|
388
|
+
constructor();
|
|
389
|
+
/**
|
|
390
|
+
* This will handle the fallback language hierarchy to find out fallback language.
|
|
391
|
+
* supportedLocales language has highest priority, next priority goes to fallbackLocalesMap and default would be
|
|
392
|
+
* fallbackLanguage.
|
|
393
|
+
* @param language Selected language.
|
|
394
|
+
* @returns selected language if supported, fallback language otherwise.
|
|
395
|
+
*/
|
|
396
|
+
private checkFallbackLocalesMap;
|
|
397
|
+
/**
|
|
398
|
+
* This function checks if fallback language can be provided from fallbackLocalesMap.
|
|
399
|
+
* supportedLocales: ['en-GB', 'en-US', 'fr-FR'], fallbackLocalesMap: {'en-CA': 'en-US', 'de': 'fr-FR'}
|
|
400
|
+
* translate to en-CA -> fallback to en-US, translate to de-DE -> fallback to fr-FR
|
|
401
|
+
* translate to en-NZ -> fallback to en-GB
|
|
402
|
+
* @param language Selected language.
|
|
403
|
+
* @returns Fallback language if available, undefined otherwise.
|
|
404
|
+
*/
|
|
405
|
+
private getFallbackMapLangCode;
|
|
406
|
+
/**
|
|
407
|
+
* This function checks if closest supported language available incase of selected language is not
|
|
408
|
+
* supported language.
|
|
409
|
+
* supportedLocales: ['en-GB', 'en-US', 'fr-FR']
|
|
410
|
+
* translate to en-CA -> fallback to en-GB
|
|
411
|
+
* @param language Selected language.
|
|
412
|
+
* @returns Closest supported language if available, undefined otherwise.
|
|
413
|
+
*/
|
|
414
|
+
private getFirstClosestSupportedLanguageCode;
|
|
415
|
+
/**
|
|
416
|
+
* Returns a stream of translated values of a key which updates whenever the language changes.
|
|
417
|
+
* @param translationKey Key to translate
|
|
418
|
+
* @param interpolateParams Object to use in translation binding
|
|
419
|
+
* @returns A stream of the translated key
|
|
420
|
+
*/
|
|
421
|
+
private getTranslationStream;
|
|
422
|
+
/**
|
|
423
|
+
* Configures TranslateService and registers locales. This method is called from the application level.
|
|
424
|
+
*/
|
|
425
|
+
configure(): Promise<void>;
|
|
426
|
+
/**
|
|
427
|
+
* Is the translation deactivation enabled
|
|
428
|
+
*/
|
|
429
|
+
isTranslationDeactivationEnabled(): boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Wrapper to call the ngx-translate service TranslateService method getLangs().
|
|
432
|
+
*/
|
|
433
|
+
getLanguages(): string[];
|
|
434
|
+
/**
|
|
435
|
+
* Wrapper to call the ngx-translate service TranslateService method use(language).
|
|
436
|
+
* @param language
|
|
437
|
+
*/
|
|
438
|
+
useLanguage(language: string): Observable<any>;
|
|
439
|
+
/**
|
|
440
|
+
* Wrapper to get the ngx-translate service TranslateService currentLang.
|
|
441
|
+
*/
|
|
442
|
+
getCurrentLanguage(): string;
|
|
443
|
+
/**
|
|
444
|
+
* Get the instance of the ngx-translate TranslateService used by LocalizationService.
|
|
445
|
+
*/
|
|
446
|
+
getTranslateService(): TranslateService;
|
|
447
|
+
/**
|
|
448
|
+
* Toggle the ShowKeys mode between active and inactive.
|
|
449
|
+
* @param value if specified, set the ShowKeys mode to value. If not specified, toggle the ShowKeys mode.
|
|
450
|
+
*/
|
|
451
|
+
toggleShowKeys(value?: boolean): void;
|
|
452
|
+
/**
|
|
453
|
+
* Return the current value of debug show/hide translation keys.
|
|
454
|
+
*/
|
|
455
|
+
get showKeys(): boolean;
|
|
456
|
+
/**
|
|
457
|
+
* Get an observable of translation key after global mapping
|
|
458
|
+
* @param requestedKey Original translation key
|
|
459
|
+
*/
|
|
460
|
+
getKey(requestedKey: string): Observable<any>;
|
|
461
|
+
/**
|
|
462
|
+
* Returns a stream of translated values of a key which updates whenever the language changes.
|
|
463
|
+
* @param key Key to translate
|
|
464
|
+
* @param interpolateParams Object to use in translation binding
|
|
465
|
+
* @returns A stream of the translated key
|
|
466
|
+
*/
|
|
467
|
+
translate(key: string, interpolateParams?: object): Observable<any>;
|
|
468
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationService, never>;
|
|
469
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
470
|
+
}
|
|
483
471
|
/**
|
|
484
472
|
* TranslatePipe class adding debug functionality
|
|
485
473
|
*/
|
|
486
|
-
declare class O3rLocalizationTranslatePipe extends TranslatePipe implements PipeTransform, OnDestroy {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
|
|
474
|
+
export declare class O3rLocalizationTranslatePipe extends TranslatePipe implements PipeTransform, OnDestroy {
|
|
475
|
+
/** Localization service instance */
|
|
476
|
+
protected readonly localizationService: LocalizationService;
|
|
477
|
+
/** Change detector service instance */
|
|
478
|
+
protected readonly changeDetector: ChangeDetectorRef;
|
|
479
|
+
/** Localization config token */
|
|
480
|
+
protected readonly localizationConfig: LocalizationConfiguration;
|
|
481
|
+
/**
|
|
482
|
+
* Internal subscription to the LocalizationService showKeys mode changes
|
|
483
|
+
*/
|
|
484
|
+
protected readonly onShowKeysChange?: Subscription;
|
|
485
|
+
/**
|
|
486
|
+
* Internal subscription to the LocalizationService key mapping
|
|
487
|
+
*/
|
|
488
|
+
protected onKeyChange?: Subscription;
|
|
489
|
+
/**
|
|
490
|
+
* Should we display keys instead of translations
|
|
491
|
+
*/
|
|
492
|
+
protected showKeys: boolean;
|
|
493
|
+
/** last key queried */
|
|
494
|
+
protected lastQueryKey?: string;
|
|
495
|
+
/** last key resolved */
|
|
496
|
+
protected lastResolvedKey?: string;
|
|
497
|
+
constructor();
|
|
498
|
+
/**
|
|
499
|
+
* Calls original transform method and eventually outputs the key if debugMode (in LocalizationConfiguration) is enabled
|
|
500
|
+
* @inheritdoc
|
|
501
|
+
*/
|
|
502
|
+
transform(query: string, ...args: any[]): any;
|
|
503
|
+
ngOnDestroy(): void;
|
|
504
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<O3rLocalizationTranslatePipe, never>;
|
|
505
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<O3rLocalizationTranslatePipe, "o3rTranslate", false>;
|
|
506
|
+
}
|
|
520
507
|
/**
|
|
521
508
|
* TranslateDirective class adding debug functionality
|
|
522
509
|
*/
|
|
523
|
-
declare class LocalizationTranslateDirective extends TranslateDirective implements OnDestroy {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
510
|
+
export declare class LocalizationTranslateDirective extends TranslateDirective implements OnDestroy {
|
|
511
|
+
private readonly localizationService;
|
|
512
|
+
private readonly localizationConfig;
|
|
513
|
+
/**
|
|
514
|
+
* Internal subscription to the LocalizationService showKeys mode changes
|
|
515
|
+
*/
|
|
516
|
+
private readonly onShowKeysChange?;
|
|
517
|
+
/**
|
|
518
|
+
* Should we display keys instead of translations
|
|
519
|
+
*/
|
|
520
|
+
private showKeys;
|
|
521
|
+
/**
|
|
522
|
+
* Internal subscription to the LocalizationService key mapping
|
|
523
|
+
*/
|
|
524
|
+
private onKeyChange?;
|
|
525
|
+
/** @inheritdoc */
|
|
526
|
+
set translate(key: string);
|
|
527
|
+
constructor();
|
|
528
|
+
/**
|
|
529
|
+
* Overriding parent's setContent to plug debugging feature
|
|
530
|
+
* @param node
|
|
531
|
+
* @param content
|
|
532
|
+
*/
|
|
533
|
+
setContent(node: any, content: string): void;
|
|
534
|
+
ngOnDestroy(): void;
|
|
535
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationTranslateDirective, never>;
|
|
536
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<LocalizationTranslateDirective, "[translate],[ngx-translate]", never, {
|
|
537
|
+
"translate": {
|
|
538
|
+
"alias": "translate";
|
|
539
|
+
"required": false;
|
|
540
|
+
};
|
|
541
|
+
}, {}, never, never, false, never>;
|
|
542
|
+
}
|
|
552
543
|
/**
|
|
553
544
|
* Native angular DatePipe taking the current lang into consideration
|
|
554
545
|
*/
|
|
555
|
-
declare class LocalizedDatePipe extends DatePipe implements OnDestroy, PipeTransform {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
546
|
+
export declare class LocalizedDatePipe extends DatePipe implements OnDestroy, PipeTransform {
|
|
547
|
+
private readonly onLangChange;
|
|
548
|
+
private readonly localizationService;
|
|
549
|
+
private readonly changeDetectorRef;
|
|
550
|
+
constructor();
|
|
551
|
+
/**
|
|
552
|
+
* @inheritdoc
|
|
553
|
+
*/
|
|
554
|
+
transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
|
|
555
|
+
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
|
|
556
|
+
transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
|
|
557
|
+
ngOnDestroy(): void;
|
|
558
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizedDatePipe, never>;
|
|
559
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<LocalizedDatePipe, "date", false>;
|
|
560
|
+
}
|
|
571
561
|
/**
|
|
572
562
|
* Native angular DecimalPipe taking the current lang into consideration
|
|
573
563
|
*/
|
|
574
|
-
declare class LocalizedDecimalPipe extends DecimalPipe implements OnDestroy, PipeTransform {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}
|
|
588
|
-
|
|
564
|
+
export declare class LocalizedDecimalPipe extends DecimalPipe implements OnDestroy, PipeTransform {
|
|
565
|
+
private readonly onLangChange;
|
|
566
|
+
private readonly localizationService;
|
|
567
|
+
private readonly changeDetectorRef;
|
|
568
|
+
constructor();
|
|
569
|
+
/**
|
|
570
|
+
* @inheritdoc
|
|
571
|
+
*/
|
|
572
|
+
transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
|
|
573
|
+
transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
|
|
574
|
+
ngOnDestroy(): void;
|
|
575
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizedDecimalPipe, never>;
|
|
576
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<LocalizedDecimalPipe, "decimal", false>;
|
|
577
|
+
}
|
|
589
578
|
/**
|
|
590
579
|
* Native angular CurrencyPipe taking the current lang into consideration
|
|
591
580
|
*/
|
|
592
|
-
declare class LocalizedCurrencyPipe extends CurrencyPipe implements OnDestroy, PipeTransform {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
|
|
581
|
+
export declare class LocalizedCurrencyPipe extends CurrencyPipe implements OnDestroy, PipeTransform {
|
|
582
|
+
private readonly onLangChange;
|
|
583
|
+
private readonly localizationService;
|
|
584
|
+
private readonly changeDetectorRef;
|
|
585
|
+
constructor();
|
|
586
|
+
/**
|
|
587
|
+
* @inheritdoc
|
|
588
|
+
*/
|
|
589
|
+
transform(value: number | string, currencyCode?: string, display?: string | boolean, digitsInfo?: string, locale?: string): string | null;
|
|
590
|
+
transform(value: null | undefined, currencyCode?: string, display?: string | boolean, digitsInfo?: string, locale?: string): null;
|
|
591
|
+
transform(value: number | string | null | undefined, currencyCode?: string, display?: string | boolean, digitsInfo?: string, locale?: string): string | null;
|
|
592
|
+
ngOnDestroy(): void;
|
|
593
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizedCurrencyPipe, never>;
|
|
594
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<LocalizedCurrencyPipe, "currency", false>;
|
|
595
|
+
}
|
|
608
596
|
/**
|
|
609
597
|
* creates LocalizationConfiguration, which is used if the application
|
|
610
598
|
* @param configuration Localization configuration
|
|
611
599
|
*/
|
|
612
|
-
declare function createLocalizationConfiguration(configuration?: Partial<LocalizationConfiguration>): LocalizationConfiguration;
|
|
600
|
+
export declare function createLocalizationConfiguration(configuration?: Partial<LocalizationConfiguration>): LocalizationConfiguration;
|
|
613
601
|
/**
|
|
614
602
|
* Factory to inject the LOCALE_ID token with the current language into Angular context
|
|
615
603
|
* @param localizationService Localization service
|
|
616
604
|
*/
|
|
617
|
-
declare function localeIdNgBridge(localizationService: LocalizationService): string;
|
|
605
|
+
export declare function localeIdNgBridge(localizationService: LocalizationService): string;
|
|
618
606
|
/** Custom Localization Configuration Token to override default localization configuration */
|
|
619
|
-
declare const CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN: InjectionToken<Partial<LocalizationConfiguration>>;
|
|
620
|
-
declare class LocalizationModule {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
declare const OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS: Readonly<LocalizationDevtoolsServiceOptions>;
|
|
648
|
-
declare const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS: InjectionToken<LocalizationDevtoolsServiceOptions>;
|
|
649
|
-
|
|
607
|
+
export declare const CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN: InjectionToken<Partial<LocalizationConfiguration>>;
|
|
608
|
+
export declare class LocalizationModule {
|
|
609
|
+
/**
|
|
610
|
+
* forRoot method should be called only once from the application index.ts
|
|
611
|
+
* It will do several things:
|
|
612
|
+
* - provide the configuration for the whole application
|
|
613
|
+
* - register all locales specified in the LocalizationConfiguration
|
|
614
|
+
* - configure TranslateService
|
|
615
|
+
* - inject LOCALE_ID token
|
|
616
|
+
* @param configuration LocalizationConfiguration
|
|
617
|
+
*/
|
|
618
|
+
static forRoot(configuration?: () => Partial<LocalizationConfiguration>): ModuleWithProviders<LocalizationModule>;
|
|
619
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationModule, never>;
|
|
620
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationModule, [typeof O3rLocalizationTranslatePipe, typeof LocalizationTranslateDirective, typeof LocalizedDatePipe, typeof LocalizedDecimalPipe, typeof LocalizedCurrencyPipe], [typeof i6.TranslateModule, typeof i7.BidiModule, typeof i8.CommonModule], [typeof i6.TranslateModule, typeof O3rLocalizationTranslatePipe, typeof LocalizationTranslateDirective, typeof LocalizedDatePipe, typeof LocalizedDecimalPipe, typeof LocalizedCurrencyPipe]>;
|
|
621
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<LocalizationModule>;
|
|
622
|
+
}
|
|
623
|
+
export declare class LocalizationDevtoolsModule {
|
|
624
|
+
/**
|
|
625
|
+
* Initialize Otter Devtools
|
|
626
|
+
* @param options
|
|
627
|
+
*/
|
|
628
|
+
static instrument(options: Partial<LocalizationDevtoolsServiceOptions>): ModuleWithProviders<LocalizationDevtoolsModule>;
|
|
629
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationDevtoolsModule, never>;
|
|
630
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationDevtoolsModule, never, [typeof LocalizationModule], never>;
|
|
631
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<LocalizationDevtoolsModule>;
|
|
632
|
+
}
|
|
633
|
+
export declare const OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS: Readonly<LocalizationDevtoolsServiceOptions>;
|
|
634
|
+
export declare const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS: InjectionToken<LocalizationDevtoolsServiceOptions>;
|
|
650
635
|
/**
|
|
651
636
|
* LocalizationOverride store state
|
|
652
637
|
*/
|
|
653
|
-
interface LocalizationOverrideState {
|
|
654
|
-
|
|
655
|
-
|
|
638
|
+
export interface LocalizationOverrideState {
|
|
639
|
+
/** Mapping of initial localization keys to the one they are replaced with */
|
|
640
|
+
localizationOverrides: Record<string, string>;
|
|
656
641
|
}
|
|
657
642
|
/**
|
|
658
643
|
* Name of the LocalizationOverride Store
|
|
659
644
|
*/
|
|
660
|
-
declare const LOCALIZATION_OVERRIDE_STORE_NAME = "localizationOverride";
|
|
645
|
+
export declare const LOCALIZATION_OVERRIDE_STORE_NAME = "localizationOverride";
|
|
661
646
|
/**
|
|
662
647
|
* LocalizationOverride Store Interface
|
|
663
648
|
*/
|
|
664
|
-
interface LocalizationOverrideStore {
|
|
665
|
-
|
|
666
|
-
|
|
649
|
+
export interface LocalizationOverrideStore {
|
|
650
|
+
/** LocalizationOverride state */
|
|
651
|
+
[LOCALIZATION_OVERRIDE_STORE_NAME]: LocalizationOverrideState;
|
|
667
652
|
}
|
|
668
|
-
|
|
669
653
|
/**
|
|
670
654
|
* Clear all overrides and fill the store with the payload
|
|
671
655
|
*/
|
|
672
|
-
declare const setLocalizationOverride:
|
|
673
|
-
|
|
656
|
+
export declare const setLocalizationOverride: import("@ngrx/store").ActionCreator<"[LocalizationOverride] set", (props: SetStateActionPayload<LocalizationOverrideState>) => SetStateActionPayload<LocalizationOverrideState> & import("@ngrx/store").Action<"[LocalizationOverride] set">>;
|
|
674
657
|
/** Token of the LocalizationOverride reducer */
|
|
675
|
-
declare const LOCALIZATION_OVERRIDE_REDUCER_TOKEN: InjectionToken<ActionReducer<LocalizationOverrideState, Action<string>>>;
|
|
658
|
+
export declare const LOCALIZATION_OVERRIDE_REDUCER_TOKEN: InjectionToken<ActionReducer<LocalizationOverrideState, Action<string>>>;
|
|
676
659
|
/** Provide default reducer for LocalizationOverride store */
|
|
677
|
-
declare function getDefaultLocalizationOverrideReducer(): ActionReducer<LocalizationOverrideState, Action<string>>;
|
|
678
|
-
declare class LocalizationOverrideStoreModule {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
|
|
660
|
+
export declare function getDefaultLocalizationOverrideReducer(): ActionReducer<LocalizationOverrideState, Action<string>>;
|
|
661
|
+
export declare class LocalizationOverrideStoreModule {
|
|
662
|
+
static forRoot<T extends LocalizationOverrideState>(reducerFactory: () => ActionReducer<T, Action>): ModuleWithProviders<LocalizationOverrideStoreModule>;
|
|
663
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationOverrideStoreModule, never>;
|
|
664
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationOverrideStoreModule, never, [typeof i1.StoreFeatureModule], never>;
|
|
665
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<LocalizationOverrideStoreModule>;
|
|
666
|
+
}
|
|
685
667
|
/**
|
|
686
668
|
* LocalizationOverride Store initial value
|
|
687
669
|
*/
|
|
688
|
-
declare const localizationOverrideInitialState: LocalizationOverrideState;
|
|
670
|
+
export declare const localizationOverrideInitialState: LocalizationOverrideState;
|
|
689
671
|
/**
|
|
690
672
|
* List of basic actions for LocalizationOverride Store
|
|
691
673
|
*/
|
|
692
|
-
declare const localizationOverrideReducerFeatures: ReducerTypes<LocalizationOverrideState, ActionCreator[]>[];
|
|
674
|
+
export declare const localizationOverrideReducerFeatures: ReducerTypes<LocalizationOverrideState, ActionCreator[]>[];
|
|
693
675
|
/**
|
|
694
676
|
* LocalizationOverride Store reducer
|
|
695
677
|
*/
|
|
696
|
-
declare const localizationOverrideReducer:
|
|
697
|
-
|
|
678
|
+
export declare const localizationOverrideReducer: import("@ngrx/store").ActionReducer<LocalizationOverrideState, import("@ngrx/store").Action<string>>;
|
|
698
679
|
/** Select LocalizationOverride State */
|
|
699
|
-
declare const selectLocalizationOverrideState:
|
|
680
|
+
export declare const selectLocalizationOverrideState: import("@ngrx/store").MemoizedSelector<object, LocalizationOverrideState, import("@ngrx/store").DefaultProjectorFn<LocalizationOverrideState>>;
|
|
700
681
|
/** Select all localization override map */
|
|
701
|
-
declare const selectLocalizationOverride:
|
|
702
|
-
|
|
703
|
-
declare const
|
|
704
|
-
declare const localizationOverrideStorageSync: Serializer<LocalizationOverrideState>;
|
|
705
|
-
|
|
682
|
+
export declare const selectLocalizationOverride: import("@ngrx/store").MemoizedSelector<object, Record<string, string>, (s1: LocalizationOverrideState) => Record<string, string>>;
|
|
683
|
+
export declare const localizationOverrideStorageDeserializer: (rawObject: any) => any;
|
|
684
|
+
export declare const localizationOverrideStorageSync: Serializer<LocalizationOverrideState>;
|
|
706
685
|
/**
|
|
707
686
|
* This class is responsible for loading translation bundles from remote or local endpoints depending on the LocalizationConfiguration.
|
|
708
687
|
* Fallback mechanism ensures that if a bundle in some language cannot be fetched remotely
|
|
709
688
|
* we try to fetch the same language bundle locally (bundles stored inside the application)
|
|
710
689
|
* and finally load the fallback language bundle (if all previous fetches failed)
|
|
711
690
|
*/
|
|
712
|
-
declare class TranslationsLoader implements TranslateLoader {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
}
|
|
738
|
-
|
|
691
|
+
export declare class TranslationsLoader implements TranslateLoader {
|
|
692
|
+
private readonly localizationConfiguration;
|
|
693
|
+
private readonly logger?;
|
|
694
|
+
private readonly dynamicContentService?;
|
|
695
|
+
/**
|
|
696
|
+
* Download a language bundle file
|
|
697
|
+
* @param url Url to the bundle file
|
|
698
|
+
*/
|
|
699
|
+
private downloadLanguageBundle$;
|
|
700
|
+
/**
|
|
701
|
+
* @inheritdoc
|
|
702
|
+
*/
|
|
703
|
+
getTranslation(lang: string): Observable<any>;
|
|
704
|
+
/**
|
|
705
|
+
*
|
|
706
|
+
*Fetches localization bundles from published folder (internal to application)
|
|
707
|
+
*
|
|
708
|
+
*1. try to load lang from local
|
|
709
|
+
*2. if 1 fails try to load fallback lang but only if it's different from lang in 1
|
|
710
|
+
* @param lang - language of the bundle
|
|
711
|
+
* @param fallbackLanguage - fallback language in case bundle in language not found
|
|
712
|
+
*/
|
|
713
|
+
getTranslationFromLocal(lang: string, fallbackLanguage: string): Observable<any>;
|
|
714
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslationsLoader, never>;
|
|
715
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
716
|
+
}
|
|
739
717
|
/**
|
|
740
718
|
* Creates a loader of translations bundles based on the configuration
|
|
741
719
|
* (endPointUrl and language determine which bundle we load and where do we fetch it from)
|
|
@@ -743,52 +721,47 @@ declare class TranslationsLoader implements TranslateLoader {
|
|
|
743
721
|
* @param logger service to handle the log of warning and errors
|
|
744
722
|
* @param dynamicContentService (optional)
|
|
745
723
|
*/
|
|
746
|
-
declare function createTranslateLoader(localizationConfiguration: LocalizationConfiguration, logger?: LoggerService, dynamicContentService?: DynamicContentService): TranslationsLoader;
|
|
724
|
+
export declare function createTranslateLoader(localizationConfiguration: LocalizationConfiguration, logger?: LoggerService, dynamicContentService?: DynamicContentService): TranslationsLoader;
|
|
747
725
|
/**
|
|
748
726
|
* TranslateLoader provider, using framework's TranslationsLoader class
|
|
749
727
|
*/
|
|
750
|
-
declare const translateLoaderProvider: Readonly<FactoryProvider>;
|
|
751
|
-
|
|
728
|
+
export declare const translateLoaderProvider: Readonly<FactoryProvider>;
|
|
752
729
|
/** Localization Configuration Token */
|
|
753
|
-
declare const LOCALIZATION_CONFIGURATION_TOKEN: InjectionToken<LocalizationConfiguration>;
|
|
754
|
-
|
|
730
|
+
export declare const LOCALIZATION_CONFIGURATION_TOKEN: InjectionToken<LocalizationConfiguration>;
|
|
755
731
|
/**
|
|
756
732
|
* Service for handling the text direction based on the LocalizationConfiguration
|
|
757
733
|
*/
|
|
758
|
-
declare class TextDirectionService {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
|
|
734
|
+
export declare class TextDirectionService {
|
|
735
|
+
private readonly translateService;
|
|
736
|
+
private readonly configuration;
|
|
737
|
+
private readonly rendererFactory;
|
|
738
|
+
private readonly directionality;
|
|
739
|
+
private subscription?;
|
|
740
|
+
private readonly renderer;
|
|
741
|
+
constructor();
|
|
742
|
+
/**
|
|
743
|
+
* Updates the dir attribute on body HTML tag.
|
|
744
|
+
* @returns a subscription that updates the dir attribute
|
|
745
|
+
*/
|
|
746
|
+
onLangChangeSubscription(): Subscription;
|
|
747
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TextDirectionService, never>;
|
|
748
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
749
|
+
}
|
|
775
750
|
/**
|
|
776
751
|
* @deprecated The value of Directionality is no longer readonly and can be updated, this class will be removed in v16
|
|
777
752
|
*/
|
|
778
|
-
declare class TextDirectionality extends Directionality implements OnDestroy {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
export type { AvailableLocalizationMessageContents, DisplayLocalizationKeysContentMessage, GetTranslationValuesContentMessage, IsTranslationDeactivationEnabledContentMessage, JSONLocalization, LanguagesContentMessage, LazyMessageFormatConfig, LocalizationConfiguration, LocalizationContextualizationDevtools, LocalizationDevtoolsServiceOptions, LocalizationMessageDataTypes, LocalizationMetadata, LocalizationOverrideState, LocalizationOverrideStore, LocalizationsContentMessage, ReloadLocalizationKeysContentMessage, SwitchLanguageContentMessage, Translatable, UpdateLocalizationContentMessage };
|
|
794
|
-
//# sourceMappingURL=o3r-localization.d.ts.map
|
|
753
|
+
export declare class TextDirectionality extends Directionality implements OnDestroy {
|
|
754
|
+
get value(): Direction;
|
|
755
|
+
set value(value: Direction);
|
|
756
|
+
/**
|
|
757
|
+
* The current 'ltr' or 'rtl' value.
|
|
758
|
+
* @override
|
|
759
|
+
*/
|
|
760
|
+
private _value;
|
|
761
|
+
constructor();
|
|
762
|
+
ngOnDestroy(): void;
|
|
763
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TextDirectionality, never>;
|
|
764
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
765
|
+
}
|
|
766
|
+
export type { Translation };
|
|
767
|
+
//# sourceMappingURL=o3r-localization.d.ts.map
|