@acorex/core 18.14.1-next.2 → 18.14.1-next.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
|
|
1
1
|
import { AXEventService, AXEventTypes } from '@acorex/core/events';
|
2
2
|
import { Injectable, inject } from '@angular/core';
|
3
3
|
import { get as lodashGet, set as lodashSet } from 'lodash-es';
|
4
|
-
import { BehaviorSubject, catchError, finalize,
|
4
|
+
import { BehaviorSubject, catchError, finalize, firstValueFrom, forkJoin, lastValueFrom, map, of, shareReplay, startWith, switchMap, take, tap, } from 'rxjs';
|
5
5
|
import { AX_TRANSLATION_CONFIG } from './translation.config';
|
6
6
|
import { AX_TRANSLATION_LOADER } from './translation.loader';
|
7
7
|
import * as i0 from "@angular/core";
|
@@ -140,18 +140,9 @@ export class AXTranslationService {
|
|
140
140
|
translate(key, options) {
|
141
141
|
const result = this.findAXTranslateOptionsFromKey(key);
|
142
142
|
if (result.length) {
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
// return this.load(item.key, {
|
147
|
-
// params: options.params,
|
148
|
-
// scope: item.scope || options.scope || this.config.defaultScope,
|
149
|
-
// lang: item.lang || options.lang || this.config.defaultLang,
|
150
|
-
// });
|
151
|
-
// }),
|
152
|
-
// );
|
153
|
-
// });
|
154
|
-
return this.translateAsyncAXTranslate(key, options);
|
143
|
+
return this.langChanges$.pipe(startWith(this.getActiveLang()), switchMap((lang) => {
|
144
|
+
return this.translateAsyncAXTranslate(key, options);
|
145
|
+
}));
|
155
146
|
}
|
156
147
|
else {
|
157
148
|
if (options?.lang) {
|
@@ -213,39 +204,6 @@ export class AXTranslationService {
|
|
213
204
|
}
|
214
205
|
return result;
|
215
206
|
}
|
216
|
-
// private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions) {
|
217
|
-
// // Use findAXTranslateOptions to parse all <axt> tags in the input string
|
218
|
-
// const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
|
219
|
-
// const splitParts = key.split(regex); // Split into <axt> parts and text parts
|
220
|
-
// let translatedResult = '';
|
221
|
-
// for (const part of splitParts) {
|
222
|
-
// // Check if the part is an <axt> tag by using the findAXTranslateOptions function
|
223
|
-
// const optionsFromKey = this.findAXTranslateOptionsFromKey(part);
|
224
|
-
// if (optionsFromKey.length > 0) {
|
225
|
-
// // This is an <axt> part, translate it
|
226
|
-
// for (const parsed of optionsFromKey) {
|
227
|
-
// const parsedLang = parsed.lang || options.lang || this.getActiveLang();
|
228
|
-
// const parsedScope = parsed.scope || options.scope || this.config.defaultScope;
|
229
|
-
// const parsedKey = parsed.key;
|
230
|
-
// // Get the final translation, applying any params if needed
|
231
|
-
// const newTranslation = this.load(parsedKey, {
|
232
|
-
// lang: parsedLang,
|
233
|
-
// scope: parsedScope,
|
234
|
-
// params: options?.params,
|
235
|
-
// });
|
236
|
-
// newTranslation.pipe(first()).subscribe((translatedText) => {
|
237
|
-
// translatedResult += `${translatedText}`;
|
238
|
-
// });
|
239
|
-
// // Append the translated text
|
240
|
-
// }
|
241
|
-
// } else {
|
242
|
-
// // This is plain text, so add it as-is
|
243
|
-
// translatedResult += part;
|
244
|
-
// }
|
245
|
-
// console.log(translatedResult);
|
246
|
-
// }
|
247
|
-
// return of(translatedResult);
|
248
|
-
// }
|
249
207
|
translateAsyncAXTranslate(key, options) {
|
250
208
|
const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
|
251
209
|
const splitParts = key.split(regex); // Split into <axt> parts and text parts
|
@@ -263,7 +221,7 @@ export class AXTranslationService {
|
|
263
221
|
lang: parsedLang,
|
264
222
|
scope: parsedScope,
|
265
223
|
params: options?.params,
|
266
|
-
})
|
224
|
+
}));
|
267
225
|
}
|
268
226
|
}
|
269
227
|
else {
|
@@ -272,8 +230,7 @@ export class AXTranslationService {
|
|
272
230
|
}
|
273
231
|
}
|
274
232
|
// Use forkJoin to wait for all observables to complete
|
275
|
-
return forkJoin(translationObservables).pipe(map((translatedParts) => translatedParts.join(''))
|
276
|
-
);
|
233
|
+
return forkJoin(translationObservables).pipe(map((translatedParts) => translatedParts.join('')));
|
277
234
|
}
|
278
235
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
279
236
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, providedIn: 'root' }); }
|
@@ -282,4 +239,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
282
239
|
type: Injectable,
|
283
240
|
args: [{ providedIn: 'root' }]
|
284
241
|
}], ctorParameters: () => [] });
|
285
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRpb24uc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS90cmFuc2xhdGlvbi9zcmMvbGliL3RyYW5zbGF0aW9uLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxZQUFZLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNuRSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNuRCxPQUFPLEVBQUUsR0FBRyxJQUFJLFNBQVMsRUFBRSxHQUFHLElBQUksU0FBUyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBQy9ELE9BQU8sRUFDTCxlQUFlLEVBRWYsVUFBVSxFQUNWLFFBQVEsRUFDUixLQUFLLEVBQ0wsY0FBYyxFQUNkLFFBQVEsRUFDUixhQUFhLEVBQ2IsR0FBRyxFQUNILEVBQUUsRUFDRixXQUFXLEV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bnNsYXRpb24gb2JzZXJ2YWJsZSB0byB0aGUgYXJyYXlcbiAgICAgICAgICB0cmFuc2xhdGlvbk9ic2VydmFibGVzLnB1c2goXG4gICAgICAgICAgICB0aGlzLmxvYWQocGFyc2VkS2V5LCB7XG4gICAgICAgICAgICAgIGxhbmc6IHBhcnNlZExhbmcsXG4gICAgICAgICAgICAgIHNjb3BlOiBwYXJzZWRTY29wZSxcbiAgICAgICAgICAgICAgcGFyYW1zOiBvcHRpb25zPy5wYXJhbXMsXG4gICAgICAgICAgICB9KS5waXBlKGZpcnN0KCkpXG4gICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgLy8gVGhpcyBpcyBwbGFpbiB0ZXh0LCBzbyB3cmFwIGl0IGluIGFuIG9ic2VydmFibGVcbiAgICAgICAgdHJhbnNsYXRpb25PYnNlcnZhYmxlcy5wdXNoKG9mKHBhcnQpKTtcbiAgICAgIH1cbiAgICB9XG4gIFxuICAgIC8vIFVzZSBmb3JrSm9pbiB0byB3YWl0IGZvciBhbGwgb2JzZXJ2YWJsZXMgdG8gY29tcGxldGVcbiAgICByZXR1cm4gZm9ya0pvaW4odHJhbnNsYXRpb25PYnNlcnZhYmxlcykucGlwZShcbiAgICAgIG1hcCgodHJhbnNsYXRlZFBhcnRzKSA9PiB0cmFuc2xhdGVkUGFydHMuam9pbignJykpIC8vIEpvaW4gYWxsIHRyYW5zbGF0ZWQgcGFydHNcbiAgICApO1xuICB9XG4gIFxufVxuIl19
|
242
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRpb24uc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS90cmFuc2xhdGlvbi9zcmMvbGliL3RyYW5zbGF0aW9uLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6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BtYXAoKHRyYW5zbGF0ZWRQYXJ0cykgPT4gdHJhbnNsYXRlZFBhcnRzLmpvaW4oJycpKSwgLy8gSm9pbiBhbGwgdHJhbnNsYXRlZCBwYXJ0c1xuICAgICk7XG4gIH1cbn1cbiJdfQ==
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, Injectable, Directive, Pipe, APP_INITIALIZER, NgModule } from '@angular/core';
|
3
3
|
import { AXEventService, AXEventTypes } from '@acorex/core/events';
|
4
4
|
import { set, get } from 'lodash-es';
|
5
|
-
import { of, BehaviorSubject, forkJoin, tap, catchError, finalize, shareReplay, map, switchMap, startWith, firstValueFrom, take, lastValueFrom
|
5
|
+
import { of, BehaviorSubject, forkJoin, tap, catchError, finalize, shareReplay, map, switchMap, startWith, firstValueFrom, take, lastValueFrom } from 'rxjs';
|
6
6
|
|
7
7
|
const AX_TRANSLATION_CONFIG = new InjectionToken('AX_TRANSLATION_CONFIG', {
|
8
8
|
providedIn: 'root',
|
@@ -170,18 +170,9 @@ class AXTranslationService {
|
|
170
170
|
translate(key, options) {
|
171
171
|
const result = this.findAXTranslateOptionsFromKey(key);
|
172
172
|
if (result.length) {
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
// return this.load(item.key, {
|
177
|
-
// params: options.params,
|
178
|
-
// scope: item.scope || options.scope || this.config.defaultScope,
|
179
|
-
// lang: item.lang || options.lang || this.config.defaultLang,
|
180
|
-
// });
|
181
|
-
// }),
|
182
|
-
// );
|
183
|
-
// });
|
184
|
-
return this.translateAsyncAXTranslate(key, options);
|
173
|
+
return this.langChanges$.pipe(startWith(this.getActiveLang()), switchMap((lang) => {
|
174
|
+
return this.translateAsyncAXTranslate(key, options);
|
175
|
+
}));
|
185
176
|
}
|
186
177
|
else {
|
187
178
|
if (options?.lang) {
|
@@ -243,39 +234,6 @@ class AXTranslationService {
|
|
243
234
|
}
|
244
235
|
return result;
|
245
236
|
}
|
246
|
-
// private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions) {
|
247
|
-
// // Use findAXTranslateOptions to parse all <axt> tags in the input string
|
248
|
-
// const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
|
249
|
-
// const splitParts = key.split(regex); // Split into <axt> parts and text parts
|
250
|
-
// let translatedResult = '';
|
251
|
-
// for (const part of splitParts) {
|
252
|
-
// // Check if the part is an <axt> tag by using the findAXTranslateOptions function
|
253
|
-
// const optionsFromKey = this.findAXTranslateOptionsFromKey(part);
|
254
|
-
// if (optionsFromKey.length > 0) {
|
255
|
-
// // This is an <axt> part, translate it
|
256
|
-
// for (const parsed of optionsFromKey) {
|
257
|
-
// const parsedLang = parsed.lang || options.lang || this.getActiveLang();
|
258
|
-
// const parsedScope = parsed.scope || options.scope || this.config.defaultScope;
|
259
|
-
// const parsedKey = parsed.key;
|
260
|
-
// // Get the final translation, applying any params if needed
|
261
|
-
// const newTranslation = this.load(parsedKey, {
|
262
|
-
// lang: parsedLang,
|
263
|
-
// scope: parsedScope,
|
264
|
-
// params: options?.params,
|
265
|
-
// });
|
266
|
-
// newTranslation.pipe(first()).subscribe((translatedText) => {
|
267
|
-
// translatedResult += `${translatedText}`;
|
268
|
-
// });
|
269
|
-
// // Append the translated text
|
270
|
-
// }
|
271
|
-
// } else {
|
272
|
-
// // This is plain text, so add it as-is
|
273
|
-
// translatedResult += part;
|
274
|
-
// }
|
275
|
-
// console.log(translatedResult);
|
276
|
-
// }
|
277
|
-
// return of(translatedResult);
|
278
|
-
// }
|
279
237
|
translateAsyncAXTranslate(key, options) {
|
280
238
|
const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
|
281
239
|
const splitParts = key.split(regex); // Split into <axt> parts and text parts
|
@@ -293,7 +251,7 @@ class AXTranslationService {
|
|
293
251
|
lang: parsedLang,
|
294
252
|
scope: parsedScope,
|
295
253
|
params: options?.params,
|
296
|
-
})
|
254
|
+
}));
|
297
255
|
}
|
298
256
|
}
|
299
257
|
else {
|
@@ -302,8 +260,7 @@ class AXTranslationService {
|
|
302
260
|
}
|
303
261
|
}
|
304
262
|
// Use forkJoin to wait for all observables to complete
|
305
|
-
return forkJoin(translationObservables).pipe(map((translatedParts) => translatedParts.join(''))
|
306
|
-
);
|
263
|
+
return forkJoin(translationObservables).pipe(map((translatedParts) => translatedParts.join('')));
|
307
264
|
}
|
308
265
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
309
266
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, providedIn: 'root' }); }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-translation.mjs","sources":["../../../../libs/core/translation/src/lib/translation.config.ts","../../../../libs/core/translation/src/lib/translation.loader.ts","../../../../libs/core/translation/src/lib/translation.service.ts","../../../../libs/core/translation/src/lib/translation-scope.resolver.ts","../../../../libs/core/translation/src/lib/translator.directive.ts","../../../../libs/core/translation/src/lib/translator.pipe.ts","../../../../libs/core/translation/src/lib/translation.module.ts","../../../../libs/core/translation/src/acorex-core-translation.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AXTranslateLang, AXTranslateScope } from './translation.types';\n\nexport interface AXTranslationConfig {\n defaultLang: AXTranslateLang;\n defaultScope: AXTranslateScope;\n preloadLangs?: AXTranslateLang[];\n preloadScopes?: AXTranslateLang[];\n availableLangs?: AXTranslateLang[];\n scopeResolverKey: string;\n}\n\nexport const AX_TRANSLATION_CONFIG = new InjectionToken<AXTranslationConfig>('AX_TRANSLATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXTranslationDefaultConfig;\n },\n});\n\nexport const AXTranslationDefaultConfig: AXTranslationConfig = {\n defaultLang: 'en',\n defaultScope: 'common',\n scopeResolverKey: 'scope',\n};\n\nexport type AXPartialTranslationConfig = Partial<AXTranslationConfig>;\n\nexport function translationConfig(config: AXPartialTranslationConfig = {}): AXTranslationConfig {\n const result = {\n ...AXTranslationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslateLang, AXTranslateScope, AXTranslation } from './translation.types';\n\nexport interface AXTranslationLoaderOptions {\n lang: AXTranslateLang;\n scope?: AXTranslateScope;\n}\n\nexport interface AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation>;\n}\n\nexport class AXTranslationLoaderDefault implements AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation> {\n return of({});\n }\n}\n\nexport const AX_TRANSLATION_LOADER = new InjectionToken<AXTranslationLoader>('AX_TRANSLATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXTranslationLoaderDefault();\n },\n});\n","import { AXEventService, AXEventTypes } from '@acorex/core/events';\nimport { Injectable, inject } from '@angular/core';\nimport { get as lodashGet, set as lodashSet } from 'lodash-es';\nimport {\n BehaviorSubject,\n Observable,\n catchError,\n finalize,\n first,\n firstValueFrom,\n forkJoin,\n lastValueFrom,\n map,\n of,\n shareReplay,\n startWith,\n switchMap,\n take,\n tap,\n} from 'rxjs';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AX_TRANSLATION_LOADER } from './translation.loader';\nimport {\n AXTranslateHashMap,\n AXTranslateLang,\n AXTranslateOptions,\n AXTranslateParams,\n} from './translation.types';\n\nlet service: AXTranslationService;\n\nexport function translateSync(key: string, options?: AXTranslateOptions): string {\n return service.translateSync(key, options);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXTranslationService {\n private loader = inject(AX_TRANSLATION_LOADER);\n private config = inject(AX_TRANSLATION_CONFIG);\n\n private eventService = inject(AXEventService);\n\n private translationCache: AXTranslateHashMap<AXTranslateHashMap<string>> = {};\n private ongoingRequests: Map<string, Observable<any>> = new Map();\n\n private activeLang: BehaviorSubject<string> = new BehaviorSubject<string>(this.getDefaultLang());\n langChanges$: Observable<string> = this.activeLang.asObservable();\n\n private lastActiveLang: string | null = null;\n\n /**\n * @ignore\n */\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n service = this;\n }\n\n public loadLanguagesAndScopes(languages: string[], scopes: string[]): Observable<unknown> {\n const requests = languages.flatMap((lang) =>\n scopes.map((scope) => {\n // Check if translations are already cached\n if (this.translationCache[lang]?.[scope]) {\n return of(this.translationCache[lang][scope]);\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(lang, scope);\n }),\n );\n\n return forkJoin(requests);\n }\n\n private getOrLoadTranslations(lang: string, scope: string): Observable<AXTranslateHashMap<string>> {\n const requestKey = `${lang}_${scope}`;\n\n // Return existing observable if the request is already in progress\n if (this.ongoingRequests.has(requestKey)) {\n return this.ongoingRequests.get(requestKey);\n }\n\n // Load translations if not in cache or ongoing requests\n const translationObservable = this.loader.getTranslation({ lang, scope }).pipe(\n tap((translations) => this.cacheTranslations(lang, scope, translations)),\n catchError((error) => {\n console.error(`Error loading translations for lang: ${lang}, scope: ${scope}`, error);\n return of(null);\n }),\n finalize(() => {\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageLoaded,\n payload: lang,\n });\n this.ongoingRequests.delete(requestKey);\n }),\n shareReplay(1),\n );\n\n this.ongoingRequests.set(requestKey, translationObservable);\n return translationObservable;\n }\n\n private cacheTranslations(lang: string, scope: string, translations: AXTranslateHashMap<string>): void {\n lodashSet(this.translationCache, `${lang}.${scope}`, translations);\n }\n\n public getDefaultLang(): string {\n return this.config.defaultLang;\n }\n\n public getActiveLang(): string {\n return this.activeLang.getValue();\n }\n\n public setActiveLang(lang: string): void {\n if (lang != this.getActiveLang()) {\n this.lastActiveLang = this.getActiveLang(); // Update last active language\n this.activeLang.next(lang);\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageChanged,\n payload: lang,\n });\n }\n }\n\n public isLangAvailable(lang: string, scope: string = null): boolean {\n return !this.translationCache[lang] && (!scope || !this.translationCache[lang][scope]);\n }\n\n public getLangAvailable(): AXTranslateLang[] | undefined {\n return this.config.availableLangs;\n }\n\n private load(key: string, options: AXTranslateOptions = {}): Observable<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options;\n\n // Function to fetch translation\n const fetchTranslation = (language: string): Observable<string> => {\n // Check if translations are available in the cache\n if (this.translationCache[language]?.[scope]) {\n return of(this.getTranslation(key, language, scope, options.params));\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(language, scope).pipe(\n map(() => {\n const translation = this.translationCache[language]?.[scope]?.[key] || key;\n return this.getTranslation(translation, language, scope, options.params);\n }),\n switchMap((translatedText) => {\n if (translatedText === key && language !== this.getDefaultLang()) {\n // If the translation is not found and the language is not default,\n // try fetching from the default language\n return fetchTranslation(this.getDefaultLang());\n }\n return of(translatedText);\n }),\n );\n };\n\n // First, try to fetch the translation for the requested language\n const translationForRequestedLang = fetchTranslation(lang);\n\n // If lastActiveLang is available and different from the requested language, use it as a fallback\n if (this.lastActiveLang && this.lastActiveLang !== lang) {\n const translationForLastActiveLang = this.getTranslation(\n key,\n this.lastActiveLang,\n scope,\n options.params,\n );\n return translationForRequestedLang.pipe(startWith(translationForLastActiveLang));\n }\n\n return translationForRequestedLang;\n }\n\n private getTranslation(key: string, lang: string, scope: string, params?: AXTranslateParams): string {\n let translation: string = (lodashGet(this.translationCache, `${lang}.${scope}.${key}`) || key) as string;\n\n // Replace params like {{ name }}\n if (params) {\n Object.keys(params).forEach((paramKey) => {\n const paramValue = params[paramKey] as string;\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n translation = translation.replace(new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g'), paramValue);\n }\n });\n }\n\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n // Replace translations like {{ t('key') }}\n const translationPattern = /{{\\s*t\\('([^']+)'\\)\\s*}}/g;\n translation = translation.replace(translationPattern, (match, innerKey) => {\n return this.getTranslation(innerKey, lang, scope, params);\n });\n }\n\n return translation;\n }\n\n public translate(key: string, options?: AXTranslateOptions): Observable<string> {\n const result = this.findAXTranslateOptionsFromKey(key);\n if (result.length) {\n // result.forEach((item) => {\n // this.langChanges$.pipe(\n // switchMap((lang) => {\n // return this.load(item.key, {\n // params: options.params,\n // scope: item.scope || options.scope || this.config.defaultScope,\n // lang: item.lang || options.lang || this.config.defaultLang,\n // });\n // }),\n // );\n // });\n return this.translateAsyncAXTranslate(key, options);\n } else {\n if (options?.lang) {\n return this.load(key, options);\n }\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.load(key, { ...options, lang: lang });\n }),\n );\n }\n }\n\n public async translateAsync(key: string, options?: AXTranslateOptions): Promise<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n if (!translation) {\n // If the translation is not in the cache, load it\n await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));\n translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n }\n\n // If still not available, try the last active language or default language\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n if (!translation) {\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n\n public translateSync(key: string, options?: AXTranslateOptions): string {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n\n // Check if the translation for the active language is available\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n //\n const loadLang = () => lastValueFrom(this.getOrLoadTranslations(lang, scope));\n // If not available, check lastActiveLang\n if (!translation && this.lastActiveLang) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n\n // If still not available, use the default language\n if (!translation) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n private findAXTranslateOptionsFromKey(\n inputString: string,\n ): (Omit<AXTranslateOptions, 'params'> & { key: string })[] {\n const regex = /<axt(?:\\s+lang=\"([^\"]*)\")?(?:\\s+scope=\"([^\"]*)\")?>(.*?)<\\/axt>/g;\n const result: (Omit<AXTranslateOptions, 'params'> & { key: string })[] = [];\n let match;\n\n // Loop through all matches in the input string\n while ((match = regex.exec(inputString)) !== null) {\n result.push({\n lang: match[1] || undefined,\n scope: match[2] || undefined,\n key: match[3] || undefined,\n });\n }\n return result;\n }\n\n // private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions) {\n // // Use findAXTranslateOptions to parse all <axt> tags in the input string\n // const regex = /(<axt(?:\\s+lang=\"[^\"]*\")?(?:\\s+scope=\"[^\"]*\")?>.*?<\\/axt>)/g;\n // const splitParts = key.split(regex); // Split into <axt> parts and text parts\n\n // let translatedResult = '';\n\n // for (const part of splitParts) {\n // // Check if the part is an <axt> tag by using the findAXTranslateOptions function\n // const optionsFromKey = this.findAXTranslateOptionsFromKey(part);\n\n // if (optionsFromKey.length > 0) {\n // // This is an <axt> part, translate it\n // for (const parsed of optionsFromKey) {\n // const parsedLang = parsed.lang || options.lang || this.getActiveLang();\n // const parsedScope = parsed.scope || options.scope || this.config.defaultScope;\n // const parsedKey = parsed.key;\n\n // // Get the final translation, applying any params if needed\n // const newTranslation = this.load(parsedKey, {\n // lang: parsedLang,\n // scope: parsedScope,\n // params: options?.params,\n // });\n // newTranslation.pipe(first()).subscribe((translatedText) => {\n // translatedResult += `${translatedText}`;\n // });\n\n // // Append the translated text\n // }\n // } else {\n // // This is plain text, so add it as-is\n // translatedResult += part;\n // }\n // console.log(translatedResult);\n // }\n\n // return of(translatedResult);\n // }\n private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions): Observable<string> {\n const regex = /(<axt(?:\\s+lang=\"[^\"]*\")?(?:\\s+scope=\"[^\"]*\")?>.*?<\\/axt>)/g;\n const splitParts = key.split(regex); // Split into <axt> parts and text parts\n \n const translationObservables: Observable<string>[] = [];\n \n for (const part of splitParts) {\n const optionsFromKey = this.findAXTranslateOptionsFromKey(part);\n \n if (optionsFromKey.length > 0) {\n // This is an <axt> part, translate it\n for (const parsed of optionsFromKey) {\n const parsedLang = parsed.lang || options?.lang || this.getActiveLang();\n const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;\n const parsedKey = parsed.key;\n \n // Push the translation observable to the array\n translationObservables.push(\n this.load(parsedKey, {\n lang: parsedLang,\n scope: parsedScope,\n params: options?.params,\n }).pipe(first())\n );\n }\n } else {\n // This is plain text, so wrap it in an observable\n translationObservables.push(of(part));\n }\n }\n \n // Use forkJoin to wait for all observables to complete\n return forkJoin(translationObservables).pipe(\n map((translatedParts) => translatedParts.join('')) // Join all translated parts\n );\n }\n \n}\n","import { inject } from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\n\nexport const loadTranslationScope: ResolveFn<unknown> = (route, state) => {\n const translatorService = inject(AXTranslationService);\n const config = inject(AX_TRANSLATION_CONFIG);\n const scopeValue = route.data[config.scopeResolverKey];\n const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];\n return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);\n};\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Directive({\n selector: '[translate]',\n})\nexport class AXTranslatorDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private translationService: AXTranslationService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: (key: string, options?: AXTranslateOptions) => {\n return this.translationService.translate(key, options);\n },\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Pipe({ name: 'translate', pure: true }) // The pipe can now be pure\nexport class AXTranslatorPipe implements PipeTransform {\n constructor(private service: AXTranslationService) {}\n\n transform(key: string, options?: AXTranslateOptions): Observable<string> {\n if (!key) {\n return of(''); // Return an empty observable if the key is not provided\n }\n return this.service.translate(key, options);\n }\n}\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXTranslationConfig, AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslatorDirective } from './translator.directive';\nimport { AXTranslatorPipe } from './translator.pipe';\n\nfunction initializeApp(translatorService: AXTranslationService, config: AXTranslationConfig) {\n return (): Observable<any> => {\n return translatorService.loadLanguagesAndScopes(\n config.preloadLangs ?? [config.defaultLang],\n config.preloadScopes ?? [config.defaultScope],\n );\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXTranslatorPipe, AXTranslatorDirective],\n declarations: [AXTranslatorPipe, AXTranslatorDirective],\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeApp,\n deps: [AXTranslationService, AX_TRANSLATION_CONFIG],\n multi: true,\n },\n ],\n})\nexport class AXTranslationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["lodashSet","lodashGet","i1.AXTranslationService"],"mappings":";;;;;;MAYa,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,0BAA0B;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;;;AC5BD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-translation.mjs","sources":["../../../../libs/core/translation/src/lib/translation.config.ts","../../../../libs/core/translation/src/lib/translation.loader.ts","../../../../libs/core/translation/src/lib/translation.service.ts","../../../../libs/core/translation/src/lib/translation-scope.resolver.ts","../../../../libs/core/translation/src/lib/translator.directive.ts","../../../../libs/core/translation/src/lib/translator.pipe.ts","../../../../libs/core/translation/src/lib/translation.module.ts","../../../../libs/core/translation/src/acorex-core-translation.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AXTranslateLang, AXTranslateScope } from './translation.types';\n\nexport interface AXTranslationConfig {\n defaultLang: AXTranslateLang;\n defaultScope: AXTranslateScope;\n preloadLangs?: AXTranslateLang[];\n preloadScopes?: AXTranslateLang[];\n availableLangs?: AXTranslateLang[];\n scopeResolverKey: string;\n}\n\nexport const AX_TRANSLATION_CONFIG = new InjectionToken<AXTranslationConfig>('AX_TRANSLATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXTranslationDefaultConfig;\n },\n});\n\nexport const AXTranslationDefaultConfig: AXTranslationConfig = {\n defaultLang: 'en',\n defaultScope: 'common',\n scopeResolverKey: 'scope',\n};\n\nexport type AXPartialTranslationConfig = Partial<AXTranslationConfig>;\n\nexport function translationConfig(config: AXPartialTranslationConfig = {}): AXTranslationConfig {\n const result = {\n ...AXTranslationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslateLang, AXTranslateScope, AXTranslation } from './translation.types';\n\nexport interface AXTranslationLoaderOptions {\n lang: AXTranslateLang;\n scope?: AXTranslateScope;\n}\n\nexport interface AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation>;\n}\n\nexport class AXTranslationLoaderDefault implements AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation> {\n return of({});\n }\n}\n\nexport const AX_TRANSLATION_LOADER = new InjectionToken<AXTranslationLoader>('AX_TRANSLATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXTranslationLoaderDefault();\n },\n});\n","import { AXEventService, AXEventTypes } from '@acorex/core/events';\nimport { Injectable, inject } from '@angular/core';\nimport { get as lodashGet, set as lodashSet } from 'lodash-es';\nimport {\n BehaviorSubject,\n Observable,\n catchError,\n finalize,\n firstValueFrom,\n forkJoin,\n lastValueFrom,\n map,\n of,\n shareReplay,\n startWith,\n switchMap,\n take,\n tap,\n} from 'rxjs';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AX_TRANSLATION_LOADER } from './translation.loader';\nimport {\n AXTranslateHashMap,\n AXTranslateLang,\n AXTranslateOptions,\n AXTranslateParams,\n} from './translation.types';\n\nlet service: AXTranslationService;\n\nexport function translateSync(key: string, options?: AXTranslateOptions): string {\n return service.translateSync(key, options);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXTranslationService {\n private loader = inject(AX_TRANSLATION_LOADER);\n private config = inject(AX_TRANSLATION_CONFIG);\n\n private eventService = inject(AXEventService);\n\n private translationCache: AXTranslateHashMap<AXTranslateHashMap<string>> = {};\n private ongoingRequests: Map<string, Observable<any>> = new Map();\n\n private activeLang: BehaviorSubject<string> = new BehaviorSubject<string>(this.getDefaultLang());\n langChanges$: Observable<string> = this.activeLang.asObservable();\n\n private lastActiveLang: string | null = null;\n\n /**\n * @ignore\n */\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n service = this;\n }\n\n public loadLanguagesAndScopes(languages: string[], scopes: string[]): Observable<unknown> {\n const requests = languages.flatMap((lang) =>\n scopes.map((scope) => {\n // Check if translations are already cached\n if (this.translationCache[lang]?.[scope]) {\n return of(this.translationCache[lang][scope]);\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(lang, scope);\n }),\n );\n\n return forkJoin(requests);\n }\n\n private getOrLoadTranslations(lang: string, scope: string): Observable<AXTranslateHashMap<string>> {\n const requestKey = `${lang}_${scope}`;\n\n // Return existing observable if the request is already in progress\n if (this.ongoingRequests.has(requestKey)) {\n return this.ongoingRequests.get(requestKey);\n }\n\n // Load translations if not in cache or ongoing requests\n const translationObservable = this.loader.getTranslation({ lang, scope }).pipe(\n tap((translations) => this.cacheTranslations(lang, scope, translations)),\n catchError((error) => {\n console.error(`Error loading translations for lang: ${lang}, scope: ${scope}`, error);\n return of(null);\n }),\n finalize(() => {\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageLoaded,\n payload: lang,\n });\n this.ongoingRequests.delete(requestKey);\n }),\n shareReplay(1),\n );\n\n this.ongoingRequests.set(requestKey, translationObservable);\n return translationObservable;\n }\n\n private cacheTranslations(lang: string, scope: string, translations: AXTranslateHashMap<string>): void {\n lodashSet(this.translationCache, `${lang}.${scope}`, translations);\n }\n\n public getDefaultLang(): string {\n return this.config.defaultLang;\n }\n\n public getActiveLang(): string {\n return this.activeLang.getValue();\n }\n\n public setActiveLang(lang: string): void {\n if (lang != this.getActiveLang()) {\n this.lastActiveLang = this.getActiveLang(); // Update last active language\n this.activeLang.next(lang);\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageChanged,\n payload: lang,\n });\n }\n }\n\n public isLangAvailable(lang: string, scope: string = null): boolean {\n return !this.translationCache[lang] && (!scope || !this.translationCache[lang][scope]);\n }\n\n public getLangAvailable(): AXTranslateLang[] | undefined {\n return this.config.availableLangs;\n }\n\n private load(key: string, options: AXTranslateOptions = {}): Observable<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options;\n\n // Function to fetch translation\n const fetchTranslation = (language: string): Observable<string> => {\n // Check if translations are available in the cache\n if (this.translationCache[language]?.[scope]) {\n return of(this.getTranslation(key, language, scope, options.params));\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(language, scope).pipe(\n map(() => {\n const translation = this.translationCache[language]?.[scope]?.[key] || key;\n return this.getTranslation(translation, language, scope, options.params);\n }),\n switchMap((translatedText) => {\n if (translatedText === key && language !== this.getDefaultLang()) {\n // If the translation is not found and the language is not default,\n // try fetching from the default language\n return fetchTranslation(this.getDefaultLang());\n }\n return of(translatedText);\n }),\n );\n };\n\n // First, try to fetch the translation for the requested language\n const translationForRequestedLang = fetchTranslation(lang);\n\n // If lastActiveLang is available and different from the requested language, use it as a fallback\n if (this.lastActiveLang && this.lastActiveLang !== lang) {\n const translationForLastActiveLang = this.getTranslation(\n key,\n this.lastActiveLang,\n scope,\n options.params,\n );\n return translationForRequestedLang.pipe(startWith(translationForLastActiveLang));\n }\n\n return translationForRequestedLang;\n }\n\n private getTranslation(key: string, lang: string, scope: string, params?: AXTranslateParams): string {\n let translation: string = (lodashGet(this.translationCache, `${lang}.${scope}.${key}`) || key) as string;\n\n // Replace params like {{ name }}\n if (params) {\n Object.keys(params).forEach((paramKey) => {\n const paramValue = params[paramKey] as string;\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n translation = translation.replace(new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g'), paramValue);\n }\n });\n }\n\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n // Replace translations like {{ t('key') }}\n const translationPattern = /{{\\s*t\\('([^']+)'\\)\\s*}}/g;\n translation = translation.replace(translationPattern, (match, innerKey) => {\n return this.getTranslation(innerKey, lang, scope, params);\n });\n }\n\n return translation;\n }\n\n public translate(key: string, options?: AXTranslateOptions): Observable<string> {\n const result = this.findAXTranslateOptionsFromKey(key);\n if (result.length) {\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.translateAsyncAXTranslate(key, options);\n }),\n );\n } else {\n if (options?.lang) {\n return this.load(key, options);\n }\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.load(key, { ...options, lang: lang });\n }),\n );\n }\n }\n\n public async translateAsync(key: string, options?: AXTranslateOptions): Promise<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n if (!translation) {\n // If the translation is not in the cache, load it\n await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));\n translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n }\n\n // If still not available, try the last active language or default language\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n if (!translation) {\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n\n public translateSync(key: string, options?: AXTranslateOptions): string {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n\n // Check if the translation for the active language is available\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n //\n const loadLang = () => lastValueFrom(this.getOrLoadTranslations(lang, scope));\n // If not available, check lastActiveLang\n if (!translation && this.lastActiveLang) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n\n // If still not available, use the default language\n if (!translation) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n private findAXTranslateOptionsFromKey(\n inputString: string,\n ): (Omit<AXTranslateOptions, 'params'> & { key: string })[] {\n const regex = /<axt(?:\\s+lang=\"([^\"]*)\")?(?:\\s+scope=\"([^\"]*)\")?>(.*?)<\\/axt>/g;\n const result: (Omit<AXTranslateOptions, 'params'> & { key: string })[] = [];\n let match;\n\n // Loop through all matches in the input string\n while ((match = regex.exec(inputString)) !== null) {\n result.push({\n lang: match[1] || undefined,\n scope: match[2] || undefined,\n key: match[3] || undefined,\n });\n }\n return result;\n }\n\n private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions): Observable<string> {\n const regex = /(<axt(?:\\s+lang=\"[^\"]*\")?(?:\\s+scope=\"[^\"]*\")?>.*?<\\/axt>)/g;\n const splitParts = key.split(regex); // Split into <axt> parts and text parts\n\n const translationObservables: Observable<string>[] = [];\n\n for (const part of splitParts) {\n const optionsFromKey = this.findAXTranslateOptionsFromKey(part);\n\n if (optionsFromKey.length > 0) {\n // This is an <axt> part, translate it\n for (const parsed of optionsFromKey) {\n const parsedLang = parsed.lang || options?.lang || this.getActiveLang();\n const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;\n const parsedKey = parsed.key;\n\n // Push the translation observable to the array\n translationObservables.push(\n this.load(parsedKey, {\n lang: parsedLang,\n scope: parsedScope,\n params: options?.params,\n }),\n );\n }\n } else {\n // This is plain text, so wrap it in an observable\n translationObservables.push(of(part));\n }\n }\n\n // Use forkJoin to wait for all observables to complete\n return forkJoin(translationObservables).pipe(\n map((translatedParts) => translatedParts.join('')), // Join all translated parts\n );\n }\n}\n","import { inject } from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\n\nexport const loadTranslationScope: ResolveFn<unknown> = (route, state) => {\n const translatorService = inject(AXTranslationService);\n const config = inject(AX_TRANSLATION_CONFIG);\n const scopeValue = route.data[config.scopeResolverKey];\n const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];\n return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);\n};\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Directive({\n selector: '[translate]',\n})\nexport class AXTranslatorDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private translationService: AXTranslationService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: (key: string, options?: AXTranslateOptions) => {\n return this.translationService.translate(key, options);\n },\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Pipe({ name: 'translate', pure: true }) // The pipe can now be pure\nexport class AXTranslatorPipe implements PipeTransform {\n constructor(private service: AXTranslationService) {}\n\n transform(key: string, options?: AXTranslateOptions): Observable<string> {\n if (!key) {\n return of(''); // Return an empty observable if the key is not provided\n }\n return this.service.translate(key, options);\n }\n}\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXTranslationConfig, AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslatorDirective } from './translator.directive';\nimport { AXTranslatorPipe } from './translator.pipe';\n\nfunction initializeApp(translatorService: AXTranslationService, config: AXTranslationConfig) {\n return (): Observable<any> => {\n return translatorService.loadLanguagesAndScopes(\n config.preloadLangs ?? [config.defaultLang],\n config.preloadScopes ?? [config.defaultScope],\n );\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXTranslatorPipe, AXTranslatorDirective],\n declarations: [AXTranslatorPipe, AXTranslatorDirective],\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeApp,\n deps: [AXTranslationService, AX_TRANSLATION_CONFIG],\n multi: true,\n },\n ],\n})\nexport class AXTranslationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["lodashSet","lodashGet","i1.AXTranslationService"],"mappings":";;;;;;MAYa,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,0BAA0B;KAClC;AACF,CAAA;AAEY,MAAA,0BAA0B,GAAwB;AAC7D,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,YAAY,EAAE,QAAQ;AACtB,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