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