@o3r/localization 15.3.0-prerelease.8 → 15.3.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,741 +1,719 @@
1
- import { Translation, OtterMessageContent, ConnectContentMessage, RequestMessagesContentMessage, MessageDataTypes, DevtoolsCommonOptions, ContextualizationDevtoolsCommonOptions, DevtoolsServiceInterface, SetStateActionPayload, Serializer } from '@o3r/core';
2
- export { Translation } from '@o3r/core';
3
- import * as i0 from '@angular/core';
4
- import { InjectionToken, PipeTransform, OnDestroy, ChangeDetectorRef, ModuleWithProviders, FactoryProvider } from '@angular/core';
5
- import * as i6 from '@ngx-translate/core';
6
- import { TranslateCompiler, TranslateService, TranslatePipe, TranslateDirective, TranslateLoader } from '@ngx-translate/core';
7
- import { Options } from 'intl-messageformat';
8
- import { Subscription, Observable } from 'rxjs';
9
- import * as i8 from '@angular/common';
10
- import { DatePipe, DecimalPipe, CurrencyPipe } from '@angular/common';
11
- import * as i7 from '@angular/cdk/bidi';
12
- import { Directionality, Direction } from '@angular/cdk/bidi';
13
- import * as _ngrx_store from '@ngrx/store';
14
- import { ActionReducer, Action, ReducerTypes, ActionCreator } from '@ngrx/store';
15
- import { DynamicContentService } from '@o3r/dynamic-content';
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
- /** The key of the localized string. */
27
- key: string;
28
- /** The description of the key used to give some context to the translators. */
29
- description: string;
30
- /** True means that the key will be mapped to a dictionary in the CMS. */
31
- dictionary: boolean;
32
- /** True means that the value has to be overriden in the CMS. */
33
- referenceData: boolean;
34
- /** Tags used to filter/categorize localization strings */
35
- tags?: string[];
36
- /** The default value for EN language. It is mandatory if dictionary is set to false. */
37
- value?: string;
38
- /** Reference to another key. */
39
- ref?: string;
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
- /** List of available languages */
49
- supportedLocales: string[];
50
- /** Application display language */
51
- language?: string;
52
- /** Url to fetch translation bundles from */
53
- endPointUrl: string;
54
- /** Prefix endPoinrUrl with dynamicContentPath provided by DynamicContentPath */
55
- useDynamicContent: boolean;
56
- /** List of RTL language codes */
57
- rtlLanguages: string[];
58
- /**
59
- * Fallback language map of resource in case translation in language does not exist.
60
- * translate to unsupported language will try to map to supportedLocales from below property.
61
- * @example
62
- * ```typescript
63
- * {
64
- * supportedLocales: ['en-GB', 'en-US', 'fr-FR'],
65
- * fallbackLocalesMap: {'en-CA': 'en-US', 'de': 'fr-FR'}
66
- * }
67
- * // translate to en-CA -> fallback to en-US, translate to de-DE -> fallback to fr-FR,
68
- * // translate to en-NZ -> fallback to en-GB, translate to en -> fallback to en-GB.
69
- * ```
70
- */
71
- fallbackLocalesMap?: {
72
- [supportedLocale: string]: string;
73
- };
74
- /** Fallback language of resource in case translation in language does not exist */
75
- fallbackLanguage: string;
76
- /** Path relative to published folder where webpack will copy translation bundles */
77
- bundlesOutputPath: string;
78
- /** Debug mode switch */
79
- debugMode: boolean;
80
- /** Query parameters for fetching the localization resources */
81
- queryParams?: {
82
- [key: string]: string;
83
- };
84
- /** Fetch options object as per https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters */
85
- fetchOptions?: RequestInit;
86
- /** Enable the ability to switch the translations on and off at runtime. */
87
- enableTranslationDeactivation: boolean;
88
- /**
89
- * Merge the translations from DynamicContentPath with the local translations
90
- * Warning: Enable this option will download two localization bundles and can delay the display of the text on application first page
91
- * @default false
92
- */
93
- mergeWithLocalTranslations: boolean;
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
- * translations map
106
- */
107
- translations: T;
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
- * Enables compiled translation caching
116
- * @default true
117
- */
118
- enableCache?: boolean;
119
- /**
120
- * Enables HTML in translation
121
- * @default true
122
- */
123
- ignoreTag?: boolean;
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
- /** Configuration */
137
- private readonly config;
138
- /** Cache of compiled translations */
139
- private cache;
140
- constructor();
141
- /**
142
- * Clear the cache of the compiled translations
143
- */
144
- clearCache(): void;
145
- /** @inheritDoc */
146
- compile(value: string, lang: string): (params: any) => string;
147
- /** @inheritDoc */
148
- compileTranslations(translations: {
149
- [x: string]: any;
150
- }, lang: string): {
151
- [x: string]: (params: any) => string;
152
- };
153
- static ɵfac: i0.ɵɵFactoryDeclaration<TranslateMessageFormatLazyCompiler, never>;
154
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
155
- }
156
-
157
- interface LocalizationDevtoolsServiceOptions extends DevtoolsCommonOptions, ContextualizationDevtoolsCommonOptions {
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
- /** Localizations metadata */
163
- localizations: LocalizationMetadata;
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
- /** Languages available */
168
- languages: string[];
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
- /** Language */
173
- language: string;
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
- /** Toggle the display of the localization keys */
178
- toggle?: boolean;
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
- /** Localization key */
183
- key: string;
184
- /** Localization value */
185
- value: string;
186
- /** Lang */
187
- lang?: string;
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
- /** Lang */
192
- lang?: string;
183
+ export interface ReloadLocalizationKeysContentMessage extends OtterMessageContent<'reloadLocalizationKeys'> {
184
+ /** Lang */
185
+ lang?: string;
193
186
  }
194
- interface IsTranslationDeactivationEnabledContentMessage extends OtterMessageContent<'isTranslationDeactivationEnabled'> {
195
- enabled: boolean;
187
+ export interface IsTranslationDeactivationEnabledContentMessage extends OtterMessageContent<'isTranslationDeactivationEnabled'> {
188
+ enabled: boolean;
196
189
  }
197
- interface GetTranslationValuesContentMessage extends OtterMessageContent<'getTranslationValuesContentMessage'> {
198
- translations: {
199
- [localizationKey: string]: string;
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
- * Is the translation deactivation enabled
213
- */
214
- isTranslationDeactivationEnabled(): boolean | Promise<boolean>;
215
- /**
216
- * Show localization keys
217
- * @param value value enforced by the DevTools extension
218
- */
219
- showLocalizationKeys: (value?: boolean) => void | Promise<void>;
220
- /**
221
- * Returns the current language
222
- */
223
- getCurrentLanguage: () => string | Promise<string>;
224
- /**
225
- * Switch the current language to the specified value
226
- * @param language new language to switch to
227
- */
228
- switchLanguage: (language: string) => Promise<{
229
- previous: string;
230
- requested: string;
231
- current: string;
232
- }>;
233
- /**
234
- * Setup a listener on language change
235
- * @param fn called when the language is changed in the app
236
- */
237
- onLanguageChange: (fn: (language: string) => any) => Subscription;
238
- /**
239
- * Updates the specified localization key/values for the current language
240
- * @param keyValues key/values to update
241
- * @param language if not provided, the current language value
242
- */
243
- updateLocalizationKeys: (keyValues: {
244
- [key: string]: string;
245
- }, language?: string) => void | Promise<void>;
246
- /**
247
- * Reload a language from the language file
248
- * @see https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.service.ts#L490
249
- * @param language language to reload
250
- */
251
- reloadLocalizationKeys: (language?: string) => Promise<void>;
252
- }
253
-
254
- declare class OtterLocalizationDevtools {
255
- private readonly localizationService;
256
- private readonly translateCompiler;
257
- private readonly appRef;
258
- /**
259
- * Is the translation deactivation enabled
260
- */
261
- isTranslationDeactivationEnabled(): boolean;
262
- /**
263
- * Show localization keys
264
- * @param value value enforced by the DevTools extension
265
- */
266
- showLocalizationKeys(value?: boolean): void;
267
- /**
268
- * Returns the current language
269
- */
270
- getCurrentLanguage(): string;
271
- /**
272
- * Setup a listener on language change
273
- * @param fn called when the language is changed in the app
274
- */
275
- onLanguageChange(fn: (language: string) => any): Subscription;
276
- /**
277
- * Switch the current language to the specified value
278
- * @param language new language to switch to
279
- */
280
- switchLanguage(language: string | undefined): Promise<void>;
281
- /**
282
- * Updates the specified localization key/values for the current language.
283
- *
284
- * Recommendation: To be used with a small number of keys to update to avoid performance issues.
285
- * @param keyValues key/values to update
286
- * @param language if not provided, the current language value
287
- */
288
- updateLocalizationKeys(keyValues: {
289
- [key: string]: string;
290
- }, language?: string): void | Promise<void>;
291
- /**
292
- * Reload a language from the language file
293
- * @see https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.service.ts#L490
294
- * @param language language to reload
295
- */
296
- reloadLocalizationKeys(language?: string): Promise<void>;
297
- static ɵfac: i0.ɵɵFactoryDeclaration<OtterLocalizationDevtools, never>;
298
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
299
- }
300
-
301
- declare class LocalizationDevtoolsConsoleService implements DevtoolsServiceInterface, LocalizationContextualizationDevtools {
302
- /** Name of the Window property to access to the devtools */
303
- static readonly windowModuleName = "localization";
304
- private readonly localizationDevtools;
305
- private readonly options;
306
- constructor();
307
- /** @inheritDoc */
308
- activate(): void;
309
- /**
310
- * @inheritdoc
311
- */
312
- isTranslationDeactivationEnabled(): boolean | Promise<boolean>;
313
- /**
314
- * @inheritdoc
315
- */
316
- showLocalizationKeys(value?: boolean): void | Promise<void>;
317
- /**
318
- * @inheritdoc
319
- */
320
- getCurrentLanguage(): string | Promise<string>;
321
- /**
322
- * @inheritdoc
323
- */
324
- switchLanguage(language: string): Promise<{
325
- previous: string;
326
- requested: string;
327
- current: string;
328
- }>;
329
- /**
330
- * @inheritdoc
331
- */
332
- onLanguageChange(fn: (language: string) => any): Subscription;
333
- /**
334
- * @inheritdoc
335
- */
336
- updateLocalizationKeys(keyValues: {
337
- [key: string]: string;
338
- }, language?: string): void | Promise<void>;
339
- /**
340
- * @inheritdoc
341
- */
342
- reloadLocalizationKeys(language?: string): Promise<void>;
343
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationDevtoolsConsoleService, never>;
344
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
345
- }
346
-
347
- declare class LocalizationDevtoolsMessageService {
348
- private readonly logger;
349
- private readonly localizationDevTools;
350
- private readonly localizationService;
351
- private readonly options;
352
- private readonly sendMessage;
353
- private readonly destroyRef;
354
- constructor();
355
- private sendLocalizationsMetadata;
356
- /**
357
- * Function to trigger a re-send a requested messages to the Otter Chrome DevTools extension
358
- * @param only restricted list of messages to re-send
359
- */
360
- private handleReEmitRequest;
361
- /**
362
- * Function to handle the incoming messages from Otter Chrome DevTools extension
363
- * @param message Message coming from the Otter Chrome DevTools extension
364
- */
365
- private handleEvents;
366
- /**
367
- * Function to connect the plugin to the Otter Chrome DevTools extension
368
- */
369
- private connectPlugin;
370
- /** @inheritDoc */
371
- activate(): void;
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
- private readonly translateService;
383
- private readonly logger;
384
- private readonly configuration;
385
- private readonly store;
386
- private readonly localeSplitIdentifier;
387
- /**
388
- * Internal subject that we use to track changes between keys only and translation mode
389
- */
390
- private readonly _showKeys$;
391
- /**
392
- * Map of localization keys to replace a key to another
393
- */
394
- private readonly keyMapping$?;
395
- /**
396
- * _showKeys$ exposed as an Observable
397
- */
398
- showKeys$: Observable<boolean>;
399
- constructor();
400
- /**
401
- * This will handle the fallback language hierarchy to find out fallback language.
402
- * supportedLocales language has highest priority, next priority goes to fallbackLocalesMap and default would be
403
- * fallbackLanguage.
404
- * @param language Selected language.
405
- * @returns selected language if supported, fallback language otherwise.
406
- */
407
- private checkFallbackLocalesMap;
408
- /**
409
- * This function checks if fallback language can be provided from fallbackLocalesMap.
410
- * supportedLocales: ['en-GB', 'en-US', 'fr-FR'], fallbackLocalesMap: {'en-CA': 'en-US', 'de': 'fr-FR'}
411
- * translate to en-CA -> fallback to en-US, translate to de-DE -> fallback to fr-FR
412
- * translate to en-NZ -> fallback to en-GB
413
- * @param language Selected language.
414
- * @returns Fallback language if available, undefined otherwise.
415
- */
416
- private getFallbackMapLangCode;
417
- /**
418
- * This function checks if closest supported language available incase of selected language is not
419
- * supported language.
420
- * supportedLocales: ['en-GB', 'en-US', 'fr-FR']
421
- * translate to en-CA -> fallback to en-GB
422
- * @param language Selected language.
423
- * @returns Closest supported language if available, undefined otherwise.
424
- */
425
- private getFirstClosestSupportedLanguageCode;
426
- /**
427
- * Returns a stream of translated values of a key which updates whenever the language changes.
428
- * @param translationKey Key to translate
429
- * @param interpolateParams Object to use in translation binding
430
- * @returns A stream of the translated key
431
- */
432
- private getTranslationStream;
433
- /**
434
- * Configures TranslateService and registers locales. This method is called from the application level.
435
- */
436
- configure(): Promise<void>;
437
- /**
438
- * Is the translation deactivation enabled
439
- */
440
- isTranslationDeactivationEnabled(): boolean;
441
- /**
442
- * Wrapper to call the ngx-translate service TranslateService method getLangs().
443
- */
444
- getLanguages(): string[];
445
- /**
446
- * Wrapper to call the ngx-translate service TranslateService method use(language).
447
- * @param language
448
- */
449
- useLanguage(language: string): Observable<any>;
450
- /**
451
- * Wrapper to get the ngx-translate service TranslateService currentLang.
452
- */
453
- getCurrentLanguage(): string;
454
- /**
455
- * Get the instance of the ngx-translate TranslateService used by LocalizationService.
456
- */
457
- getTranslateService(): TranslateService;
458
- /**
459
- * Toggle the ShowKeys mode between active and inactive.
460
- * @param value if specified, set the ShowKeys mode to value. If not specified, toggle the ShowKeys mode.
461
- */
462
- toggleShowKeys(value?: boolean): void;
463
- /**
464
- * Return the current value of debug show/hide translation keys.
465
- */
466
- get showKeys(): boolean;
467
- /**
468
- * Get an observable of translation key after global mapping
469
- * @param requestedKey Original translation key
470
- */
471
- getKey(requestedKey: string): Observable<any>;
472
- /**
473
- * Returns a stream of translated values of a key which updates whenever the language changes.
474
- * @param key Key to translate
475
- * @param interpolateParams Object to use in translation binding
476
- * @returns A stream of the translated key
477
- */
478
- translate(key: string, interpolateParams?: object): Observable<any>;
479
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationService, never>;
480
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
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
- /** Localization service instance */
488
- protected readonly localizationService: LocalizationService;
489
- /** Change detector service instance */
490
- protected readonly changeDetector: ChangeDetectorRef;
491
- /** Localization config token */
492
- protected readonly localizationConfig: LocalizationConfiguration;
493
- /**
494
- * Internal subscription to the LocalizationService showKeys mode changes
495
- */
496
- protected readonly onShowKeysChange?: Subscription;
497
- /**
498
- * Internal subscription to the LocalizationService key mapping
499
- */
500
- protected onKeyChange?: Subscription;
501
- /**
502
- * Should we display keys instead of translations
503
- */
504
- protected showKeys: boolean;
505
- /** last key queried */
506
- protected lastQueryKey?: string;
507
- /** last key resolved */
508
- protected lastResolvedKey?: string;
509
- constructor();
510
- /**
511
- * Calls original transform method and eventually outputs the key if debugMode (in LocalizationConfiguration) is enabled
512
- * @inheritdoc
513
- */
514
- transform(query: string, ...args: any[]): any;
515
- ngOnDestroy(): void;
516
- static ɵfac: i0.ɵɵFactoryDeclaration<O3rLocalizationTranslatePipe, never>;
517
- static ɵpipe: i0.ɵɵPipeDeclaration<O3rLocalizationTranslatePipe, "o3rTranslate", false>;
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
- private readonly localizationService;
525
- private readonly localizationConfig;
526
- /**
527
- * Internal subscription to the LocalizationService showKeys mode changes
528
- */
529
- private readonly onShowKeysChange?;
530
- /**
531
- * Should we display keys instead of translations
532
- */
533
- private showKeys;
534
- /**
535
- * Internal subscription to the LocalizationService key mapping
536
- */
537
- private onKeyChange?;
538
- /** @inheritdoc */
539
- set translate(key: string);
540
- constructor();
541
- /**
542
- * Overriding parent's setContent to plug debugging feature
543
- * @param node
544
- * @param content
545
- */
546
- setContent(node: any, content: string): void;
547
- ngOnDestroy(): void;
548
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationTranslateDirective, never>;
549
- static ɵdir: i0.ɵɵDirectiveDeclaration<LocalizationTranslateDirective, "[translate],[ngx-translate]", never, { "translate": { "alias": "translate"; "required": false; }; }, {}, never, never, false, never>;
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
- private readonly onLangChange;
557
- private readonly localizationService;
558
- private readonly changeDetectorRef;
559
- constructor();
560
- /**
561
- * @inheritdoc
562
- */
563
- transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
564
- transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
565
- transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
566
- ngOnDestroy(): void;
567
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizedDatePipe, never>;
568
- static ɵpipe: i0.ɵɵPipeDeclaration<LocalizedDatePipe, "date", false>;
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
- private readonly onLangChange;
576
- private readonly localizationService;
577
- private readonly changeDetectorRef;
578
- constructor();
579
- /**
580
- * @inheritdoc
581
- */
582
- transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
583
- transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
584
- ngOnDestroy(): void;
585
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizedDecimalPipe, never>;
586
- static ɵpipe: i0.ɵɵPipeDeclaration<LocalizedDecimalPipe, "decimal", false>;
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
- private readonly onLangChange;
594
- private readonly localizationService;
595
- private readonly changeDetectorRef;
596
- constructor();
597
- /**
598
- * @inheritdoc
599
- */
600
- transform(value: number | string, currencyCode?: string, display?: string | boolean, digitsInfo?: string, locale?: string): string | null;
601
- transform(value: null | undefined, currencyCode?: string, display?: string | boolean, digitsInfo?: string, locale?: string): null;
602
- transform(value: number | string | null | undefined, currencyCode?: string, display?: string | boolean, digitsInfo?: string, locale?: string): string | null;
603
- ngOnDestroy(): void;
604
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizedCurrencyPipe, never>;
605
- static ɵpipe: i0.ɵɵPipeDeclaration<LocalizedCurrencyPipe, "currency", false>;
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
- * forRoot method should be called only once from the application index.ts
623
- * It will do several things:
624
- * - provide the configuration for the whole application
625
- * - register all locales specified in the LocalizationConfiguration
626
- * - configure TranslateService
627
- * - inject LOCALE_ID token
628
- * @param configuration LocalizationConfiguration
629
- */
630
- static forRoot(configuration?: () => Partial<LocalizationConfiguration>): ModuleWithProviders<LocalizationModule>;
631
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationModule, never>;
632
- 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]>;
633
- static ɵinj: i0.ɵɵInjectorDeclaration<LocalizationModule>;
634
- }
635
-
636
- declare class LocalizationDevtoolsModule {
637
- /**
638
- * Initialize Otter Devtools
639
- * @param options
640
- */
641
- static instrument(options: Partial<LocalizationDevtoolsServiceOptions>): ModuleWithProviders<LocalizationDevtoolsModule>;
642
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationDevtoolsModule, never>;
643
- static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationDevtoolsModule, never, [typeof LocalizationModule], never>;
644
- static ɵinj: i0.ɵɵInjectorDeclaration<LocalizationDevtoolsModule>;
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
- /** Mapping of initial localization keys to the one they are replaced with */
655
- localizationOverrides: Record<string, string>;
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
- /** LocalizationOverride state */
666
- [LOCALIZATION_OVERRIDE_STORE_NAME]: LocalizationOverrideState;
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: _ngrx_store.ActionCreator<"[LocalizationOverride] set", (props: SetStateActionPayload<LocalizationOverrideState>) => SetStateActionPayload<LocalizationOverrideState> & _ngrx_store.Action<"[LocalizationOverride] set">>;
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
- static forRoot<T extends LocalizationOverrideState>(reducerFactory: () => ActionReducer<T, Action>): ModuleWithProviders<LocalizationOverrideStoreModule>;
680
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationOverrideStoreModule, never>;
681
- static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationOverrideStoreModule, never, [typeof _ngrx_store.StoreFeatureModule], never>;
682
- static ɵinj: i0.ɵɵInjectorDeclaration<LocalizationOverrideStoreModule>;
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: _ngrx_store.ActionReducer<LocalizationOverrideState, _ngrx_store.Action<string>>;
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: _ngrx_store.MemoizedSelector<object, LocalizationOverrideState, _ngrx_store.DefaultProjectorFn<LocalizationOverrideState>>;
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: _ngrx_store.MemoizedSelector<object, Record<string, string>, (s1: LocalizationOverrideState) => Record<string, string>>;
702
-
703
- declare const localizationOverrideStorageDeserializer: (rawObject: any) => any;
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
- private readonly localizationConfiguration;
714
- private readonly logger?;
715
- private readonly dynamicContentService?;
716
- /**
717
- * Download a language bundle file
718
- * @param url Url to the bundle file
719
- */
720
- private downloadLanguageBundle$;
721
- /**
722
- * @inheritdoc
723
- */
724
- getTranslation(lang: string): Observable<any>;
725
- /**
726
- *
727
- *Fetches localization bundles from published folder (internal to application)
728
- *
729
- *1. try to load lang from local
730
- *2. if 1 fails try to load fallback lang but only if it's different from lang in 1
731
- * @param lang - language of the bundle
732
- * @param fallbackLanguage - fallback language in case bundle in language not found
733
- */
734
- getTranslationFromLocal(lang: string, fallbackLanguage: string): Observable<any>;
735
- static ɵfac: i0.ɵɵFactoryDeclaration<TranslationsLoader, never>;
736
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
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
- private readonly translateService;
760
- private readonly configuration;
761
- private readonly rendererFactory;
762
- private readonly directionality;
763
- private subscription?;
764
- private readonly renderer;
765
- constructor();
766
- /**
767
- * Updates the dir attribute on body HTML tag.
768
- * @returns a subscription that updates the dir attribute
769
- */
770
- onLangChangeSubscription(): Subscription;
771
- static ɵfac: i0.ɵɵFactoryDeclaration<TextDirectionService, never>;
772
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
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
- get value(): Direction;
780
- set value(value: Direction);
781
- /**
782
- * The current 'ltr' or 'rtl' value.
783
- * @override
784
- */
785
- private _value;
786
- constructor();
787
- ngOnDestroy(): void;
788
- static ɵfac: i0.ɵɵFactoryDeclaration<TextDirectionality, never>;
789
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
790
- }
791
-
792
- export { CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN, DEFAULT_LOCALIZATION_CONFIGURATION, LOCALIZATION_CONFIGURATION_TOKEN, LOCALIZATION_OVERRIDE_REDUCER_TOKEN, LOCALIZATION_OVERRIDE_STORE_NAME, Localization, LocalizationDevtoolsConsoleService, LocalizationDevtoolsMessageService, LocalizationDevtoolsModule, LocalizationModule, LocalizationOverrideStoreModule, LocalizationService, LocalizationTranslateDirective, LocalizedCurrencyPipe, LocalizedDatePipe, LocalizedDecimalPipe, MESSAGE_FORMAT_CONFIG, O3rLocalizationTranslatePipe, OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS, OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, OtterLocalizationDevtools, TextDirectionService, TextDirectionality, TranslateMessageFormatLazyCompiler, TranslationsLoader, createLocalizationConfiguration, createTranslateLoader, getDefaultLocalizationOverrideReducer, lazyMessageDefaultConfig, localeIdNgBridge, localizationOverrideInitialState, localizationOverrideReducer, localizationOverrideReducerFeatures, localizationOverrideStorageDeserializer, localizationOverrideStorageSync, selectLocalizationOverride, selectLocalizationOverrideState, setLocalizationOverride, translateLoaderProvider };
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