@esfaenza/localizations 15.2.3 → 15.2.5
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/esm2020/lib/localizations.module.mjs +4 -5
- package/esm2020/public-api.mjs +1 -2
- package/fesm2015/esfaenza-localizations.mjs +5 -48
- package/fesm2015/esfaenza-localizations.mjs.map +1 -1
- package/fesm2020/esfaenza-localizations.mjs +5 -46
- package/fesm2020/esfaenza-localizations.mjs.map +1 -1
- package/lib/localizations.module.d.ts +1 -2
- package/package.json +2 -3
- package/public-api.d.ts +0 -1
- package/esm2020/lib/pipes/loc_date.pipe.mjs +0 -43
- package/lib/pipes/loc_date.pipe.d.ts +0 -24
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Angular
|
|
2
2
|
import { NgModule } from '@angular/core';
|
|
3
3
|
// Pipe
|
|
4
|
-
import { LocDatePipe } from './pipes/loc_date.pipe';
|
|
5
4
|
import { LocalizePipe } from './pipes/localize.pipe';
|
|
6
5
|
// Servizi
|
|
7
6
|
import { LocalizationService } from './localizations.service';
|
|
@@ -26,13 +25,13 @@ export class LocalizationModule {
|
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
LocalizationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
29
|
-
LocalizationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, declarations: [LocalizePipe
|
|
28
|
+
LocalizationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, declarations: [LocalizePipe], exports: [LocalizePipe] });
|
|
30
29
|
LocalizationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule });
|
|
31
30
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
32
31
|
type: NgModule,
|
|
33
32
|
args: [{
|
|
34
|
-
declarations: [LocalizePipe
|
|
35
|
-
exports: [LocalizePipe
|
|
33
|
+
declarations: [LocalizePipe],
|
|
34
|
+
exports: [LocalizePipe]
|
|
36
35
|
}]
|
|
37
36
|
}] });
|
|
38
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWxpemF0aW9ucy5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9sb2NhbGl6YXRpb25zL3NyYy9saWIvbG9jYWxpemF0aW9ucy5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsVUFBVTtBQUNWLE9BQU8sRUFBRSxRQUFRLEVBQXVCLE1BQU0sZUFBZSxDQUFDO0FBRTlELE9BQU87QUFDUCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFckQsVUFBVTtBQUNWLE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzlELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQzVELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUNyRSxPQUFPLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSwrQ0FBK0MsQ0FBQztBQUk1RixPQUFPLEVBQUUseUJBQXlCLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUMvRSxPQUFPLEVBQUUsVUFBVSxFQUFFLGtCQUFrQixFQUFFLE1BQU0sVUFBVSxDQUFDOztBQU0xRCxNQUFNLE9BQU8sa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sXHJcbiAgICAgICAgQmFzZUxvY2FsaXphdGlvbixcclxuICAgICAgICB7IHByb3ZpZGU6IExPQ19MT0NBTEUsIHVzZVZhbHVlOiBjb25maWc/LmRlZmF1bHRMb2NhbGUgfHwgJ2l0LUlUJyB9LFxyXG4gICAgICAgIHsgcHJvdmlkZTogTE9DX01JU1NJTkdfUE9MSUNZLCB1c2VWYWx1ZTogY29uZmlnPy5sb2NhbGl6YXRpb25NaXNzaW5nUG9saWN5IHx8IExvY2FsaXphdGlvbk1pc3NpbmdQb2xpY3kuUHJpbnRFbXB0eX0sXHJcbiAgICAgICAgeyBwcm92aWRlOiBMb2NhbGVQZXJzaXN0b3IsIHVzZUNsYXNzOiBjb25maWc/LmxvY2FsZVBlcnNpc3RvciB8fCBMb2NhbFN0b3JhZ2VMb2NhbGVQZXJzaXN0b3IgfSxcclxuICAgICAgXVxyXG4gICAgfTtcclxuICB9XHJcbn0iXX0=
|
package/esm2020/public-api.mjs
CHANGED
|
@@ -5,9 +5,8 @@ export * from './lib/core/localization.base';
|
|
|
5
5
|
export * from './lib/localizations.module';
|
|
6
6
|
export * from './lib/localizations.service';
|
|
7
7
|
export * from './lib/pipes/localize.pipe';
|
|
8
|
-
export * from './lib/pipes/loc_date.pipe';
|
|
9
8
|
export * from './lib/tokens';
|
|
10
9
|
export * from './lib/models/LocalizationModuleConfig';
|
|
11
10
|
export * from './lib/models/BaseLocalizationTokens';
|
|
12
11
|
export * from './lib/models/LocalizationMissingPolicy';
|
|
13
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2xvY2FsaXphdGlvbnMvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLDhCQUE4QixDQUFDO0FBQzdDLGNBQWMsNEJBQTRCLENBQUM7QUFDM0MsY0FBYyw2QkFBNkIsQ0FBQztBQUM1QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMsdUNBQXVDLENBQUM7QUFDdEQsY0FBYyxxQ0FBcUMsQ0FBQztBQUNwRCxjQUFjLHdDQUF3QyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcclxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIGxvY2FsaXphdGlvbnNcclxuICovXHJcblxyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9jb3JlL2xvY2FsaXphdGlvbi5iYXNlJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvbG9jYWxpemF0aW9ucy5tb2R1bGUnO1xyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9sb2NhbGl6YXRpb25zLnNlcnZpY2UnO1xyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9waXBlcy9sb2NhbGl6ZS5waXBlJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvdG9rZW5zJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvbW9kZWxzL0xvY2FsaXphdGlvbk1vZHVsZUNvbmZpZyc7XHJcbmV4cG9ydCAqIGZyb20gJy4vbGliL21vZGVscy9CYXNlTG9jYWxpemF0aW9uVG9rZW5zJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvbW9kZWxzL0xvY2FsaXphdGlvbk1pc3NpbmdQb2xpY3knOyJdfQ==
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, Injectable, Inject, Pipe,
|
|
3
|
+
import { InjectionToken, Injectable, Inject, Pipe, NgModule } from '@angular/core';
|
|
4
4
|
import { take, first } from 'rxjs/operators';
|
|
5
5
|
import { ReplaySubject, of } from 'rxjs';
|
|
6
|
-
import * as i1 from '@esfaenza/extensions';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Contenitore delle localizzazioni collegate ad un testo "base", una per ogni linguaggio supportato
|
|
@@ -306,48 +305,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
306
305
|
}] }];
|
|
307
306
|
} });
|
|
308
307
|
|
|
309
|
-
// Angular
|
|
310
|
-
/**
|
|
311
|
-
* Pipe che permette di formattare una data in base al formato specificato. Utilizza il **DateService** di **@esfaenza/extensions** per ricondurre l'input a una data valida
|
|
312
|
-
*/
|
|
313
|
-
class LocDatePipe {
|
|
314
|
-
/**
|
|
315
|
-
* @ignore
|
|
316
|
-
*/
|
|
317
|
-
constructor(dts) {
|
|
318
|
-
this.dts = dts;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Trasformazione della data in input in base al formato richiesto
|
|
322
|
-
*
|
|
323
|
-
* @param {any} value Valore da ricondurre ad una data e formattare
|
|
324
|
-
* @param {string} format Formato in output della data da visualizzare
|
|
325
|
-
*
|
|
326
|
-
* @returns {string} Data formattata in base al formato
|
|
327
|
-
*/
|
|
328
|
-
transform(value, format = "DD/MM/YYYY") {
|
|
329
|
-
if (value == null || value === "")
|
|
330
|
-
return null;
|
|
331
|
-
if (!this.dts) {
|
|
332
|
-
console.error("Tentativo di usare loc_date senza DateService. È possibile importare DateService installando e configurando il pacchetto @esfaenza/extensions");
|
|
333
|
-
return null;
|
|
334
|
-
}
|
|
335
|
-
var detatchedValue = JSON.parse(JSON.stringify(value));
|
|
336
|
-
var dt = this.dts.getDateConvertion(detatchedValue);
|
|
337
|
-
return dt.format(format);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
LocDatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, deps: [{ token: i1.DateService, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
341
|
-
LocDatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, name: "loc_date" });
|
|
342
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, decorators: [{
|
|
343
|
-
type: Pipe,
|
|
344
|
-
args: [{ name: "loc_date", pure: true }]
|
|
345
|
-
}], ctorParameters: function () {
|
|
346
|
-
return [{ type: i1.DateService, decorators: [{
|
|
347
|
-
type: Optional
|
|
348
|
-
}] }];
|
|
349
|
-
} });
|
|
350
|
-
|
|
351
308
|
/**
|
|
352
309
|
* Enum che rappresenta le policy di comportamento qualore il sistema di localizzazione non trovi la localizzazione cercata,
|
|
353
310
|
* usare **ThrowException** solo se ci si sente infallibili o si vuole debuggare in maniera approfondita l'applicazione
|
|
@@ -551,13 +508,13 @@ class LocalizationModule {
|
|
|
551
508
|
}
|
|
552
509
|
}
|
|
553
510
|
LocalizationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
554
|
-
LocalizationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, declarations: [LocalizePipe
|
|
511
|
+
LocalizationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, declarations: [LocalizePipe], exports: [LocalizePipe] });
|
|
555
512
|
LocalizationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule });
|
|
556
513
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
557
514
|
type: NgModule,
|
|
558
515
|
args: [{
|
|
559
|
-
declarations: [LocalizePipe
|
|
560
|
-
exports: [LocalizePipe
|
|
516
|
+
declarations: [LocalizePipe],
|
|
517
|
+
exports: [LocalizePipe]
|
|
561
518
|
}]
|
|
562
519
|
}] });
|
|
563
520
|
|
|
@@ -575,5 +532,5 @@ class LocalizationModuleConfig {
|
|
|
575
532
|
* Generated bundle index. Do not edit.
|
|
576
533
|
*/
|
|
577
534
|
|
|
578
|
-
export { BaseLocalization, BaseLocalizationTokens, LOC_LOCALE, LOC_MISSING_POLICY,
|
|
535
|
+
export { BaseLocalization, BaseLocalizationTokens, LOC_LOCALE, LOC_MISSING_POLICY, LocalizationMissingPolicy, LocalizationModule, LocalizationModuleConfig, LocalizationService, LocalizePipe };
|
|
579
536
|
//# sourceMappingURL=esfaenza-localizations.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esfaenza-localizations.mjs","sources":["../../../projects/localizations/src/lib/models/ItemLocalization.ts","../../../projects/localizations/src/lib/models/LocaleObject.ts","../../../projects/localizations/src/lib/models/LocaleDefinitions.ts","../../../projects/localizations/src/lib/models/SpecializedLocalization.ts","../../../projects/localizations/src/lib/core/localization.persistor.ts","../../../projects/localizations/src/lib/models/BaseLocalizationTokens.ts","../../../projects/localizations/src/lib/tokens.ts","../../../projects/localizations/src/lib/locale-persistor/LocalePersistor.ts","../../../projects/localizations/src/lib/core/localization.base.ts","../../../projects/localizations/src/lib/pipes/loc_date.pipe.ts","../../../projects/localizations/src/lib/models/LocalizationMissingPolicy.ts","../../../projects/localizations/src/lib/localizations.service.ts","../../../projects/localizations/src/lib/pipes/localize.pipe.ts","../../../projects/localizations/src/lib/locale-persistor/LocalStorageCachePersistor.ts","../../../projects/localizations/src/lib/localizations.module.ts","../../../projects/localizations/src/lib/models/LocalizationModuleConfig.ts","../../../projects/localizations/src/public-api.ts","../../../projects/localizations/src/esfaenza-localizations.ts"],"sourcesContent":["import { SpecializedLocalization } from \"./SpecializedLocalization\";\r\n\r\n/**\r\n * Contenitore delle localizzazioni collegate ad un testo \"base\", una per ogni linguaggio supportato\r\n */\r\nexport class ItemLocalization {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {boolean} token Indica se è un token o se è un testo\r\n * @param {string} baseText Testo base che verrà richiesto quando verrà cercata la localizzazione\r\n * @param {SpecializedLocalization[]} translations Lista di traduzioni in base al testo base\r\n */\r\n constructor(public token: boolean, public baseText: string, public translations: SpecializedLocalization[]){ }\r\n}","\r\n/**\r\n * Classe che rappresenta un locale (Es. 'Italiano') con i propri alias (Es. 'it' oppure 'it-IT')\r\n */\r\nexport class LocaleObject {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} id Codice locale\r\n * @param {string} description Descrizione locale\r\n * @param {string[]} aliases Alias con cui quel locale è conosciuto\r\n */\r\n constructor(public id: string, public description: string, public aliases: string[]) { }\r\n}\r\n","import { LocaleObject } from \"./LocaleObject\";\r\n\r\n// VVVVVVVV Tag per evitare che typescript muoia con l'errore \"Error encountered in metadata generated for exported symbol 'LocaleDefinitions'\" (https://github.com/angular/angular/issues/18867#issuecomment-357484102),\r\n// @dynamic\r\n\r\n/**\r\n * Definizione dei locali disponibili\r\n */\r\nexport class LocaleDefinitions {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor() { }\r\n\r\n /**\r\n * Lista dei locali disponibili, definiti anche con i vari alias\r\n */\r\n public static AvailableLocales: LocaleObject[] = [\r\n new LocaleObject('it-IT', 'Italiano', ['it', 'it-IT']),\r\n new LocaleObject('en-US', 'English', ['en', 'en-US'])\r\n ];\r\n\r\n /**\r\n * In base a un alias restituisce il locale rappresentato\r\n * \r\n * @param {string} alias Alias in base al quale raccogliere il Locale\r\n * \r\n * @returns {LocaleObject} Locale richiesto dall'alias\r\n */\r\n public static getByAlias(alias: string): LocaleObject {\r\n return this.AvailableLocales.find(t => !!t.aliases.find(a => a == alias));\r\n }\r\n}\r\n","/**\r\n * Classe che rappresenta la localizzazione di un test base per una certa lingua\r\n */\r\nexport class SpecializedLocalization {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} culture Culture della traduzione\r\n * @param {string} translation Traduzione nella lingua specificata dalla **culture**\r\n */\r\n constructor(public culture: string, public translation: string) { }\r\n}\r\n","import { ItemLocalization } from \"../models/ItemLocalization\";\r\nimport { LocaleDefinitions } from \"../models/LocaleDefinitions\";\r\nimport { SpecializedLocalization } from \"../models/SpecializedLocalization\";\r\n\r\nexport class LocalizationPersistor {\r\n\r\n constructor(private LocCache: { [id: string]: ItemLocalization } = null) { }\r\n\r\n /**\r\n * Imposta la localizzazione di un token all'interno della cache scelta\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} token Nome del token\r\n * @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n public setToken(direction: string, token: string, left: string, right: string[]) {\r\n let parsingRegex = /([a-zA-Z]+)[\\s]*->[\\s]*([a-zA-Z,\\s]+)+/g;\r\n var parsingRes = parsingRegex.exec(direction);\r\n\r\n let from = parsingRes[1];\r\n let to: string[] = parsingRes[2].replace(/\\s/g, '').split(',');\r\n let localeFrom = LocaleDefinitions.getByAlias(from);\r\n this._set(token, localeFrom.id, left, true);\r\n\r\n to.forEach((t, index) => {\r\n let localeTo = LocaleDefinitions.getByAlias(t);\r\n this._set(token, localeTo.id, right[index], true);\r\n });\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di una frase all'interno della cache scelta\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n public set(direction: string, left: string, right: string[]) {\r\n let parsingRegex = /([a-zA-Z]+)[\\s]*->[\\s]*([a-zA-Z,\\s]+)+/g;\r\n var parsingRes = parsingRegex.exec(direction);\r\n\r\n let from = parsingRes[1];\r\n let to: string[] = parsingRes[2].replace(/\\s/g, '').split(',');\r\n let localeFrom = LocaleDefinitions.getByAlias(from);\r\n this._set(left, localeFrom.id, left);\r\n\r\n to.forEach((t, index) => {\r\n let localeTo = LocaleDefinitions.getByAlias(t);\r\n this._set(left, localeTo.id, right[index]);\r\n });\r\n }\r\n\r\n /**\r\n * Imposta all'interno della cache specificata un'unica traduzione partendo da un testo di base\r\n * \r\n * @param {string} text Testo da tradurre\r\n * @param {string} culture Lingua per cui inserire la traduzione\r\n * @param {string} translation Traduzione del **text** nella lingua specificata da **culture**\r\n * @param {boolean} token Indica se il **text** è un token o è una frase normale\r\n */\r\n private _set(text: string, culture: string, translation: string, token?: boolean) {\r\n let item = this.get(text, token);\r\n if (!item) {\r\n this.LocCache[text] = new ItemLocalization(token, text, [new SpecializedLocalization(culture, translation)]);\r\n return;\r\n }\r\n\r\n var trs = this.translationByCulture(item, culture);\r\n if (trs) {\r\n console.warn(\"Localization already loaded for sentence '\" + text + \"' and culture \" + culture);\r\n return;\r\n }\r\n\r\n item.translations.push(new SpecializedLocalization(culture, translation));\r\n }\r\n\r\n /**\r\n * Partendo da una cache di localizzazione, dato un testo che può essere o meno un token, cerca quell'elemento all'interno della cache\r\n * \r\n * @param {string} text Testo da cercare nella **LocCache**\r\n * @param {boolean} allowtokens Indica se l'elemento cercato può essere un token o se dev'essere per forza una frase (per evitare rari \r\n * casi di collisione in cui magari un token è uguale a una frase tradotta)\r\n * \r\n * @returns {ItemLocalization} Informazioni di localizzazione per il **text** cercato\r\n */\r\n public get(text: string, allowtokens: boolean): ItemLocalization {\r\n let possibleItem: ItemLocalization = this.LocCache[text];\r\n var item = possibleItem && (allowtokens || !possibleItem.token) ? possibleItem : null;\r\n return item;\r\n }\r\n\r\n /**\r\n * Date le informazioni di localizzazione per un testo cerca e restituisce la traduzione per una lingua specifica\r\n * \r\n * @param {ItemLocalization} Informazioni di localizzazione\r\n * @param {string} culture Lingua della traduzione richiesta\r\n * \r\n * @returns {SpecializedLocalization} Informazioni di localizzazione specifiche della lingua richiesta\r\n */\r\n public translationByCulture(item: ItemLocalization, culture: string): SpecializedLocalization {\r\n for (let i = 0; i < item.translations.length; i++) {\r\n let trl = item.translations[i];\r\n if (trl.culture == culture)\r\n return trl;\r\n }\r\n\r\n return null;\r\n }\r\n}","\r\nexport enum BaseLocalizationTokens {\r\n getDateMonthPosition = \"getDateMonthPosition\",\r\n getDisplayDateMonthPosition = \"getDisplayDateMonthPosition\",\r\n getLocale = \"getLocale\",\r\n getSmallDateFormat = \"getSmallDateFormat\",\r\n getDefaultDateFormat = \"getDefaultDateFormat\",\r\n getSmallDateDisplayFormat = \"getSmallDateDisplayFormat\",\r\n getFullDateFormat = \"getFullDateFormat\",\r\n getFullDateDisplayFormat = \"getFullDateDisplayFormat\",\r\n getFullDateFormatNoSeconds = \"getFullDateFormatNoSeconds\",\r\n getFullDateDisplayFormatNoSeconds = \"getFullDateDisplayFormatNoSeconds\"\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { LocalizationMissingPolicy } from \"./models/LocalizationMissingPolicy\"\r\n\r\n/** Locale da utilizzare per le traduzioni */\r\nexport const LOC_LOCALE: InjectionToken<string> = new InjectionToken<string>('LOC_LOCALE');\r\n\r\n/** Policy da utilizzare per traduzioni mancanti */\r\nexport const LOC_MISSING_POLICY: InjectionToken<LocalizationMissingPolicy> = new InjectionToken<LocalizationMissingPolicy>('LOC_MISSING_POLICY');","import { Observable } from \"rxjs\";\r\n\r\n/** Classe astratta che rappresenta lo stato di persistenza fra la libreria e uno storage */\r\nexport abstract class LocalePersistor {\r\n\r\n /** Chiave su cui salvare il locale */\r\n protected LOCALE: string = \"LOCALE\";\r\n\r\n /**\r\n * Salva il Locale\r\n * \r\n * @param {string} locale Locale da salvare\r\n */\r\n public abstract persist(locale: string): Observable<boolean>;\r\n\r\n /**\r\n * Recupera il Locale\r\n * \r\n * @returns {Observable<string>} Valore salvato per il locale\r\n */\r\n public abstract recover(): Observable<string>;\r\n}","import { Inject, Injectable } from \"@angular/core\";\r\nimport { ItemLocalization } from \"../models/ItemLocalization\";\r\nimport { LocalizationPersistor } from \"./localization.persistor\";\r\nimport { BaseLocalizationTokens } from \"../models/BaseLocalizationTokens\";\r\nimport { LocalePersistor } from \"../locale-persistor/LocalePersistor\";\r\nimport { take } from \"rxjs/operators\";\r\nimport { ReplaySubject } from \"rxjs\";\r\nimport { LOC_LOCALE } from \"../tokens\";\r\n\r\n/**\r\n * Classe singleton che contiene le traduzioni di base (per evitare di ripeterle in oggi classe di traduzione) e le funzioni base per \r\n * inserire e leggere traduzioni in/da una cache\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class BaseLocalization {\r\n\r\n /**\r\n * Cache di tutte le localizzazioni di base\r\n */\r\n public LocCache: { [id: string]: ItemLocalization } = {};\r\n\r\n /**\r\n * Persistor delle localizzazioni relativo a questa classe\r\n */\r\n public Persistor: LocalizationPersistor;\r\n\r\n /**\r\n * Locale di riferimento per tutte le traduzioni\r\n */\r\n public Locale: ReplaySubject<string> = new ReplaySubject<string>(1);\r\n\r\n /**\r\n * Costruttore. Da qui utilizzando il metodo statico **BaseLocalization.set** si va a popolare la cache delle traduzioni **BaseTranslations**\r\n */\r\n constructor(public LocalePersistor: LocalePersistor, @Inject(LOC_LOCALE) defaultLocale: string) {\r\n\r\n // Recupero il locale alla partenza del BaseLocalization in modo, spero di dare tempo all'applicazione di tirarlo su\r\n this.LocalePersistor.recover().pipe(take(1)).subscribe(async l => {\r\n if (!l) {\r\n l = defaultLocale;\r\n this.LocalePersistor.persist(defaultLocale);\r\n }\r\n this.Locale.next(l)\r\n });\r\n\r\n this.Persistor = new LocalizationPersistor(this.LocCache); \r\n\r\n this.Persistor.set(\"en->it\", \"Remove\", [\"Elimina\"]);\r\n this.Persistor.set(\"en->it\", \"Paging\", [\"Paginazione\"]);\r\n this.Persistor.set(\"en->it\", \"Yes\", [\"Si\"]);\r\n this.Persistor.set(\"en->it\", \"No\", [\"No\"]);\r\n this.Persistor.set(\"en->it\", \"YES\", [\"SI'\"]);\r\n this.Persistor.set(\"en->it\", \"NO\", [\"NO\"]);\r\n this.Persistor.set(\"en->it\", \"Found objects\", [\"Risultati trovati\"]);\r\n this.Persistor.set(\"en->it\", \"Loading data...\", [\"Carico i dati...\"]);\r\n this.Persistor.set(\"en->it\", \"Error during save operations\", [\"Errori durante il salvataggio\"]);\r\n this.Persistor.set(\"en->it\", \"Error\", [\"Errore\"]);\r\n this.Persistor.set(\"en->it\", \"Warning\", [\"Avviso\"]);\r\n this.Persistor.set(\"en->it\", \"Information\", [\"Informazione\"]);\r\n this.Persistor.set(\"en->it\", \"Save\", [\"Salva\"]);\r\n this.Persistor.set(\"en->it\", \"Back\", [\"Indietro\"]);\r\n this.Persistor.set(\"en->it\", \"From\", [\"Da\"]);\r\n this.Persistor.set(\"en->it\", \"To\", [\"A\"]);\r\n this.Persistor.set(\"en->it\", \"View Chart\", [\"Vedi Grafico\"]);\r\n this.Persistor.set(\"en->it\", \"View Table\", [\"Vedi Tabella\"]);\r\n this.Persistor.set(\"en->it\", \"Notes\", [\"Note\"]);\r\n this.Persistor.set(\"en->it\", \"Edit Notes\", [\"Modifica Note\"]);\r\n this.Persistor.set(\"en->it\", \"Cancel\", [\"Annulla\"]);\r\n this.Persistor.set(\"en->it\", \"Confirm\", [\"Conferma\"]);\r\n this.Persistor.set(\"en->it\", \"View\", [\"Visualizza\"]);\r\n this.Persistor.set(\"en->it\", \"Close\", [\"Chiudi\"]);\r\n this.Persistor.set(\"en->it\", \"Select\", [\"Seleziona\"]);\r\n this.Persistor.set(\"en->it\", \"Meter Reading registered successfully\", [\"Lettura registrata correttamente\"]);\r\n this.Persistor.set(\"en->it\", \"Validation errors during save operations\", [\"Errori di validazione durante il salvataggio\"]);\r\n this.Persistor.set(\"en->it\", \"Can't register reading\", [\"Impossibile registrare la lettura\"]);\r\n this.Persistor.set(\"en->it\", \"Electricity\", [\"Elettricita\"]);\r\n this.Persistor.set(\"en->it\", \"Gas\", [\"Gas\"]);\r\n this.Persistor.set(\"en->it\", \"Water\", [\"Acqua\"]);\r\n this.Persistor.set(\"en->it\", \"Delete\", [\"Elimina\"]);\r\n this.Persistor.set(\"en->it\", \"This operation cannot be reverted\", [\"Questa operazione non puo' essere annullata\"]);\r\n this.Persistor.set(\"en->it\", \"Hide\", [\"Nascondi\"]);\r\n\r\n // Helper validazione\r\n this.Persistor.set(\"en->it\", \"Required field\", [\"Campo richiesto\"]);\r\n this.Persistor.set(\"en->it\", \"Wrong field format\", [\"Formato campo errato\"]);\r\n this.Persistor.set(\"en->it\", \"Wrong field format or field missing\", [\"Formato campo errato o campo mancante\"]);\r\n this.Persistor.set(\"en->it\", \"You don't have the required permissions to view this page. The navigation has been blocked\", [\"Non si hanno privilegi a sufficienza per accedere a questa pagina. La navigazione e' stata bloccata\"]);\r\n\r\n // Informazioni sulle date\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDateMonthPosition, \"0\", [\"1\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDisplayDateMonthPosition, \"1\", [\"1\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getLocale, \"en-US\", [\"it-IT\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getSmallDateFormat, \"MM/DD/YYYY\", [\"DD/MM/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDefaultDateFormat, \"MM/DD/YYYY\", [\"MM/DD/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getSmallDateDisplayFormat, \"DD/MM/YYYY\", [\"DD/MM/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateFormat, \"MM/DD/YYYY HH:mm:ss\", [\"DD/MM/YYYY HH:mm:ss\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateDisplayFormat, \"DD/MM/YYYY HH:mm:ss\", [\"DD/MM/YYYY HH:mm:ss\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateFormatNoSeconds, \"MM/DD/YYYY HH:mm\", [\"DD/MM/YYYY HH:mm\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateDisplayFormatNoSeconds, \"DD/MM/YYYY HH:mm\", [\"DD/MM/YYYY HH:mm\"]);\r\n }\r\n}","// Angular\r\nimport { Pipe, PipeTransform, Optional } from \"@angular/core\";\r\n\r\n// Configurazioni\r\nimport { DateService } from '@esfaenza/extensions';\r\n\r\n/**\r\n * Pipe che permette di formattare una data in base al formato specificato. Utilizza il **DateService** di **@esfaenza/extensions** per ricondurre l'input a una data valida\r\n */\r\n@Pipe({ name: \"loc_date\", pure: true })\r\nexport class LocDatePipe implements PipeTransform {\r\n\r\n /**\r\n * @ignore\r\n */\r\n constructor(@Optional() private dts: DateService) { }\r\n\r\n /**\r\n * Trasformazione della data in input in base al formato richiesto\r\n * \r\n * @param {any} value Valore da ricondurre ad una data e formattare\r\n * @param {string} format Formato in output della data da visualizzare\r\n * \r\n * @returns {string} Data formattata in base al formato\r\n */\r\n transform(value: any, format: string = \"DD/MM/YYYY\"): string {\r\n if (value == null || value === \"\") return null;\r\n\r\n if(!this.dts)\r\n {\r\n console.error(\"Tentativo di usare loc_date senza DateService. È possibile importare DateService installando e configurando il pacchetto @esfaenza/extensions\")\r\n return null;\r\n }\r\n var detatchedValue = JSON.parse(JSON.stringify(value));\r\n var dt = this.dts.getDateConvertion(detatchedValue);\r\n return dt.format(format);\r\n }\r\n}","\r\n/** \r\n * Enum che rappresenta le policy di comportamento qualore il sistema di localizzazione non trovi la localizzazione cercata, \r\n * usare **ThrowException** solo se ci si sente infallibili o si vuole debuggare in maniera approfondita l'applicazione \r\n */\r\nexport enum LocalizationMissingPolicy {\r\n PrintEmpty,\r\n PrintSource,\r\n ThrowException\r\n}\r\n","import { Injectable, Injector } from '@angular/core';\r\nimport { BaseLocalization } from './core/localization.base';\r\nimport { ItemLocalization } from './models/ItemLocalization';\r\nimport { LocalizationPersistor } from './core/localization.persistor';\r\nimport { LocalePersistor } from './locale-persistor/LocalePersistor';\r\nimport { LOC_MISSING_POLICY } from './tokens';\r\nimport { LocalizationMissingPolicy } from './models/LocalizationMissingPolicy';\r\n\r\n/**\r\n * Classe di localizzazione estendibile che permette di specificare le proprie localizzazioni e comunque rendere disponibili le localizzazioni globali\r\n */\r\n@Injectable()\r\nexport class LocalizationService {\r\n\r\n /**\r\n * Cache di tutte le localizzazioni disonibili all'interno di questa classe\r\n */\r\n private TranslationCache: { [id: string]: ItemLocalization } = {};\r\n\r\n public Locale: string;\r\n\r\n private baseLocalization: BaseLocalization;\r\n private onMissing: LocalizationMissingPolicy\r\n private Persistor: LocalizationPersistor;\r\n private LocalePersistor: LocalePersistor;\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} Locale Locale da utilizzare nel momento che questo servizio richiede le traduzioni\r\n * @param {baseLocalization} baseLocalization Classe base di localizzazione già fornita a livello di root dalla libreria stessa. \r\n * È sufficiente iniettarla nell'eventuale costruttore che estende questa classe e passarla as-is\r\n */\r\n constructor(private injector: Injector) {\r\n this.LocalePersistor = this.injector.get(LocalePersistor);\r\n this.baseLocalization = this.injector.get(BaseLocalization);\r\n this.onMissing = this.injector.get(LOC_MISSING_POLICY);\r\n \r\n this.Persistor = new LocalizationPersistor(this.TranslationCache);\r\n\r\n this.baseLocalization.Locale.subscribe(lr => {\r\n this.Locale = lr\r\n });\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di un token all'interno della **TranslationCache**\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} token Nome del token\r\n * @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n protected setToken(direction: string, token: string, left: string, right: string[]) {\r\n this.Persistor.setToken(direction, token, left, right);\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di una frase all'interno della **TranslationCache**\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n protected set(direction: string, left: string, right: string[]) {\r\n // Controlla di non reinserire la stessa localizzazione presente nel BaseLocalization\r\n // i controlli per il non reinserimento della stessa localizzazione all'interno della stessa istanza è fatto lato Persistor\r\n if (this.baseLocalization.Persistor.get(left, false)) {\r\n console.warn(`La localizzazione per ${left} è già presente fra le localizzazioni base, ignoro l'operazione`);\r\n return;\r\n }\r\n this.Persistor.set(direction, left, right);\r\n }\r\n\r\n /**\r\n * Localizza un token\r\n * \r\n * @param {string} text Il token da localizzare\r\n * \r\n * @returns {string} Token localizzato\r\n */\r\n public token(text: string): string {\r\n return this.loc(text, true);\r\n }\r\n\r\n /**\r\n * Localizza una frase\r\n * \r\n * @param {string} text Frase da localizzare\r\n * @param {boolean} allowtokens Indica se la frase **text** potrebbe essere un token o no\r\n * \r\n * @returns {string} Frase localizzata\r\n */\r\n public loc(text: string, allowtokens?: boolean): string {\r\n if (!this.Locale)\r\n throw \"Il sistema di localizzazione non ha ancora caricato il Locale, assicurarsi di caricare l'APP solo al retrieve del locale'\";\r\n\r\n if (!text || text == \"undefined\")\r\n return \"\";\r\n\r\n // Prendo la localizzazione o dalla cache attuale o dalla cache del servizio base\r\n var item = this.Persistor.get(text, allowtokens) || this.baseLocalization.Persistor.get(text, allowtokens);\r\n if (!item) {\r\n let message = `Impossibile trovare la localizzazione per '${text}'`;\r\n switch (this.onMissing) {\r\n case LocalizationMissingPolicy.PrintEmpty:\r\n console.error(message);\r\n return \"\";\r\n case LocalizationMissingPolicy.PrintSource:\r\n console.warn(message);\r\n return text;\r\n case LocalizationMissingPolicy.ThrowException:\r\n throw message;\r\n }\r\n }\r\n\r\n var loc = this.Persistor.translationByCulture(item, this.Locale);\r\n if (!loc) {\r\n console.error(\"Impossibile trovare la localizzazione per '\" + text + \"', culture \" + this.Locale);\r\n return \"\";\r\n }\r\n\r\n return loc.translation;\r\n }\r\n\r\n public async changeLocale(newLocale: string) {\r\n let locale = await this.LocalePersistor.recover().toPromise();\r\n if (newLocale == locale) {\r\n console.info(\"Il locale richiesto è lo stesso del locale attuale. Ignoro l'operazione\");\r\n return;\r\n }\r\n else {\r\n await this.LocalePersistor.persist(newLocale).toPromise();\r\n location.reload();\r\n }\r\n }\r\n}","// Angular\r\nimport { Pipe, PipeTransform } from \"@angular/core\";\r\nimport { LocalizationService } from '../localizations.service';\r\n\r\n/**\r\n * Pipe di localizzazione per tradurre direttamente da template\r\n */\r\n@Pipe({ name: \"localize\", pure: true })\r\nexport class LocalizePipe implements PipeTransform {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {LocalizationService} translationContainer Container delle traduzioni disponibili nel contesto in cui viene usata la pipe.\r\n * \r\n * Viene iniettata dal provider dichiarato nel singolo componente che utilizza la traduzione e, se non esiste, viene iniettato dal default\r\n */\r\n constructor(private translationContainer: LocalizationService) { }\r\n\r\n /**\r\n * Trasformazione della stringa in input ad una stringa tradotta\r\n * \r\n * @param {string} value Testo da tradurre\r\n * @param {LocalizationService} locContainerOverride Override al contenitore della traduzione iniettato dal costruttore, qualora serva\r\n * \r\n * @returns {string} Frase tradotta\r\n */\r\n transform(value: string, locContainerOverride?: LocalizationService): string {\r\n if (value == null || value === \"\") return \"\";\r\n\r\n return (locContainerOverride || this.translationContainer).loc(value);\r\n }\r\n}","// Angular\r\nimport { Injectable } from \"@angular/core\";\r\n\r\n// RXJS\r\nimport { Observable, of } from \"rxjs\";\r\nimport { first } from \"rxjs/operators\";\r\nimport { LocalePersistor } from \"./LocalePersistor\";\r\n\r\n@Injectable()\r\nexport class LocalStorageLocalePersistor extends LocalePersistor {\r\n\r\n /** @ignore Vedi classe base */\r\n public persist(locale: string): Observable<boolean> {\r\n localStorage.setItem(this.LOCALE, locale);\r\n return of(true).pipe(first());\r\n }\r\n\r\n /** @ignore Vedi classe base */\r\n public recover(): Observable<string> {\r\n var ret = localStorage.getItem(this.LOCALE);\r\n return of(ret).pipe(first());\r\n }\r\n}","// Angular\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\n\r\n// Pipe\r\nimport { LocDatePipe } from './pipes/loc_date.pipe';\r\nimport { LocalizePipe } from './pipes/localize.pipe';\r\n\r\n// Servizi\r\nimport { LocalizationService } from './localizations.service';\r\nimport { BaseLocalization } from './core/localization.base';\r\nimport { LocalePersistor } from './locale-persistor/LocalePersistor';\r\nimport { LocalStorageLocalePersistor } from './locale-persistor/LocalStorageCachePersistor';\r\n\r\n// Modelli\r\nimport { LocalizationModuleConfig } from './models/LocalizationModuleConfig';\r\nimport { LocalizationMissingPolicy } from './models/LocalizationMissingPolicy';\r\nimport { LOC_LOCALE, LOC_MISSING_POLICY } from './tokens';\r\n\r\n@NgModule({\r\n declarations: [LocalizePipe, LocDatePipe],\r\n exports: [LocalizePipe, LocDatePipe]\r\n})\r\nexport class LocalizationModule {\r\n static forRoot(config?: LocalizationModuleConfig): ModuleWithProviders<LocalizationModule> {\r\n return {\r\n ngModule: LocalizationModule,\r\n providers: [\r\n LocalizationService,\r\n BaseLocalization,\r\n { provide: LOC_LOCALE, useValue: config?.defaultLocale || 'it-IT' },\r\n { provide: LOC_MISSING_POLICY, useValue: config?.localizationMissingPolicy || LocalizationMissingPolicy.PrintEmpty},\r\n { provide: LocalePersistor, useClass: config?.localePersistor || LocalStorageLocalePersistor },\r\n ]\r\n };\r\n }\r\n}","import { Type } from \"@angular/core\";\r\nimport { LocalePersistor } from \"../locale-persistor/LocalePersistor\";\r\nimport { LocalizationMissingPolicy } from \"./LocalizationMissingPolicy\";\r\n\r\n/**\r\n * Classe di configurazione per il modulo di localizzazione\r\n */\r\nexport class LocalizationModuleConfig {\r\n\r\n /** Locale di default utilizzato per richiedere le traduzioni */\r\n defaultLocale: string;\r\n\r\n /**\r\n * Classe che si deve occupare dello store \"Definitivo\" delle info sul locale utilizzato. Di default viene proposto uno store lato localStorage ma si può facilmente \r\n * fornire uno storage che porta le informazioni lato Database in modo da avere la stessa lingua fino a che non viene cambiata (Es. Preference storage)\r\n */\r\n localePersistor?: Type<LocalePersistor>;\r\n\r\n /** Policy di cosa fare in caso il sistema non riesca a trovare una delle traduzioni */\r\n localizationMissingPolicy?: LocalizationMissingPolicy\r\n}","/*\r\n * Public API Surface of localizations\r\n */\r\n\r\nexport * from './lib/core/localization.base';\r\nexport * from './lib/localizations.module';\r\nexport * from './lib/localizations.service';\r\nexport * from './lib/pipes/localize.pipe';\r\nexport * from './lib/pipes/loc_date.pipe';\r\nexport * from './lib/tokens';\r\nexport * from './lib/models/LocalizationModuleConfig';\r\nexport * from './lib/models/BaseLocalizationTokens';\r\nexport * from './lib/models/LocalizationMissingPolicy';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.LocalizationService"],"mappings":";;;;;;;AAEA;;AAEG;MACU,gBAAgB,CAAA;AAE3B;;;;;;AAMG;AACH,IAAA,WAAA,CAAmB,KAAc,EAAS,QAAgB,EAAS,YAAuC,EAAA;AAAvF,QAAA,IAAK,CAAA,KAAA,GAAL,KAAK,CAAS;AAAS,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;AAAS,QAAA,IAAY,CAAA,YAAA,GAAZ,YAAY,CAA2B;KAAI;AAC/G;;ACdD;;AAEG;MACU,YAAY,CAAA;AAErB;;;;;;AAMG;AACH,IAAA,WAAA,CAAmB,EAAU,EAAS,WAAmB,EAAS,OAAiB,EAAA;AAAhE,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAQ;AAAS,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;AAAS,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAU;KAAK;AAC3F;;ACZD;AACA;AAEA;;AAEG;MACU,iBAAiB,CAAA;AAE1B;;;;AAIG;AACH,IAAA,WAAA,GAAA,GAAiB;AAUjB;;;;;;AAMG;IACI,OAAO,UAAU,CAAC,KAAa,EAAA;QAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;KAC7E;;AAjBD;;AAEG;AACW,iBAAA,CAAA,gBAAgB,GAAmB;IAC7C,IA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AA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;AACzC,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;iBACrC,CAAA;;;ACjBD;;AAEG;MACU,wBAAwB,CAAA;AAapC;;ACpBD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"esfaenza-localizations.mjs","sources":["../../../projects/localizations/src/lib/models/ItemLocalization.ts","../../../projects/localizations/src/lib/models/LocaleObject.ts","../../../projects/localizations/src/lib/models/LocaleDefinitions.ts","../../../projects/localizations/src/lib/models/SpecializedLocalization.ts","../../../projects/localizations/src/lib/core/localization.persistor.ts","../../../projects/localizations/src/lib/models/BaseLocalizationTokens.ts","../../../projects/localizations/src/lib/tokens.ts","../../../projects/localizations/src/lib/locale-persistor/LocalePersistor.ts","../../../projects/localizations/src/lib/core/localization.base.ts","../../../projects/localizations/src/lib/models/LocalizationMissingPolicy.ts","../../../projects/localizations/src/lib/localizations.service.ts","../../../projects/localizations/src/lib/pipes/localize.pipe.ts","../../../projects/localizations/src/lib/locale-persistor/LocalStorageCachePersistor.ts","../../../projects/localizations/src/lib/localizations.module.ts","../../../projects/localizations/src/lib/models/LocalizationModuleConfig.ts","../../../projects/localizations/src/public-api.ts","../../../projects/localizations/src/esfaenza-localizations.ts"],"sourcesContent":["import { SpecializedLocalization } from \"./SpecializedLocalization\";\r\n\r\n/**\r\n * Contenitore delle localizzazioni collegate ad un testo \"base\", una per ogni linguaggio supportato\r\n */\r\nexport class ItemLocalization {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {boolean} token Indica se è un token o se è un testo\r\n * @param {string} baseText Testo base che verrà richiesto quando verrà cercata la localizzazione\r\n * @param {SpecializedLocalization[]} translations Lista di traduzioni in base al testo base\r\n */\r\n constructor(public token: boolean, public baseText: string, public translations: SpecializedLocalization[]){ }\r\n}","\r\n/**\r\n * Classe che rappresenta un locale (Es. 'Italiano') con i propri alias (Es. 'it' oppure 'it-IT')\r\n */\r\nexport class LocaleObject {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} id Codice locale\r\n * @param {string} description Descrizione locale\r\n * @param {string[]} aliases Alias con cui quel locale è conosciuto\r\n */\r\n constructor(public id: string, public description: string, public aliases: string[]) { }\r\n}\r\n","import { LocaleObject } from \"./LocaleObject\";\r\n\r\n// VVVVVVVV Tag per evitare che typescript muoia con l'errore \"Error encountered in metadata generated for exported symbol 'LocaleDefinitions'\" (https://github.com/angular/angular/issues/18867#issuecomment-357484102),\r\n// @dynamic\r\n\r\n/**\r\n * Definizione dei locali disponibili\r\n */\r\nexport class LocaleDefinitions {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor() { }\r\n\r\n /**\r\n * Lista dei locali disponibili, definiti anche con i vari alias\r\n */\r\n public static AvailableLocales: LocaleObject[] = [\r\n new LocaleObject('it-IT', 'Italiano', ['it', 'it-IT']),\r\n new LocaleObject('en-US', 'English', ['en', 'en-US'])\r\n ];\r\n\r\n /**\r\n * In base a un alias restituisce il locale rappresentato\r\n * \r\n * @param {string} alias Alias in base al quale raccogliere il Locale\r\n * \r\n * @returns {LocaleObject} Locale richiesto dall'alias\r\n */\r\n public static getByAlias(alias: string): LocaleObject {\r\n return this.AvailableLocales.find(t => !!t.aliases.find(a => a == alias));\r\n }\r\n}\r\n","/**\r\n * Classe che rappresenta la localizzazione di un test base per una certa lingua\r\n */\r\nexport class SpecializedLocalization {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} culture Culture della traduzione\r\n * @param {string} translation Traduzione nella lingua specificata dalla **culture**\r\n */\r\n constructor(public culture: string, public translation: string) { }\r\n}\r\n","import { ItemLocalization } from \"../models/ItemLocalization\";\r\nimport { LocaleDefinitions } from \"../models/LocaleDefinitions\";\r\nimport { SpecializedLocalization } from \"../models/SpecializedLocalization\";\r\n\r\nexport class LocalizationPersistor {\r\n\r\n constructor(private LocCache: { [id: string]: ItemLocalization } = null) { }\r\n\r\n /**\r\n * Imposta la localizzazione di un token all'interno della cache scelta\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} token Nome del token\r\n * @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n public setToken(direction: string, token: string, left: string, right: string[]) {\r\n let parsingRegex = /([a-zA-Z]+)[\\s]*->[\\s]*([a-zA-Z,\\s]+)+/g;\r\n var parsingRes = parsingRegex.exec(direction);\r\n\r\n let from = parsingRes[1];\r\n let to: string[] = parsingRes[2].replace(/\\s/g, '').split(',');\r\n let localeFrom = LocaleDefinitions.getByAlias(from);\r\n this._set(token, localeFrom.id, left, true);\r\n\r\n to.forEach((t, index) => {\r\n let localeTo = LocaleDefinitions.getByAlias(t);\r\n this._set(token, localeTo.id, right[index], true);\r\n });\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di una frase all'interno della cache scelta\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n public set(direction: string, left: string, right: string[]) {\r\n let parsingRegex = /([a-zA-Z]+)[\\s]*->[\\s]*([a-zA-Z,\\s]+)+/g;\r\n var parsingRes = parsingRegex.exec(direction);\r\n\r\n let from = parsingRes[1];\r\n let to: string[] = parsingRes[2].replace(/\\s/g, '').split(',');\r\n let localeFrom = LocaleDefinitions.getByAlias(from);\r\n this._set(left, localeFrom.id, left);\r\n\r\n to.forEach((t, index) => {\r\n let localeTo = LocaleDefinitions.getByAlias(t);\r\n this._set(left, localeTo.id, right[index]);\r\n });\r\n }\r\n\r\n /**\r\n * Imposta all'interno della cache specificata un'unica traduzione partendo da un testo di base\r\n * \r\n * @param {string} text Testo da tradurre\r\n * @param {string} culture Lingua per cui inserire la traduzione\r\n * @param {string} translation Traduzione del **text** nella lingua specificata da **culture**\r\n * @param {boolean} token Indica se il **text** è un token o è una frase normale\r\n */\r\n private _set(text: string, culture: string, translation: string, token?: boolean) {\r\n let item = this.get(text, token);\r\n if (!item) {\r\n this.LocCache[text] = new ItemLocalization(token, text, [new SpecializedLocalization(culture, translation)]);\r\n return;\r\n }\r\n\r\n var trs = this.translationByCulture(item, culture);\r\n if (trs) {\r\n console.warn(\"Localization already loaded for sentence '\" + text + \"' and culture \" + culture);\r\n return;\r\n }\r\n\r\n item.translations.push(new SpecializedLocalization(culture, translation));\r\n }\r\n\r\n /**\r\n * Partendo da una cache di localizzazione, dato un testo che può essere o meno un token, cerca quell'elemento all'interno della cache\r\n * \r\n * @param {string} text Testo da cercare nella **LocCache**\r\n * @param {boolean} allowtokens Indica se l'elemento cercato può essere un token o se dev'essere per forza una frase (per evitare rari \r\n * casi di collisione in cui magari un token è uguale a una frase tradotta)\r\n * \r\n * @returns {ItemLocalization} Informazioni di localizzazione per il **text** cercato\r\n */\r\n public get(text: string, allowtokens: boolean): ItemLocalization {\r\n let possibleItem: ItemLocalization = this.LocCache[text];\r\n var item = possibleItem && (allowtokens || !possibleItem.token) ? possibleItem : null;\r\n return item;\r\n }\r\n\r\n /**\r\n * Date le informazioni di localizzazione per un testo cerca e restituisce la traduzione per una lingua specifica\r\n * \r\n * @param {ItemLocalization} Informazioni di localizzazione\r\n * @param {string} culture Lingua della traduzione richiesta\r\n * \r\n * @returns {SpecializedLocalization} Informazioni di localizzazione specifiche della lingua richiesta\r\n */\r\n public translationByCulture(item: ItemLocalization, culture: string): SpecializedLocalization {\r\n for (let i = 0; i < item.translations.length; i++) {\r\n let trl = item.translations[i];\r\n if (trl.culture == culture)\r\n return trl;\r\n }\r\n\r\n return null;\r\n }\r\n}","\r\nexport enum BaseLocalizationTokens {\r\n getDateMonthPosition = \"getDateMonthPosition\",\r\n getDisplayDateMonthPosition = \"getDisplayDateMonthPosition\",\r\n getLocale = \"getLocale\",\r\n getSmallDateFormat = \"getSmallDateFormat\",\r\n getDefaultDateFormat = \"getDefaultDateFormat\",\r\n getSmallDateDisplayFormat = \"getSmallDateDisplayFormat\",\r\n getFullDateFormat = \"getFullDateFormat\",\r\n getFullDateDisplayFormat = \"getFullDateDisplayFormat\",\r\n getFullDateFormatNoSeconds = \"getFullDateFormatNoSeconds\",\r\n getFullDateDisplayFormatNoSeconds = \"getFullDateDisplayFormatNoSeconds\"\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { LocalizationMissingPolicy } from \"./models/LocalizationMissingPolicy\"\r\n\r\n/** Locale da utilizzare per le traduzioni */\r\nexport const LOC_LOCALE: InjectionToken<string> = new InjectionToken<string>('LOC_LOCALE');\r\n\r\n/** Policy da utilizzare per traduzioni mancanti */\r\nexport const LOC_MISSING_POLICY: InjectionToken<LocalizationMissingPolicy> = new InjectionToken<LocalizationMissingPolicy>('LOC_MISSING_POLICY');","import { Observable } from \"rxjs\";\r\n\r\n/** Classe astratta che rappresenta lo stato di persistenza fra la libreria e uno storage */\r\nexport abstract class LocalePersistor {\r\n\r\n /** Chiave su cui salvare il locale */\r\n protected LOCALE: string = \"LOCALE\";\r\n\r\n /**\r\n * Salva il Locale\r\n * \r\n * @param {string} locale Locale da salvare\r\n */\r\n public abstract persist(locale: string): Observable<boolean>;\r\n\r\n /**\r\n * Recupera il Locale\r\n * \r\n * @returns {Observable<string>} Valore salvato per il locale\r\n */\r\n public abstract recover(): Observable<string>;\r\n}","import { Inject, Injectable } from \"@angular/core\";\r\nimport { ItemLocalization } from \"../models/ItemLocalization\";\r\nimport { LocalizationPersistor } from \"./localization.persistor\";\r\nimport { BaseLocalizationTokens } from \"../models/BaseLocalizationTokens\";\r\nimport { LocalePersistor } from \"../locale-persistor/LocalePersistor\";\r\nimport { take } from \"rxjs/operators\";\r\nimport { ReplaySubject } from \"rxjs\";\r\nimport { LOC_LOCALE } from \"../tokens\";\r\n\r\n/**\r\n * Classe singleton che contiene le traduzioni di base (per evitare di ripeterle in oggi classe di traduzione) e le funzioni base per \r\n * inserire e leggere traduzioni in/da una cache\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class BaseLocalization {\r\n\r\n /**\r\n * Cache di tutte le localizzazioni di base\r\n */\r\n public LocCache: { [id: string]: ItemLocalization } = {};\r\n\r\n /**\r\n * Persistor delle localizzazioni relativo a questa classe\r\n */\r\n public Persistor: LocalizationPersistor;\r\n\r\n /**\r\n * Locale di riferimento per tutte le traduzioni\r\n */\r\n public Locale: ReplaySubject<string> = new ReplaySubject<string>(1);\r\n\r\n /**\r\n * Costruttore. Da qui utilizzando il metodo statico **BaseLocalization.set** si va a popolare la cache delle traduzioni **BaseTranslations**\r\n */\r\n constructor(public LocalePersistor: LocalePersistor, @Inject(LOC_LOCALE) defaultLocale: string) {\r\n\r\n // Recupero il locale alla partenza del BaseLocalization in modo, spero di dare tempo all'applicazione di tirarlo su\r\n this.LocalePersistor.recover().pipe(take(1)).subscribe(async l => {\r\n if (!l) {\r\n l = defaultLocale;\r\n this.LocalePersistor.persist(defaultLocale);\r\n }\r\n this.Locale.next(l)\r\n });\r\n\r\n this.Persistor = new LocalizationPersistor(this.LocCache); \r\n\r\n this.Persistor.set(\"en->it\", \"Remove\", [\"Elimina\"]);\r\n this.Persistor.set(\"en->it\", \"Paging\", [\"Paginazione\"]);\r\n this.Persistor.set(\"en->it\", \"Yes\", [\"Si\"]);\r\n this.Persistor.set(\"en->it\", \"No\", [\"No\"]);\r\n this.Persistor.set(\"en->it\", \"YES\", [\"SI'\"]);\r\n this.Persistor.set(\"en->it\", \"NO\", [\"NO\"]);\r\n this.Persistor.set(\"en->it\", \"Found objects\", [\"Risultati trovati\"]);\r\n this.Persistor.set(\"en->it\", \"Loading data...\", [\"Carico i dati...\"]);\r\n this.Persistor.set(\"en->it\", \"Error during save operations\", [\"Errori durante il salvataggio\"]);\r\n this.Persistor.set(\"en->it\", \"Error\", [\"Errore\"]);\r\n this.Persistor.set(\"en->it\", \"Warning\", [\"Avviso\"]);\r\n this.Persistor.set(\"en->it\", \"Information\", [\"Informazione\"]);\r\n this.Persistor.set(\"en->it\", \"Save\", [\"Salva\"]);\r\n this.Persistor.set(\"en->it\", \"Back\", [\"Indietro\"]);\r\n this.Persistor.set(\"en->it\", \"From\", [\"Da\"]);\r\n this.Persistor.set(\"en->it\", \"To\", [\"A\"]);\r\n this.Persistor.set(\"en->it\", \"View Chart\", [\"Vedi Grafico\"]);\r\n this.Persistor.set(\"en->it\", \"View Table\", [\"Vedi Tabella\"]);\r\n this.Persistor.set(\"en->it\", \"Notes\", [\"Note\"]);\r\n this.Persistor.set(\"en->it\", \"Edit Notes\", [\"Modifica Note\"]);\r\n this.Persistor.set(\"en->it\", \"Cancel\", [\"Annulla\"]);\r\n this.Persistor.set(\"en->it\", \"Confirm\", [\"Conferma\"]);\r\n this.Persistor.set(\"en->it\", \"View\", [\"Visualizza\"]);\r\n this.Persistor.set(\"en->it\", \"Close\", [\"Chiudi\"]);\r\n this.Persistor.set(\"en->it\", \"Select\", [\"Seleziona\"]);\r\n this.Persistor.set(\"en->it\", \"Meter Reading registered successfully\", [\"Lettura registrata correttamente\"]);\r\n this.Persistor.set(\"en->it\", \"Validation errors during save operations\", [\"Errori di validazione durante il salvataggio\"]);\r\n this.Persistor.set(\"en->it\", \"Can't register reading\", [\"Impossibile registrare la lettura\"]);\r\n this.Persistor.set(\"en->it\", \"Electricity\", [\"Elettricita\"]);\r\n this.Persistor.set(\"en->it\", \"Gas\", [\"Gas\"]);\r\n this.Persistor.set(\"en->it\", \"Water\", [\"Acqua\"]);\r\n this.Persistor.set(\"en->it\", \"Delete\", [\"Elimina\"]);\r\n this.Persistor.set(\"en->it\", \"This operation cannot be reverted\", [\"Questa operazione non puo' essere annullata\"]);\r\n this.Persistor.set(\"en->it\", \"Hide\", [\"Nascondi\"]);\r\n\r\n // Helper validazione\r\n this.Persistor.set(\"en->it\", \"Required field\", [\"Campo richiesto\"]);\r\n this.Persistor.set(\"en->it\", \"Wrong field format\", [\"Formato campo errato\"]);\r\n this.Persistor.set(\"en->it\", \"Wrong field format or field missing\", [\"Formato campo errato o campo mancante\"]);\r\n this.Persistor.set(\"en->it\", \"You don't have the required permissions to view this page. The navigation has been blocked\", [\"Non si hanno privilegi a sufficienza per accedere a questa pagina. La navigazione e' stata bloccata\"]);\r\n\r\n // Informazioni sulle date\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDateMonthPosition, \"0\", [\"1\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDisplayDateMonthPosition, \"1\", [\"1\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getLocale, \"en-US\", [\"it-IT\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getSmallDateFormat, \"MM/DD/YYYY\", [\"DD/MM/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDefaultDateFormat, \"MM/DD/YYYY\", [\"MM/DD/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getSmallDateDisplayFormat, \"DD/MM/YYYY\", [\"DD/MM/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateFormat, \"MM/DD/YYYY HH:mm:ss\", [\"DD/MM/YYYY HH:mm:ss\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateDisplayFormat, \"DD/MM/YYYY HH:mm:ss\", [\"DD/MM/YYYY HH:mm:ss\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateFormatNoSeconds, \"MM/DD/YYYY HH:mm\", [\"DD/MM/YYYY HH:mm\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateDisplayFormatNoSeconds, \"DD/MM/YYYY HH:mm\", [\"DD/MM/YYYY HH:mm\"]);\r\n }\r\n}","\r\n/** \r\n * Enum che rappresenta le policy di comportamento qualore il sistema di localizzazione non trovi la localizzazione cercata, \r\n * usare **ThrowException** solo se ci si sente infallibili o si vuole debuggare in maniera approfondita l'applicazione \r\n */\r\nexport enum LocalizationMissingPolicy {\r\n PrintEmpty,\r\n PrintSource,\r\n ThrowException\r\n}\r\n","import { Injectable, Injector } from '@angular/core';\r\nimport { BaseLocalization } from './core/localization.base';\r\nimport { ItemLocalization } from './models/ItemLocalization';\r\nimport { LocalizationPersistor } from './core/localization.persistor';\r\nimport { LocalePersistor } from './locale-persistor/LocalePersistor';\r\nimport { LOC_MISSING_POLICY } from './tokens';\r\nimport { LocalizationMissingPolicy } from './models/LocalizationMissingPolicy';\r\n\r\n/**\r\n * Classe di localizzazione estendibile che permette di specificare le proprie localizzazioni e comunque rendere disponibili le localizzazioni globali\r\n */\r\n@Injectable()\r\nexport class LocalizationService {\r\n\r\n /**\r\n * Cache di tutte le localizzazioni disonibili all'interno di questa classe\r\n */\r\n private TranslationCache: { [id: string]: ItemLocalization } = {};\r\n\r\n public Locale: string;\r\n\r\n private baseLocalization: BaseLocalization;\r\n private onMissing: LocalizationMissingPolicy\r\n private Persistor: LocalizationPersistor;\r\n private LocalePersistor: LocalePersistor;\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} Locale Locale da utilizzare nel momento che questo servizio richiede le traduzioni\r\n * @param {baseLocalization} baseLocalization Classe base di localizzazione già fornita a livello di root dalla libreria stessa. \r\n * È sufficiente iniettarla nell'eventuale costruttore che estende questa classe e passarla as-is\r\n */\r\n constructor(private injector: Injector) {\r\n this.LocalePersistor = this.injector.get(LocalePersistor);\r\n this.baseLocalization = this.injector.get(BaseLocalization);\r\n this.onMissing = this.injector.get(LOC_MISSING_POLICY);\r\n \r\n this.Persistor = new LocalizationPersistor(this.TranslationCache);\r\n\r\n this.baseLocalization.Locale.subscribe(lr => {\r\n this.Locale = lr\r\n });\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di un token all'interno della **TranslationCache**\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} token Nome del token\r\n * @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n protected setToken(direction: string, token: string, left: string, right: string[]) {\r\n this.Persistor.setToken(direction, token, left, right);\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di una frase all'interno della **TranslationCache**\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n protected set(direction: string, left: string, right: string[]) {\r\n // Controlla di non reinserire la stessa localizzazione presente nel BaseLocalization\r\n // i controlli per il non reinserimento della stessa localizzazione all'interno della stessa istanza è fatto lato Persistor\r\n if (this.baseLocalization.Persistor.get(left, false)) {\r\n console.warn(`La localizzazione per ${left} è già presente fra le localizzazioni base, ignoro l'operazione`);\r\n return;\r\n }\r\n this.Persistor.set(direction, left, right);\r\n }\r\n\r\n /**\r\n * Localizza un token\r\n * \r\n * @param {string} text Il token da localizzare\r\n * \r\n * @returns {string} Token localizzato\r\n */\r\n public token(text: string): string {\r\n return this.loc(text, true);\r\n }\r\n\r\n /**\r\n * Localizza una frase\r\n * \r\n * @param {string} text Frase da localizzare\r\n * @param {boolean} allowtokens Indica se la frase **text** potrebbe essere un token o no\r\n * \r\n * @returns {string} Frase localizzata\r\n */\r\n public loc(text: string, allowtokens?: boolean): string {\r\n if (!this.Locale)\r\n throw \"Il sistema di localizzazione non ha ancora caricato il Locale, assicurarsi di caricare l'APP solo al retrieve del locale'\";\r\n\r\n if (!text || text == \"undefined\")\r\n return \"\";\r\n\r\n // Prendo la localizzazione o dalla cache attuale o dalla cache del servizio base\r\n var item = this.Persistor.get(text, allowtokens) || this.baseLocalization.Persistor.get(text, allowtokens);\r\n if (!item) {\r\n let message = `Impossibile trovare la localizzazione per '${text}'`;\r\n switch (this.onMissing) {\r\n case LocalizationMissingPolicy.PrintEmpty:\r\n console.error(message);\r\n return \"\";\r\n case LocalizationMissingPolicy.PrintSource:\r\n console.warn(message);\r\n return text;\r\n case LocalizationMissingPolicy.ThrowException:\r\n throw message;\r\n }\r\n }\r\n\r\n var loc = this.Persistor.translationByCulture(item, this.Locale);\r\n if (!loc) {\r\n console.error(\"Impossibile trovare la localizzazione per '\" + text + \"', culture \" + this.Locale);\r\n return \"\";\r\n }\r\n\r\n return loc.translation;\r\n }\r\n\r\n public async changeLocale(newLocale: string) {\r\n let locale = await this.LocalePersistor.recover().toPromise();\r\n if (newLocale == locale) {\r\n console.info(\"Il locale richiesto è lo stesso del locale attuale. Ignoro l'operazione\");\r\n return;\r\n }\r\n else {\r\n await this.LocalePersistor.persist(newLocale).toPromise();\r\n location.reload();\r\n }\r\n }\r\n}","// Angular\r\nimport { Pipe, PipeTransform } from \"@angular/core\";\r\nimport { LocalizationService } from '../localizations.service';\r\n\r\n/**\r\n * Pipe di localizzazione per tradurre direttamente da template\r\n */\r\n@Pipe({ name: \"localize\", pure: true })\r\nexport class LocalizePipe implements PipeTransform {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {LocalizationService} translationContainer Container delle traduzioni disponibili nel contesto in cui viene usata la pipe.\r\n * \r\n * Viene iniettata dal provider dichiarato nel singolo componente che utilizza la traduzione e, se non esiste, viene iniettato dal default\r\n */\r\n constructor(private translationContainer: LocalizationService) { }\r\n\r\n /**\r\n * Trasformazione della stringa in input ad una stringa tradotta\r\n * \r\n * @param {string} value Testo da tradurre\r\n * @param {LocalizationService} locContainerOverride Override al contenitore della traduzione iniettato dal costruttore, qualora serva\r\n * \r\n * @returns {string} Frase tradotta\r\n */\r\n transform(value: string, locContainerOverride?: LocalizationService): string {\r\n if (value == null || value === \"\") return \"\";\r\n\r\n return (locContainerOverride || this.translationContainer).loc(value);\r\n }\r\n}","// Angular\r\nimport { Injectable } from \"@angular/core\";\r\n\r\n// RXJS\r\nimport { Observable, of } from \"rxjs\";\r\nimport { first } from \"rxjs/operators\";\r\nimport { LocalePersistor } from \"./LocalePersistor\";\r\n\r\n@Injectable()\r\nexport class LocalStorageLocalePersistor extends LocalePersistor {\r\n\r\n /** @ignore Vedi classe base */\r\n public persist(locale: string): Observable<boolean> {\r\n localStorage.setItem(this.LOCALE, locale);\r\n return of(true).pipe(first());\r\n }\r\n\r\n /** @ignore Vedi classe base */\r\n public recover(): Observable<string> {\r\n var ret = localStorage.getItem(this.LOCALE);\r\n return of(ret).pipe(first());\r\n }\r\n}","// Angular\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\n\r\n// Pipe\r\nimport { LocalizePipe } from './pipes/localize.pipe';\r\n\r\n// Servizi\r\nimport { LocalizationService } from './localizations.service';\r\nimport { BaseLocalization } from './core/localization.base';\r\nimport { LocalePersistor } from './locale-persistor/LocalePersistor';\r\nimport { LocalStorageLocalePersistor } from './locale-persistor/LocalStorageCachePersistor';\r\n\r\n// Modelli\r\nimport { LocalizationModuleConfig } from './models/LocalizationModuleConfig';\r\nimport { LocalizationMissingPolicy } from './models/LocalizationMissingPolicy';\r\nimport { LOC_LOCALE, LOC_MISSING_POLICY } from './tokens';\r\n\r\n@NgModule({\r\n declarations: [LocalizePipe],\r\n exports: [LocalizePipe]\r\n})\r\nexport class LocalizationModule {\r\n static forRoot(config?: LocalizationModuleConfig): ModuleWithProviders<LocalizationModule> {\r\n return {\r\n ngModule: LocalizationModule,\r\n providers: [\r\n LocalizationService,\r\n BaseLocalization,\r\n { provide: LOC_LOCALE, useValue: config?.defaultLocale || 'it-IT' },\r\n { provide: LOC_MISSING_POLICY, useValue: config?.localizationMissingPolicy || LocalizationMissingPolicy.PrintEmpty},\r\n { provide: LocalePersistor, useClass: config?.localePersistor || LocalStorageLocalePersistor },\r\n ]\r\n };\r\n }\r\n}","import { Type } from \"@angular/core\";\r\nimport { LocalePersistor } from \"../locale-persistor/LocalePersistor\";\r\nimport { LocalizationMissingPolicy } from \"./LocalizationMissingPolicy\";\r\n\r\n/**\r\n * Classe di configurazione per il modulo di localizzazione\r\n */\r\nexport class LocalizationModuleConfig {\r\n\r\n /** Locale di default utilizzato per richiedere le traduzioni */\r\n defaultLocale: string;\r\n\r\n /**\r\n * Classe che si deve occupare dello store \"Definitivo\" delle info sul locale utilizzato. Di default viene proposto uno store lato localStorage ma si può facilmente \r\n * fornire uno storage che porta le informazioni lato Database in modo da avere la stessa lingua fino a che non viene cambiata (Es. Preference storage)\r\n */\r\n localePersistor?: Type<LocalePersistor>;\r\n\r\n /** Policy di cosa fare in caso il sistema non riesca a trovare una delle traduzioni */\r\n localizationMissingPolicy?: LocalizationMissingPolicy\r\n}","/*\r\n * Public API Surface of localizations\r\n */\r\n\r\nexport * from './lib/core/localization.base';\r\nexport * from './lib/localizations.module';\r\nexport * from './lib/localizations.service';\r\nexport * from './lib/pipes/localize.pipe';\r\nexport * from './lib/tokens';\r\nexport * from './lib/models/LocalizationModuleConfig';\r\nexport * from './lib/models/BaseLocalizationTokens';\r\nexport * from './lib/models/LocalizationMissingPolicy';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.LocalizationService"],"mappings":";;;;;;AAEA;;AAEG;MACU,gBAAgB,CAAA;AAE3B;;;;;;AAMG;AACH,IAAA,WAAA,CAAmB,KAAc,EAAS,QAAgB,EAAS,YAAuC,EAAA;AAAvF,QAAA,IAAK,CAAA,KAAA,GAAL,KAAK,CAAS;AAAS,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;AAAS,QAAA,IAAY,CAAA,YAAA,GAAZ,YAAY,CAA2B;KAAI;AAC/G;;ACdD;;AAEG;MACU,YAAY,CAAA;AAErB;;;;;;AAMG;AACH,IAAA,WAAA,CAAmB,EAAU,EAAS,WAAmB,EAAS,OAAiB,EAAA;AAAhE,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAQ;AAAS,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;AAAS,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAU;KAAK;AAC3F;;ACZD;AACA;AAEA;;AAEG;MACU,iBAAiB,CAAA;AAE1B;;;;AAIG;AACH,IAAA,WAAA,GAAA,GAAiB;AAUjB;;;;;;AAMG;IACI,OAAO,UAAU,CAAC,KAAa,EAAA;QAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CA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B,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,YAAY,CAAC;oBAC5B,OAAO,EAAE,CAAC,YAAY,CAAC;iBACxB,CAAA;;;AChBD;;AAEG;MACU,wBAAwB,CAAA;AAapC;;ACpBD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, Inject, Pipe,
|
|
2
|
+
import { InjectionToken, Injectable, Inject, Pipe, NgModule } from '@angular/core';
|
|
3
3
|
import { take, first } from 'rxjs/operators';
|
|
4
4
|
import { ReplaySubject, of } from 'rxjs';
|
|
5
|
-
import * as i1 from '@esfaenza/extensions';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Contenitore delle localizzazioni collegate ad un testo "base", una per ogni linguaggio supportato
|
|
@@ -303,46 +302,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
303
302
|
args: [LOC_LOCALE]
|
|
304
303
|
}] }]; } });
|
|
305
304
|
|
|
306
|
-
// Angular
|
|
307
|
-
/**
|
|
308
|
-
* Pipe che permette di formattare una data in base al formato specificato. Utilizza il **DateService** di **@esfaenza/extensions** per ricondurre l'input a una data valida
|
|
309
|
-
*/
|
|
310
|
-
class LocDatePipe {
|
|
311
|
-
/**
|
|
312
|
-
* @ignore
|
|
313
|
-
*/
|
|
314
|
-
constructor(dts) {
|
|
315
|
-
this.dts = dts;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Trasformazione della data in input in base al formato richiesto
|
|
319
|
-
*
|
|
320
|
-
* @param {any} value Valore da ricondurre ad una data e formattare
|
|
321
|
-
* @param {string} format Formato in output della data da visualizzare
|
|
322
|
-
*
|
|
323
|
-
* @returns {string} Data formattata in base al formato
|
|
324
|
-
*/
|
|
325
|
-
transform(value, format = "DD/MM/YYYY") {
|
|
326
|
-
if (value == null || value === "")
|
|
327
|
-
return null;
|
|
328
|
-
if (!this.dts) {
|
|
329
|
-
console.error("Tentativo di usare loc_date senza DateService. È possibile importare DateService installando e configurando il pacchetto @esfaenza/extensions");
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
|
-
var detatchedValue = JSON.parse(JSON.stringify(value));
|
|
333
|
-
var dt = this.dts.getDateConvertion(detatchedValue);
|
|
334
|
-
return dt.format(format);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
LocDatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, deps: [{ token: i1.DateService, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
338
|
-
LocDatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, name: "loc_date" });
|
|
339
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, decorators: [{
|
|
340
|
-
type: Pipe,
|
|
341
|
-
args: [{ name: "loc_date", pure: true }]
|
|
342
|
-
}], ctorParameters: function () { return [{ type: i1.DateService, decorators: [{
|
|
343
|
-
type: Optional
|
|
344
|
-
}] }]; } });
|
|
345
|
-
|
|
346
305
|
/**
|
|
347
306
|
* Enum che rappresenta le policy di comportamento qualore il sistema di localizzazione non trovi la localizzazione cercata,
|
|
348
307
|
* usare **ThrowException** solo se ci si sente infallibili o si vuole debuggare in maniera approfondita l'applicazione
|
|
@@ -544,13 +503,13 @@ class LocalizationModule {
|
|
|
544
503
|
}
|
|
545
504
|
}
|
|
546
505
|
LocalizationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
547
|
-
LocalizationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, declarations: [LocalizePipe
|
|
506
|
+
LocalizationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, declarations: [LocalizePipe], exports: [LocalizePipe] });
|
|
548
507
|
LocalizationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule });
|
|
549
508
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
550
509
|
type: NgModule,
|
|
551
510
|
args: [{
|
|
552
|
-
declarations: [LocalizePipe
|
|
553
|
-
exports: [LocalizePipe
|
|
511
|
+
declarations: [LocalizePipe],
|
|
512
|
+
exports: [LocalizePipe]
|
|
554
513
|
}]
|
|
555
514
|
}] });
|
|
556
515
|
|
|
@@ -568,5 +527,5 @@ class LocalizationModuleConfig {
|
|
|
568
527
|
* Generated bundle index. Do not edit.
|
|
569
528
|
*/
|
|
570
529
|
|
|
571
|
-
export { BaseLocalization, BaseLocalizationTokens, LOC_LOCALE, LOC_MISSING_POLICY,
|
|
530
|
+
export { BaseLocalization, BaseLocalizationTokens, LOC_LOCALE, LOC_MISSING_POLICY, LocalizationMissingPolicy, LocalizationModule, LocalizationModuleConfig, LocalizationService, LocalizePipe };
|
|
572
531
|
//# sourceMappingURL=esfaenza-localizations.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esfaenza-localizations.mjs","sources":["../../../projects/localizations/src/lib/models/ItemLocalization.ts","../../../projects/localizations/src/lib/models/LocaleObject.ts","../../../projects/localizations/src/lib/models/LocaleDefinitions.ts","../../../projects/localizations/src/lib/models/SpecializedLocalization.ts","../../../projects/localizations/src/lib/core/localization.persistor.ts","../../../projects/localizations/src/lib/models/BaseLocalizationTokens.ts","../../../projects/localizations/src/lib/tokens.ts","../../../projects/localizations/src/lib/locale-persistor/LocalePersistor.ts","../../../projects/localizations/src/lib/core/localization.base.ts","../../../projects/localizations/src/lib/pipes/loc_date.pipe.ts","../../../projects/localizations/src/lib/models/LocalizationMissingPolicy.ts","../../../projects/localizations/src/lib/localizations.service.ts","../../../projects/localizations/src/lib/pipes/localize.pipe.ts","../../../projects/localizations/src/lib/locale-persistor/LocalStorageCachePersistor.ts","../../../projects/localizations/src/lib/localizations.module.ts","../../../projects/localizations/src/lib/models/LocalizationModuleConfig.ts","../../../projects/localizations/src/public-api.ts","../../../projects/localizations/src/esfaenza-localizations.ts"],"sourcesContent":["import { SpecializedLocalization } from \"./SpecializedLocalization\";\r\n\r\n/**\r\n * Contenitore delle localizzazioni collegate ad un testo \"base\", una per ogni linguaggio supportato\r\n */\r\nexport class ItemLocalization {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {boolean} token Indica se è un token o se è un testo\r\n * @param {string} baseText Testo base che verrà richiesto quando verrà cercata la localizzazione\r\n * @param {SpecializedLocalization[]} translations Lista di traduzioni in base al testo base\r\n */\r\n constructor(public token: boolean, public baseText: string, public translations: SpecializedLocalization[]){ }\r\n}","\r\n/**\r\n * Classe che rappresenta un locale (Es. 'Italiano') con i propri alias (Es. 'it' oppure 'it-IT')\r\n */\r\nexport class LocaleObject {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} id Codice locale\r\n * @param {string} description Descrizione locale\r\n * @param {string[]} aliases Alias con cui quel locale è conosciuto\r\n */\r\n constructor(public id: string, public description: string, public aliases: string[]) { }\r\n}\r\n","import { LocaleObject } from \"./LocaleObject\";\r\n\r\n// VVVVVVVV Tag per evitare che typescript muoia con l'errore \"Error encountered in metadata generated for exported symbol 'LocaleDefinitions'\" (https://github.com/angular/angular/issues/18867#issuecomment-357484102),\r\n// @dynamic\r\n\r\n/**\r\n * Definizione dei locali disponibili\r\n */\r\nexport class LocaleDefinitions {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor() { }\r\n\r\n /**\r\n * Lista dei locali disponibili, definiti anche con i vari alias\r\n */\r\n public static AvailableLocales: LocaleObject[] = [\r\n new LocaleObject('it-IT', 'Italiano', ['it', 'it-IT']),\r\n new LocaleObject('en-US', 'English', ['en', 'en-US'])\r\n ];\r\n\r\n /**\r\n * In base a un alias restituisce il locale rappresentato\r\n * \r\n * @param {string} alias Alias in base al quale raccogliere il Locale\r\n * \r\n * @returns {LocaleObject} Locale richiesto dall'alias\r\n */\r\n public static getByAlias(alias: string): LocaleObject {\r\n return this.AvailableLocales.find(t => !!t.aliases.find(a => a == alias));\r\n }\r\n}\r\n","/**\r\n * Classe che rappresenta la localizzazione di un test base per una certa lingua\r\n */\r\nexport class SpecializedLocalization {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} culture Culture della traduzione\r\n * @param {string} translation Traduzione nella lingua specificata dalla **culture**\r\n */\r\n constructor(public culture: string, public translation: string) { }\r\n}\r\n","import { ItemLocalization } from \"../models/ItemLocalization\";\r\nimport { LocaleDefinitions } from \"../models/LocaleDefinitions\";\r\nimport { SpecializedLocalization } from \"../models/SpecializedLocalization\";\r\n\r\nexport class LocalizationPersistor {\r\n\r\n constructor(private LocCache: { [id: string]: ItemLocalization } = null) { }\r\n\r\n /**\r\n * Imposta la localizzazione di un token all'interno della cache scelta\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} token Nome del token\r\n * @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n public setToken(direction: string, token: string, left: string, right: string[]) {\r\n let parsingRegex = /([a-zA-Z]+)[\\s]*->[\\s]*([a-zA-Z,\\s]+)+/g;\r\n var parsingRes = parsingRegex.exec(direction);\r\n\r\n let from = parsingRes[1];\r\n let to: string[] = parsingRes[2].replace(/\\s/g, '').split(',');\r\n let localeFrom = LocaleDefinitions.getByAlias(from);\r\n this._set(token, localeFrom.id, left, true);\r\n\r\n to.forEach((t, index) => {\r\n let localeTo = LocaleDefinitions.getByAlias(t);\r\n this._set(token, localeTo.id, right[index], true);\r\n });\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di una frase all'interno della cache scelta\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n public set(direction: string, left: string, right: string[]) {\r\n let parsingRegex = /([a-zA-Z]+)[\\s]*->[\\s]*([a-zA-Z,\\s]+)+/g;\r\n var parsingRes = parsingRegex.exec(direction);\r\n\r\n let from = parsingRes[1];\r\n let to: string[] = parsingRes[2].replace(/\\s/g, '').split(',');\r\n let localeFrom = LocaleDefinitions.getByAlias(from);\r\n this._set(left, localeFrom.id, left);\r\n\r\n to.forEach((t, index) => {\r\n let localeTo = LocaleDefinitions.getByAlias(t);\r\n this._set(left, localeTo.id, right[index]);\r\n });\r\n }\r\n\r\n /**\r\n * Imposta all'interno della cache specificata un'unica traduzione partendo da un testo di base\r\n * \r\n * @param {string} text Testo da tradurre\r\n * @param {string} culture Lingua per cui inserire la traduzione\r\n * @param {string} translation Traduzione del **text** nella lingua specificata da **culture**\r\n * @param {boolean} token Indica se il **text** è un token o è una frase normale\r\n */\r\n private _set(text: string, culture: string, translation: string, token?: boolean) {\r\n let item = this.get(text, token);\r\n if (!item) {\r\n this.LocCache[text] = new ItemLocalization(token, text, [new SpecializedLocalization(culture, translation)]);\r\n return;\r\n }\r\n\r\n var trs = this.translationByCulture(item, culture);\r\n if (trs) {\r\n console.warn(\"Localization already loaded for sentence '\" + text + \"' and culture \" + culture);\r\n return;\r\n }\r\n\r\n item.translations.push(new SpecializedLocalization(culture, translation));\r\n }\r\n\r\n /**\r\n * Partendo da una cache di localizzazione, dato un testo che può essere o meno un token, cerca quell'elemento all'interno della cache\r\n * \r\n * @param {string} text Testo da cercare nella **LocCache**\r\n * @param {boolean} allowtokens Indica se l'elemento cercato può essere un token o se dev'essere per forza una frase (per evitare rari \r\n * casi di collisione in cui magari un token è uguale a una frase tradotta)\r\n * \r\n * @returns {ItemLocalization} Informazioni di localizzazione per il **text** cercato\r\n */\r\n public get(text: string, allowtokens: boolean): ItemLocalization {\r\n let possibleItem: ItemLocalization = this.LocCache[text];\r\n var item = possibleItem && (allowtokens || !possibleItem.token) ? possibleItem : null;\r\n return item;\r\n }\r\n\r\n /**\r\n * Date le informazioni di localizzazione per un testo cerca e restituisce la traduzione per una lingua specifica\r\n * \r\n * @param {ItemLocalization} Informazioni di localizzazione\r\n * @param {string} culture Lingua della traduzione richiesta\r\n * \r\n * @returns {SpecializedLocalization} Informazioni di localizzazione specifiche della lingua richiesta\r\n */\r\n public translationByCulture(item: ItemLocalization, culture: string): SpecializedLocalization {\r\n for (let i = 0; i < item.translations.length; i++) {\r\n let trl = item.translations[i];\r\n if (trl.culture == culture)\r\n return trl;\r\n }\r\n\r\n return null;\r\n }\r\n}","\r\nexport enum BaseLocalizationTokens {\r\n getDateMonthPosition = \"getDateMonthPosition\",\r\n getDisplayDateMonthPosition = \"getDisplayDateMonthPosition\",\r\n getLocale = \"getLocale\",\r\n getSmallDateFormat = \"getSmallDateFormat\",\r\n getDefaultDateFormat = \"getDefaultDateFormat\",\r\n getSmallDateDisplayFormat = \"getSmallDateDisplayFormat\",\r\n getFullDateFormat = \"getFullDateFormat\",\r\n getFullDateDisplayFormat = \"getFullDateDisplayFormat\",\r\n getFullDateFormatNoSeconds = \"getFullDateFormatNoSeconds\",\r\n getFullDateDisplayFormatNoSeconds = \"getFullDateDisplayFormatNoSeconds\"\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { LocalizationMissingPolicy } from \"./models/LocalizationMissingPolicy\"\r\n\r\n/** Locale da utilizzare per le traduzioni */\r\nexport const LOC_LOCALE: InjectionToken<string> = new InjectionToken<string>('LOC_LOCALE');\r\n\r\n/** Policy da utilizzare per traduzioni mancanti */\r\nexport const LOC_MISSING_POLICY: InjectionToken<LocalizationMissingPolicy> = new InjectionToken<LocalizationMissingPolicy>('LOC_MISSING_POLICY');","import { Observable } from \"rxjs\";\r\n\r\n/** Classe astratta che rappresenta lo stato di persistenza fra la libreria e uno storage */\r\nexport abstract class LocalePersistor {\r\n\r\n /** Chiave su cui salvare il locale */\r\n protected LOCALE: string = \"LOCALE\";\r\n\r\n /**\r\n * Salva il Locale\r\n * \r\n * @param {string} locale Locale da salvare\r\n */\r\n public abstract persist(locale: string): Observable<boolean>;\r\n\r\n /**\r\n * Recupera il Locale\r\n * \r\n * @returns {Observable<string>} Valore salvato per il locale\r\n */\r\n public abstract recover(): Observable<string>;\r\n}","import { Inject, Injectable } from \"@angular/core\";\r\nimport { ItemLocalization } from \"../models/ItemLocalization\";\r\nimport { LocalizationPersistor } from \"./localization.persistor\";\r\nimport { BaseLocalizationTokens } from \"../models/BaseLocalizationTokens\";\r\nimport { LocalePersistor } from \"../locale-persistor/LocalePersistor\";\r\nimport { take } from \"rxjs/operators\";\r\nimport { ReplaySubject } from \"rxjs\";\r\nimport { LOC_LOCALE } from \"../tokens\";\r\n\r\n/**\r\n * Classe singleton che contiene le traduzioni di base (per evitare di ripeterle in oggi classe di traduzione) e le funzioni base per \r\n * inserire e leggere traduzioni in/da una cache\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class BaseLocalization {\r\n\r\n /**\r\n * Cache di tutte le localizzazioni di base\r\n */\r\n public LocCache: { [id: string]: ItemLocalization } = {};\r\n\r\n /**\r\n * Persistor delle localizzazioni relativo a questa classe\r\n */\r\n public Persistor: LocalizationPersistor;\r\n\r\n /**\r\n * Locale di riferimento per tutte le traduzioni\r\n */\r\n public Locale: ReplaySubject<string> = new ReplaySubject<string>(1);\r\n\r\n /**\r\n * Costruttore. Da qui utilizzando il metodo statico **BaseLocalization.set** si va a popolare la cache delle traduzioni **BaseTranslations**\r\n */\r\n constructor(public LocalePersistor: LocalePersistor, @Inject(LOC_LOCALE) defaultLocale: string) {\r\n\r\n // Recupero il locale alla partenza del BaseLocalization in modo, spero di dare tempo all'applicazione di tirarlo su\r\n this.LocalePersistor.recover().pipe(take(1)).subscribe(async l => {\r\n if (!l) {\r\n l = defaultLocale;\r\n this.LocalePersistor.persist(defaultLocale);\r\n }\r\n this.Locale.next(l)\r\n });\r\n\r\n this.Persistor = new LocalizationPersistor(this.LocCache); \r\n\r\n this.Persistor.set(\"en->it\", \"Remove\", [\"Elimina\"]);\r\n this.Persistor.set(\"en->it\", \"Paging\", [\"Paginazione\"]);\r\n this.Persistor.set(\"en->it\", \"Yes\", [\"Si\"]);\r\n this.Persistor.set(\"en->it\", \"No\", [\"No\"]);\r\n this.Persistor.set(\"en->it\", \"YES\", [\"SI'\"]);\r\n this.Persistor.set(\"en->it\", \"NO\", [\"NO\"]);\r\n this.Persistor.set(\"en->it\", \"Found objects\", [\"Risultati trovati\"]);\r\n this.Persistor.set(\"en->it\", \"Loading data...\", [\"Carico i dati...\"]);\r\n this.Persistor.set(\"en->it\", \"Error during save operations\", [\"Errori durante il salvataggio\"]);\r\n this.Persistor.set(\"en->it\", \"Error\", [\"Errore\"]);\r\n this.Persistor.set(\"en->it\", \"Warning\", [\"Avviso\"]);\r\n this.Persistor.set(\"en->it\", \"Information\", [\"Informazione\"]);\r\n this.Persistor.set(\"en->it\", \"Save\", [\"Salva\"]);\r\n this.Persistor.set(\"en->it\", \"Back\", [\"Indietro\"]);\r\n this.Persistor.set(\"en->it\", \"From\", [\"Da\"]);\r\n this.Persistor.set(\"en->it\", \"To\", [\"A\"]);\r\n this.Persistor.set(\"en->it\", \"View Chart\", [\"Vedi Grafico\"]);\r\n this.Persistor.set(\"en->it\", \"View Table\", [\"Vedi Tabella\"]);\r\n this.Persistor.set(\"en->it\", \"Notes\", [\"Note\"]);\r\n this.Persistor.set(\"en->it\", \"Edit Notes\", [\"Modifica Note\"]);\r\n this.Persistor.set(\"en->it\", \"Cancel\", [\"Annulla\"]);\r\n this.Persistor.set(\"en->it\", \"Confirm\", [\"Conferma\"]);\r\n this.Persistor.set(\"en->it\", \"View\", [\"Visualizza\"]);\r\n this.Persistor.set(\"en->it\", \"Close\", [\"Chiudi\"]);\r\n this.Persistor.set(\"en->it\", \"Select\", [\"Seleziona\"]);\r\n this.Persistor.set(\"en->it\", \"Meter Reading registered successfully\", [\"Lettura registrata correttamente\"]);\r\n this.Persistor.set(\"en->it\", \"Validation errors during save operations\", [\"Errori di validazione durante il salvataggio\"]);\r\n this.Persistor.set(\"en->it\", \"Can't register reading\", [\"Impossibile registrare la lettura\"]);\r\n this.Persistor.set(\"en->it\", \"Electricity\", [\"Elettricita\"]);\r\n this.Persistor.set(\"en->it\", \"Gas\", [\"Gas\"]);\r\n this.Persistor.set(\"en->it\", \"Water\", [\"Acqua\"]);\r\n this.Persistor.set(\"en->it\", \"Delete\", [\"Elimina\"]);\r\n this.Persistor.set(\"en->it\", \"This operation cannot be reverted\", [\"Questa operazione non puo' essere annullata\"]);\r\n this.Persistor.set(\"en->it\", \"Hide\", [\"Nascondi\"]);\r\n\r\n // Helper validazione\r\n this.Persistor.set(\"en->it\", \"Required field\", [\"Campo richiesto\"]);\r\n this.Persistor.set(\"en->it\", \"Wrong field format\", [\"Formato campo errato\"]);\r\n this.Persistor.set(\"en->it\", \"Wrong field format or field missing\", [\"Formato campo errato o campo mancante\"]);\r\n this.Persistor.set(\"en->it\", \"You don't have the required permissions to view this page. The navigation has been blocked\", [\"Non si hanno privilegi a sufficienza per accedere a questa pagina. La navigazione e' stata bloccata\"]);\r\n\r\n // Informazioni sulle date\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDateMonthPosition, \"0\", [\"1\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDisplayDateMonthPosition, \"1\", [\"1\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getLocale, \"en-US\", [\"it-IT\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getSmallDateFormat, \"MM/DD/YYYY\", [\"DD/MM/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDefaultDateFormat, \"MM/DD/YYYY\", [\"MM/DD/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getSmallDateDisplayFormat, \"DD/MM/YYYY\", [\"DD/MM/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateFormat, \"MM/DD/YYYY HH:mm:ss\", [\"DD/MM/YYYY HH:mm:ss\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateDisplayFormat, \"DD/MM/YYYY HH:mm:ss\", [\"DD/MM/YYYY HH:mm:ss\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateFormatNoSeconds, \"MM/DD/YYYY HH:mm\", [\"DD/MM/YYYY HH:mm\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateDisplayFormatNoSeconds, \"DD/MM/YYYY HH:mm\", [\"DD/MM/YYYY HH:mm\"]);\r\n }\r\n}","// Angular\r\nimport { Pipe, PipeTransform, Optional } from \"@angular/core\";\r\n\r\n// Configurazioni\r\nimport { DateService } from '@esfaenza/extensions';\r\n\r\n/**\r\n * Pipe che permette di formattare una data in base al formato specificato. Utilizza il **DateService** di **@esfaenza/extensions** per ricondurre l'input a una data valida\r\n */\r\n@Pipe({ name: \"loc_date\", pure: true })\r\nexport class LocDatePipe implements PipeTransform {\r\n\r\n /**\r\n * @ignore\r\n */\r\n constructor(@Optional() private dts: DateService) { }\r\n\r\n /**\r\n * Trasformazione della data in input in base al formato richiesto\r\n * \r\n * @param {any} value Valore da ricondurre ad una data e formattare\r\n * @param {string} format Formato in output della data da visualizzare\r\n * \r\n * @returns {string} Data formattata in base al formato\r\n */\r\n transform(value: any, format: string = \"DD/MM/YYYY\"): string {\r\n if (value == null || value === \"\") return null;\r\n\r\n if(!this.dts)\r\n {\r\n console.error(\"Tentativo di usare loc_date senza DateService. È possibile importare DateService installando e configurando il pacchetto @esfaenza/extensions\")\r\n return null;\r\n }\r\n var detatchedValue = JSON.parse(JSON.stringify(value));\r\n var dt = this.dts.getDateConvertion(detatchedValue);\r\n return dt.format(format);\r\n }\r\n}","\r\n/** \r\n * Enum che rappresenta le policy di comportamento qualore il sistema di localizzazione non trovi la localizzazione cercata, \r\n * usare **ThrowException** solo se ci si sente infallibili o si vuole debuggare in maniera approfondita l'applicazione \r\n */\r\nexport enum LocalizationMissingPolicy {\r\n PrintEmpty,\r\n PrintSource,\r\n ThrowException\r\n}\r\n","import { Injectable, Injector } from '@angular/core';\r\nimport { BaseLocalization } from './core/localization.base';\r\nimport { ItemLocalization } from './models/ItemLocalization';\r\nimport { LocalizationPersistor } from './core/localization.persistor';\r\nimport { LocalePersistor } from './locale-persistor/LocalePersistor';\r\nimport { LOC_MISSING_POLICY } from './tokens';\r\nimport { LocalizationMissingPolicy } from './models/LocalizationMissingPolicy';\r\n\r\n/**\r\n * Classe di localizzazione estendibile che permette di specificare le proprie localizzazioni e comunque rendere disponibili le localizzazioni globali\r\n */\r\n@Injectable()\r\nexport class LocalizationService {\r\n\r\n /**\r\n * Cache di tutte le localizzazioni disonibili all'interno di questa classe\r\n */\r\n private TranslationCache: { [id: string]: ItemLocalization } = {};\r\n\r\n public Locale: string;\r\n\r\n private baseLocalization: BaseLocalization;\r\n private onMissing: LocalizationMissingPolicy\r\n private Persistor: LocalizationPersistor;\r\n private LocalePersistor: LocalePersistor;\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} Locale Locale da utilizzare nel momento che questo servizio richiede le traduzioni\r\n * @param {baseLocalization} baseLocalization Classe base di localizzazione già fornita a livello di root dalla libreria stessa. \r\n * È sufficiente iniettarla nell'eventuale costruttore che estende questa classe e passarla as-is\r\n */\r\n constructor(private injector: Injector) {\r\n this.LocalePersistor = this.injector.get(LocalePersistor);\r\n this.baseLocalization = this.injector.get(BaseLocalization);\r\n this.onMissing = this.injector.get(LOC_MISSING_POLICY);\r\n \r\n this.Persistor = new LocalizationPersistor(this.TranslationCache);\r\n\r\n this.baseLocalization.Locale.subscribe(lr => {\r\n this.Locale = lr\r\n });\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di un token all'interno della **TranslationCache**\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} token Nome del token\r\n * @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n protected setToken(direction: string, token: string, left: string, right: string[]) {\r\n this.Persistor.setToken(direction, token, left, right);\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di una frase all'interno della **TranslationCache**\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n protected set(direction: string, left: string, right: string[]) {\r\n // Controlla di non reinserire la stessa localizzazione presente nel BaseLocalization\r\n // i controlli per il non reinserimento della stessa localizzazione all'interno della stessa istanza è fatto lato Persistor\r\n if (this.baseLocalization.Persistor.get(left, false)) {\r\n console.warn(`La localizzazione per ${left} è già presente fra le localizzazioni base, ignoro l'operazione`);\r\n return;\r\n }\r\n this.Persistor.set(direction, left, right);\r\n }\r\n\r\n /**\r\n * Localizza un token\r\n * \r\n * @param {string} text Il token da localizzare\r\n * \r\n * @returns {string} Token localizzato\r\n */\r\n public token(text: string): string {\r\n return this.loc(text, true);\r\n }\r\n\r\n /**\r\n * Localizza una frase\r\n * \r\n * @param {string} text Frase da localizzare\r\n * @param {boolean} allowtokens Indica se la frase **text** potrebbe essere un token o no\r\n * \r\n * @returns {string} Frase localizzata\r\n */\r\n public loc(text: string, allowtokens?: boolean): string {\r\n if (!this.Locale)\r\n throw \"Il sistema di localizzazione non ha ancora caricato il Locale, assicurarsi di caricare l'APP solo al retrieve del locale'\";\r\n\r\n if (!text || text == \"undefined\")\r\n return \"\";\r\n\r\n // Prendo la localizzazione o dalla cache attuale o dalla cache del servizio base\r\n var item = this.Persistor.get(text, allowtokens) || this.baseLocalization.Persistor.get(text, allowtokens);\r\n if (!item) {\r\n let message = `Impossibile trovare la localizzazione per '${text}'`;\r\n switch (this.onMissing) {\r\n case LocalizationMissingPolicy.PrintEmpty:\r\n console.error(message);\r\n return \"\";\r\n case LocalizationMissingPolicy.PrintSource:\r\n console.warn(message);\r\n return text;\r\n case LocalizationMissingPolicy.ThrowException:\r\n throw message;\r\n }\r\n }\r\n\r\n var loc = this.Persistor.translationByCulture(item, this.Locale);\r\n if (!loc) {\r\n console.error(\"Impossibile trovare la localizzazione per '\" + text + \"', culture \" + this.Locale);\r\n return \"\";\r\n }\r\n\r\n return loc.translation;\r\n }\r\n\r\n public async changeLocale(newLocale: string) {\r\n let locale = await this.LocalePersistor.recover().toPromise();\r\n if (newLocale == locale) {\r\n console.info(\"Il locale richiesto è lo stesso del locale attuale. Ignoro l'operazione\");\r\n return;\r\n }\r\n else {\r\n await this.LocalePersistor.persist(newLocale).toPromise();\r\n location.reload();\r\n }\r\n }\r\n}","// Angular\r\nimport { Pipe, PipeTransform } from \"@angular/core\";\r\nimport { LocalizationService } from '../localizations.service';\r\n\r\n/**\r\n * Pipe di localizzazione per tradurre direttamente da template\r\n */\r\n@Pipe({ name: \"localize\", pure: true })\r\nexport class LocalizePipe implements PipeTransform {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {LocalizationService} translationContainer Container delle traduzioni disponibili nel contesto in cui viene usata la pipe.\r\n * \r\n * Viene iniettata dal provider dichiarato nel singolo componente che utilizza la traduzione e, se non esiste, viene iniettato dal default\r\n */\r\n constructor(private translationContainer: LocalizationService) { }\r\n\r\n /**\r\n * Trasformazione della stringa in input ad una stringa tradotta\r\n * \r\n * @param {string} value Testo da tradurre\r\n * @param {LocalizationService} locContainerOverride Override al contenitore della traduzione iniettato dal costruttore, qualora serva\r\n * \r\n * @returns {string} Frase tradotta\r\n */\r\n transform(value: string, locContainerOverride?: LocalizationService): string {\r\n if (value == null || value === \"\") return \"\";\r\n\r\n return (locContainerOverride || this.translationContainer).loc(value);\r\n }\r\n}","// Angular\r\nimport { Injectable } from \"@angular/core\";\r\n\r\n// RXJS\r\nimport { Observable, of } from \"rxjs\";\r\nimport { first } from \"rxjs/operators\";\r\nimport { LocalePersistor } from \"./LocalePersistor\";\r\n\r\n@Injectable()\r\nexport class LocalStorageLocalePersistor extends LocalePersistor {\r\n\r\n /** @ignore Vedi classe base */\r\n public persist(locale: string): Observable<boolean> {\r\n localStorage.setItem(this.LOCALE, locale);\r\n return of(true).pipe(first());\r\n }\r\n\r\n /** @ignore Vedi classe base */\r\n public recover(): Observable<string> {\r\n var ret = localStorage.getItem(this.LOCALE);\r\n return of(ret).pipe(first());\r\n }\r\n}","// Angular\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\n\r\n// Pipe\r\nimport { LocDatePipe } from './pipes/loc_date.pipe';\r\nimport { LocalizePipe } from './pipes/localize.pipe';\r\n\r\n// Servizi\r\nimport { LocalizationService } from './localizations.service';\r\nimport { BaseLocalization } from './core/localization.base';\r\nimport { LocalePersistor } from './locale-persistor/LocalePersistor';\r\nimport { LocalStorageLocalePersistor } from './locale-persistor/LocalStorageCachePersistor';\r\n\r\n// Modelli\r\nimport { LocalizationModuleConfig } from './models/LocalizationModuleConfig';\r\nimport { LocalizationMissingPolicy } from './models/LocalizationMissingPolicy';\r\nimport { LOC_LOCALE, LOC_MISSING_POLICY } from './tokens';\r\n\r\n@NgModule({\r\n declarations: [LocalizePipe, LocDatePipe],\r\n exports: [LocalizePipe, LocDatePipe]\r\n})\r\nexport class LocalizationModule {\r\n static forRoot(config?: LocalizationModuleConfig): ModuleWithProviders<LocalizationModule> {\r\n return {\r\n ngModule: LocalizationModule,\r\n providers: [\r\n LocalizationService,\r\n BaseLocalization,\r\n { provide: LOC_LOCALE, useValue: config?.defaultLocale || 'it-IT' },\r\n { provide: LOC_MISSING_POLICY, useValue: config?.localizationMissingPolicy || LocalizationMissingPolicy.PrintEmpty},\r\n { provide: LocalePersistor, useClass: config?.localePersistor || LocalStorageLocalePersistor },\r\n ]\r\n };\r\n }\r\n}","import { Type } from \"@angular/core\";\r\nimport { LocalePersistor } from \"../locale-persistor/LocalePersistor\";\r\nimport { LocalizationMissingPolicy } from \"./LocalizationMissingPolicy\";\r\n\r\n/**\r\n * Classe di configurazione per il modulo di localizzazione\r\n */\r\nexport class LocalizationModuleConfig {\r\n\r\n /** Locale di default utilizzato per richiedere le traduzioni */\r\n defaultLocale: string;\r\n\r\n /**\r\n * Classe che si deve occupare dello store \"Definitivo\" delle info sul locale utilizzato. Di default viene proposto uno store lato localStorage ma si può facilmente \r\n * fornire uno storage che porta le informazioni lato Database in modo da avere la stessa lingua fino a che non viene cambiata (Es. Preference storage)\r\n */\r\n localePersistor?: Type<LocalePersistor>;\r\n\r\n /** Policy di cosa fare in caso il sistema non riesca a trovare una delle traduzioni */\r\n localizationMissingPolicy?: LocalizationMissingPolicy\r\n}","/*\r\n * Public API Surface of localizations\r\n */\r\n\r\nexport * from './lib/core/localization.base';\r\nexport * from './lib/localizations.module';\r\nexport * from './lib/localizations.service';\r\nexport * from './lib/pipes/localize.pipe';\r\nexport * from './lib/pipes/loc_date.pipe';\r\nexport * from './lib/tokens';\r\nexport * from './lib/models/LocalizationModuleConfig';\r\nexport * from './lib/models/BaseLocalizationTokens';\r\nexport * from './lib/models/LocalizationMissingPolicy';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.LocalizationService"],"mappings":";;;;;;AAEA;;AAEG;MACU,gBAAgB,CAAA;AAE3B;;;;;;AAMG;AACH,IAAA,WAAA,CAAmB,KAAc,EAAS,QAAgB,EAAS,YAAuC,EAAA;QAAvF,IAAK,CAAA,KAAA,GAAL,KAAK,CAAS;QAAS,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;QAAS,IAAY,CAAA,YAAA,GAAZ,YAAY,CAA2B;KAAI;AAC/G;;ACdD;;AAEG;MACU,YAAY,CAAA;AAErB;;;;;;AAMG;AACH,IAAA,WAAA,CAAmB,EAAU,EAAS,WAAmB,EAAS,OAAiB,EAAA;QAAhE,IAAE,CAAA,EAAA,GAAF,EAAE,CAAQ;QAAS,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;QAAS,IAAO,CAAA,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A,CAAA,CAAA;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;AACzC,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;AACrC,iBAAA,CAAA;;;ACjBD;;AAEG;MACU,wBAAwB,CAAA;AAapC;;ACpBD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"esfaenza-localizations.mjs","sources":["../../../projects/localizations/src/lib/models/ItemLocalization.ts","../../../projects/localizations/src/lib/models/LocaleObject.ts","../../../projects/localizations/src/lib/models/LocaleDefinitions.ts","../../../projects/localizations/src/lib/models/SpecializedLocalization.ts","../../../projects/localizations/src/lib/core/localization.persistor.ts","../../../projects/localizations/src/lib/models/BaseLocalizationTokens.ts","../../../projects/localizations/src/lib/tokens.ts","../../../projects/localizations/src/lib/locale-persistor/LocalePersistor.ts","../../../projects/localizations/src/lib/core/localization.base.ts","../../../projects/localizations/src/lib/models/LocalizationMissingPolicy.ts","../../../projects/localizations/src/lib/localizations.service.ts","../../../projects/localizations/src/lib/pipes/localize.pipe.ts","../../../projects/localizations/src/lib/locale-persistor/LocalStorageCachePersistor.ts","../../../projects/localizations/src/lib/localizations.module.ts","../../../projects/localizations/src/lib/models/LocalizationModuleConfig.ts","../../../projects/localizations/src/public-api.ts","../../../projects/localizations/src/esfaenza-localizations.ts"],"sourcesContent":["import { SpecializedLocalization } from \"./SpecializedLocalization\";\r\n\r\n/**\r\n * Contenitore delle localizzazioni collegate ad un testo \"base\", una per ogni linguaggio supportato\r\n */\r\nexport class ItemLocalization {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {boolean} token Indica se è un token o se è un testo\r\n * @param {string} baseText Testo base che verrà richiesto quando verrà cercata la localizzazione\r\n * @param {SpecializedLocalization[]} translations Lista di traduzioni in base al testo base\r\n */\r\n constructor(public token: boolean, public baseText: string, public translations: SpecializedLocalization[]){ }\r\n}","\r\n/**\r\n * Classe che rappresenta un locale (Es. 'Italiano') con i propri alias (Es. 'it' oppure 'it-IT')\r\n */\r\nexport class LocaleObject {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} id Codice locale\r\n * @param {string} description Descrizione locale\r\n * @param {string[]} aliases Alias con cui quel locale è conosciuto\r\n */\r\n constructor(public id: string, public description: string, public aliases: string[]) { }\r\n}\r\n","import { LocaleObject } from \"./LocaleObject\";\r\n\r\n// VVVVVVVV Tag per evitare che typescript muoia con l'errore \"Error encountered in metadata generated for exported symbol 'LocaleDefinitions'\" (https://github.com/angular/angular/issues/18867#issuecomment-357484102),\r\n// @dynamic\r\n\r\n/**\r\n * Definizione dei locali disponibili\r\n */\r\nexport class LocaleDefinitions {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor() { }\r\n\r\n /**\r\n * Lista dei locali disponibili, definiti anche con i vari alias\r\n */\r\n public static AvailableLocales: LocaleObject[] = [\r\n new LocaleObject('it-IT', 'Italiano', ['it', 'it-IT']),\r\n new LocaleObject('en-US', 'English', ['en', 'en-US'])\r\n ];\r\n\r\n /**\r\n * In base a un alias restituisce il locale rappresentato\r\n * \r\n * @param {string} alias Alias in base al quale raccogliere il Locale\r\n * \r\n * @returns {LocaleObject} Locale richiesto dall'alias\r\n */\r\n public static getByAlias(alias: string): LocaleObject {\r\n return this.AvailableLocales.find(t => !!t.aliases.find(a => a == alias));\r\n }\r\n}\r\n","/**\r\n * Classe che rappresenta la localizzazione di un test base per una certa lingua\r\n */\r\nexport class SpecializedLocalization {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} culture Culture della traduzione\r\n * @param {string} translation Traduzione nella lingua specificata dalla **culture**\r\n */\r\n constructor(public culture: string, public translation: string) { }\r\n}\r\n","import { ItemLocalization } from \"../models/ItemLocalization\";\r\nimport { LocaleDefinitions } from \"../models/LocaleDefinitions\";\r\nimport { SpecializedLocalization } from \"../models/SpecializedLocalization\";\r\n\r\nexport class LocalizationPersistor {\r\n\r\n constructor(private LocCache: { [id: string]: ItemLocalization } = null) { }\r\n\r\n /**\r\n * Imposta la localizzazione di un token all'interno della cache scelta\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} token Nome del token\r\n * @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n public setToken(direction: string, token: string, left: string, right: string[]) {\r\n let parsingRegex = /([a-zA-Z]+)[\\s]*->[\\s]*([a-zA-Z,\\s]+)+/g;\r\n var parsingRes = parsingRegex.exec(direction);\r\n\r\n let from = parsingRes[1];\r\n let to: string[] = parsingRes[2].replace(/\\s/g, '').split(',');\r\n let localeFrom = LocaleDefinitions.getByAlias(from);\r\n this._set(token, localeFrom.id, left, true);\r\n\r\n to.forEach((t, index) => {\r\n let localeTo = LocaleDefinitions.getByAlias(t);\r\n this._set(token, localeTo.id, right[index], true);\r\n });\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di una frase all'interno della cache scelta\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n public set(direction: string, left: string, right: string[]) {\r\n let parsingRegex = /([a-zA-Z]+)[\\s]*->[\\s]*([a-zA-Z,\\s]+)+/g;\r\n var parsingRes = parsingRegex.exec(direction);\r\n\r\n let from = parsingRes[1];\r\n let to: string[] = parsingRes[2].replace(/\\s/g, '').split(',');\r\n let localeFrom = LocaleDefinitions.getByAlias(from);\r\n this._set(left, localeFrom.id, left);\r\n\r\n to.forEach((t, index) => {\r\n let localeTo = LocaleDefinitions.getByAlias(t);\r\n this._set(left, localeTo.id, right[index]);\r\n });\r\n }\r\n\r\n /**\r\n * Imposta all'interno della cache specificata un'unica traduzione partendo da un testo di base\r\n * \r\n * @param {string} text Testo da tradurre\r\n * @param {string} culture Lingua per cui inserire la traduzione\r\n * @param {string} translation Traduzione del **text** nella lingua specificata da **culture**\r\n * @param {boolean} token Indica se il **text** è un token o è una frase normale\r\n */\r\n private _set(text: string, culture: string, translation: string, token?: boolean) {\r\n let item = this.get(text, token);\r\n if (!item) {\r\n this.LocCache[text] = new ItemLocalization(token, text, [new SpecializedLocalization(culture, translation)]);\r\n return;\r\n }\r\n\r\n var trs = this.translationByCulture(item, culture);\r\n if (trs) {\r\n console.warn(\"Localization already loaded for sentence '\" + text + \"' and culture \" + culture);\r\n return;\r\n }\r\n\r\n item.translations.push(new SpecializedLocalization(culture, translation));\r\n }\r\n\r\n /**\r\n * Partendo da una cache di localizzazione, dato un testo che può essere o meno un token, cerca quell'elemento all'interno della cache\r\n * \r\n * @param {string} text Testo da cercare nella **LocCache**\r\n * @param {boolean} allowtokens Indica se l'elemento cercato può essere un token o se dev'essere per forza una frase (per evitare rari \r\n * casi di collisione in cui magari un token è uguale a una frase tradotta)\r\n * \r\n * @returns {ItemLocalization} Informazioni di localizzazione per il **text** cercato\r\n */\r\n public get(text: string, allowtokens: boolean): ItemLocalization {\r\n let possibleItem: ItemLocalization = this.LocCache[text];\r\n var item = possibleItem && (allowtokens || !possibleItem.token) ? possibleItem : null;\r\n return item;\r\n }\r\n\r\n /**\r\n * Date le informazioni di localizzazione per un testo cerca e restituisce la traduzione per una lingua specifica\r\n * \r\n * @param {ItemLocalization} Informazioni di localizzazione\r\n * @param {string} culture Lingua della traduzione richiesta\r\n * \r\n * @returns {SpecializedLocalization} Informazioni di localizzazione specifiche della lingua richiesta\r\n */\r\n public translationByCulture(item: ItemLocalization, culture: string): SpecializedLocalization {\r\n for (let i = 0; i < item.translations.length; i++) {\r\n let trl = item.translations[i];\r\n if (trl.culture == culture)\r\n return trl;\r\n }\r\n\r\n return null;\r\n }\r\n}","\r\nexport enum BaseLocalizationTokens {\r\n getDateMonthPosition = \"getDateMonthPosition\",\r\n getDisplayDateMonthPosition = \"getDisplayDateMonthPosition\",\r\n getLocale = \"getLocale\",\r\n getSmallDateFormat = \"getSmallDateFormat\",\r\n getDefaultDateFormat = \"getDefaultDateFormat\",\r\n getSmallDateDisplayFormat = \"getSmallDateDisplayFormat\",\r\n getFullDateFormat = \"getFullDateFormat\",\r\n getFullDateDisplayFormat = \"getFullDateDisplayFormat\",\r\n getFullDateFormatNoSeconds = \"getFullDateFormatNoSeconds\",\r\n getFullDateDisplayFormatNoSeconds = \"getFullDateDisplayFormatNoSeconds\"\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { LocalizationMissingPolicy } from \"./models/LocalizationMissingPolicy\"\r\n\r\n/** Locale da utilizzare per le traduzioni */\r\nexport const LOC_LOCALE: InjectionToken<string> = new InjectionToken<string>('LOC_LOCALE');\r\n\r\n/** Policy da utilizzare per traduzioni mancanti */\r\nexport const LOC_MISSING_POLICY: InjectionToken<LocalizationMissingPolicy> = new InjectionToken<LocalizationMissingPolicy>('LOC_MISSING_POLICY');","import { Observable } from \"rxjs\";\r\n\r\n/** Classe astratta che rappresenta lo stato di persistenza fra la libreria e uno storage */\r\nexport abstract class LocalePersistor {\r\n\r\n /** Chiave su cui salvare il locale */\r\n protected LOCALE: string = \"LOCALE\";\r\n\r\n /**\r\n * Salva il Locale\r\n * \r\n * @param {string} locale Locale da salvare\r\n */\r\n public abstract persist(locale: string): Observable<boolean>;\r\n\r\n /**\r\n * Recupera il Locale\r\n * \r\n * @returns {Observable<string>} Valore salvato per il locale\r\n */\r\n public abstract recover(): Observable<string>;\r\n}","import { Inject, Injectable } from \"@angular/core\";\r\nimport { ItemLocalization } from \"../models/ItemLocalization\";\r\nimport { LocalizationPersistor } from \"./localization.persistor\";\r\nimport { BaseLocalizationTokens } from \"../models/BaseLocalizationTokens\";\r\nimport { LocalePersistor } from \"../locale-persistor/LocalePersistor\";\r\nimport { take } from \"rxjs/operators\";\r\nimport { ReplaySubject } from \"rxjs\";\r\nimport { LOC_LOCALE } from \"../tokens\";\r\n\r\n/**\r\n * Classe singleton che contiene le traduzioni di base (per evitare di ripeterle in oggi classe di traduzione) e le funzioni base per \r\n * inserire e leggere traduzioni in/da una cache\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class BaseLocalization {\r\n\r\n /**\r\n * Cache di tutte le localizzazioni di base\r\n */\r\n public LocCache: { [id: string]: ItemLocalization } = {};\r\n\r\n /**\r\n * Persistor delle localizzazioni relativo a questa classe\r\n */\r\n public Persistor: LocalizationPersistor;\r\n\r\n /**\r\n * Locale di riferimento per tutte le traduzioni\r\n */\r\n public Locale: ReplaySubject<string> = new ReplaySubject<string>(1);\r\n\r\n /**\r\n * Costruttore. Da qui utilizzando il metodo statico **BaseLocalization.set** si va a popolare la cache delle traduzioni **BaseTranslations**\r\n */\r\n constructor(public LocalePersistor: LocalePersistor, @Inject(LOC_LOCALE) defaultLocale: string) {\r\n\r\n // Recupero il locale alla partenza del BaseLocalization in modo, spero di dare tempo all'applicazione di tirarlo su\r\n this.LocalePersistor.recover().pipe(take(1)).subscribe(async l => {\r\n if (!l) {\r\n l = defaultLocale;\r\n this.LocalePersistor.persist(defaultLocale);\r\n }\r\n this.Locale.next(l)\r\n });\r\n\r\n this.Persistor = new LocalizationPersistor(this.LocCache); \r\n\r\n this.Persistor.set(\"en->it\", \"Remove\", [\"Elimina\"]);\r\n this.Persistor.set(\"en->it\", \"Paging\", [\"Paginazione\"]);\r\n this.Persistor.set(\"en->it\", \"Yes\", [\"Si\"]);\r\n this.Persistor.set(\"en->it\", \"No\", [\"No\"]);\r\n this.Persistor.set(\"en->it\", \"YES\", [\"SI'\"]);\r\n this.Persistor.set(\"en->it\", \"NO\", [\"NO\"]);\r\n this.Persistor.set(\"en->it\", \"Found objects\", [\"Risultati trovati\"]);\r\n this.Persistor.set(\"en->it\", \"Loading data...\", [\"Carico i dati...\"]);\r\n this.Persistor.set(\"en->it\", \"Error during save operations\", [\"Errori durante il salvataggio\"]);\r\n this.Persistor.set(\"en->it\", \"Error\", [\"Errore\"]);\r\n this.Persistor.set(\"en->it\", \"Warning\", [\"Avviso\"]);\r\n this.Persistor.set(\"en->it\", \"Information\", [\"Informazione\"]);\r\n this.Persistor.set(\"en->it\", \"Save\", [\"Salva\"]);\r\n this.Persistor.set(\"en->it\", \"Back\", [\"Indietro\"]);\r\n this.Persistor.set(\"en->it\", \"From\", [\"Da\"]);\r\n this.Persistor.set(\"en->it\", \"To\", [\"A\"]);\r\n this.Persistor.set(\"en->it\", \"View Chart\", [\"Vedi Grafico\"]);\r\n this.Persistor.set(\"en->it\", \"View Table\", [\"Vedi Tabella\"]);\r\n this.Persistor.set(\"en->it\", \"Notes\", [\"Note\"]);\r\n this.Persistor.set(\"en->it\", \"Edit Notes\", [\"Modifica Note\"]);\r\n this.Persistor.set(\"en->it\", \"Cancel\", [\"Annulla\"]);\r\n this.Persistor.set(\"en->it\", \"Confirm\", [\"Conferma\"]);\r\n this.Persistor.set(\"en->it\", \"View\", [\"Visualizza\"]);\r\n this.Persistor.set(\"en->it\", \"Close\", [\"Chiudi\"]);\r\n this.Persistor.set(\"en->it\", \"Select\", [\"Seleziona\"]);\r\n this.Persistor.set(\"en->it\", \"Meter Reading registered successfully\", [\"Lettura registrata correttamente\"]);\r\n this.Persistor.set(\"en->it\", \"Validation errors during save operations\", [\"Errori di validazione durante il salvataggio\"]);\r\n this.Persistor.set(\"en->it\", \"Can't register reading\", [\"Impossibile registrare la lettura\"]);\r\n this.Persistor.set(\"en->it\", \"Electricity\", [\"Elettricita\"]);\r\n this.Persistor.set(\"en->it\", \"Gas\", [\"Gas\"]);\r\n this.Persistor.set(\"en->it\", \"Water\", [\"Acqua\"]);\r\n this.Persistor.set(\"en->it\", \"Delete\", [\"Elimina\"]);\r\n this.Persistor.set(\"en->it\", \"This operation cannot be reverted\", [\"Questa operazione non puo' essere annullata\"]);\r\n this.Persistor.set(\"en->it\", \"Hide\", [\"Nascondi\"]);\r\n\r\n // Helper validazione\r\n this.Persistor.set(\"en->it\", \"Required field\", [\"Campo richiesto\"]);\r\n this.Persistor.set(\"en->it\", \"Wrong field format\", [\"Formato campo errato\"]);\r\n this.Persistor.set(\"en->it\", \"Wrong field format or field missing\", [\"Formato campo errato o campo mancante\"]);\r\n this.Persistor.set(\"en->it\", \"You don't have the required permissions to view this page. The navigation has been blocked\", [\"Non si hanno privilegi a sufficienza per accedere a questa pagina. La navigazione e' stata bloccata\"]);\r\n\r\n // Informazioni sulle date\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDateMonthPosition, \"0\", [\"1\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDisplayDateMonthPosition, \"1\", [\"1\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getLocale, \"en-US\", [\"it-IT\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getSmallDateFormat, \"MM/DD/YYYY\", [\"DD/MM/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getDefaultDateFormat, \"MM/DD/YYYY\", [\"MM/DD/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getSmallDateDisplayFormat, \"DD/MM/YYYY\", [\"DD/MM/YYYY\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateFormat, \"MM/DD/YYYY HH:mm:ss\", [\"DD/MM/YYYY HH:mm:ss\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateDisplayFormat, \"DD/MM/YYYY HH:mm:ss\", [\"DD/MM/YYYY HH:mm:ss\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateFormatNoSeconds, \"MM/DD/YYYY HH:mm\", [\"DD/MM/YYYY HH:mm\"]);\r\n this.Persistor.setToken(\"en->it\", BaseLocalizationTokens.getFullDateDisplayFormatNoSeconds, \"DD/MM/YYYY HH:mm\", [\"DD/MM/YYYY HH:mm\"]);\r\n }\r\n}","\r\n/** \r\n * Enum che rappresenta le policy di comportamento qualore il sistema di localizzazione non trovi la localizzazione cercata, \r\n * usare **ThrowException** solo se ci si sente infallibili o si vuole debuggare in maniera approfondita l'applicazione \r\n */\r\nexport enum LocalizationMissingPolicy {\r\n PrintEmpty,\r\n PrintSource,\r\n ThrowException\r\n}\r\n","import { Injectable, Injector } from '@angular/core';\r\nimport { BaseLocalization } from './core/localization.base';\r\nimport { ItemLocalization } from './models/ItemLocalization';\r\nimport { LocalizationPersistor } from './core/localization.persistor';\r\nimport { LocalePersistor } from './locale-persistor/LocalePersistor';\r\nimport { LOC_MISSING_POLICY } from './tokens';\r\nimport { LocalizationMissingPolicy } from './models/LocalizationMissingPolicy';\r\n\r\n/**\r\n * Classe di localizzazione estendibile che permette di specificare le proprie localizzazioni e comunque rendere disponibili le localizzazioni globali\r\n */\r\n@Injectable()\r\nexport class LocalizationService {\r\n\r\n /**\r\n * Cache di tutte le localizzazioni disonibili all'interno di questa classe\r\n */\r\n private TranslationCache: { [id: string]: ItemLocalization } = {};\r\n\r\n public Locale: string;\r\n\r\n private baseLocalization: BaseLocalization;\r\n private onMissing: LocalizationMissingPolicy\r\n private Persistor: LocalizationPersistor;\r\n private LocalePersistor: LocalePersistor;\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} Locale Locale da utilizzare nel momento che questo servizio richiede le traduzioni\r\n * @param {baseLocalization} baseLocalization Classe base di localizzazione già fornita a livello di root dalla libreria stessa. \r\n * È sufficiente iniettarla nell'eventuale costruttore che estende questa classe e passarla as-is\r\n */\r\n constructor(private injector: Injector) {\r\n this.LocalePersistor = this.injector.get(LocalePersistor);\r\n this.baseLocalization = this.injector.get(BaseLocalization);\r\n this.onMissing = this.injector.get(LOC_MISSING_POLICY);\r\n \r\n this.Persistor = new LocalizationPersistor(this.TranslationCache);\r\n\r\n this.baseLocalization.Locale.subscribe(lr => {\r\n this.Locale = lr\r\n });\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di un token all'interno della **TranslationCache**\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} token Nome del token\r\n * @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n protected setToken(direction: string, token: string, left: string, right: string[]) {\r\n this.Persistor.setToken(direction, token, left, right);\r\n }\r\n\r\n /**\r\n * Imposta la localizzazione di una frase all'interno della **TranslationCache**\r\n * \r\n * @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.\r\n * Ad esempio, \"en->it\" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right** \r\n * è presente l'unica traduzione in italiano, per definire più traduzioni sul lato destro della freccia bisogna concatenarle con la virgola, ad esempio \"en->it,jp,ecc\"\r\n * @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**\r\n * @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**\r\n */\r\n protected set(direction: string, left: string, right: string[]) {\r\n // Controlla di non reinserire la stessa localizzazione presente nel BaseLocalization\r\n // i controlli per il non reinserimento della stessa localizzazione all'interno della stessa istanza è fatto lato Persistor\r\n if (this.baseLocalization.Persistor.get(left, false)) {\r\n console.warn(`La localizzazione per ${left} è già presente fra le localizzazioni base, ignoro l'operazione`);\r\n return;\r\n }\r\n this.Persistor.set(direction, left, right);\r\n }\r\n\r\n /**\r\n * Localizza un token\r\n * \r\n * @param {string} text Il token da localizzare\r\n * \r\n * @returns {string} Token localizzato\r\n */\r\n public token(text: string): string {\r\n return this.loc(text, true);\r\n }\r\n\r\n /**\r\n * Localizza una frase\r\n * \r\n * @param {string} text Frase da localizzare\r\n * @param {boolean} allowtokens Indica se la frase **text** potrebbe essere un token o no\r\n * \r\n * @returns {string} Frase localizzata\r\n */\r\n public loc(text: string, allowtokens?: boolean): string {\r\n if (!this.Locale)\r\n throw \"Il sistema di localizzazione non ha ancora caricato il Locale, assicurarsi di caricare l'APP solo al retrieve del locale'\";\r\n\r\n if (!text || text == \"undefined\")\r\n return \"\";\r\n\r\n // Prendo la localizzazione o dalla cache attuale o dalla cache del servizio base\r\n var item = this.Persistor.get(text, allowtokens) || this.baseLocalization.Persistor.get(text, allowtokens);\r\n if (!item) {\r\n let message = `Impossibile trovare la localizzazione per '${text}'`;\r\n switch (this.onMissing) {\r\n case LocalizationMissingPolicy.PrintEmpty:\r\n console.error(message);\r\n return \"\";\r\n case LocalizationMissingPolicy.PrintSource:\r\n console.warn(message);\r\n return text;\r\n case LocalizationMissingPolicy.ThrowException:\r\n throw message;\r\n }\r\n }\r\n\r\n var loc = this.Persistor.translationByCulture(item, this.Locale);\r\n if (!loc) {\r\n console.error(\"Impossibile trovare la localizzazione per '\" + text + \"', culture \" + this.Locale);\r\n return \"\";\r\n }\r\n\r\n return loc.translation;\r\n }\r\n\r\n public async changeLocale(newLocale: string) {\r\n let locale = await this.LocalePersistor.recover().toPromise();\r\n if (newLocale == locale) {\r\n console.info(\"Il locale richiesto è lo stesso del locale attuale. Ignoro l'operazione\");\r\n return;\r\n }\r\n else {\r\n await this.LocalePersistor.persist(newLocale).toPromise();\r\n location.reload();\r\n }\r\n }\r\n}","// Angular\r\nimport { Pipe, PipeTransform } from \"@angular/core\";\r\nimport { LocalizationService } from '../localizations.service';\r\n\r\n/**\r\n * Pipe di localizzazione per tradurre direttamente da template\r\n */\r\n@Pipe({ name: \"localize\", pure: true })\r\nexport class LocalizePipe implements PipeTransform {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {LocalizationService} translationContainer Container delle traduzioni disponibili nel contesto in cui viene usata la pipe.\r\n * \r\n * Viene iniettata dal provider dichiarato nel singolo componente che utilizza la traduzione e, se non esiste, viene iniettato dal default\r\n */\r\n constructor(private translationContainer: LocalizationService) { }\r\n\r\n /**\r\n * Trasformazione della stringa in input ad una stringa tradotta\r\n * \r\n * @param {string} value Testo da tradurre\r\n * @param {LocalizationService} locContainerOverride Override al contenitore della traduzione iniettato dal costruttore, qualora serva\r\n * \r\n * @returns {string} Frase tradotta\r\n */\r\n transform(value: string, locContainerOverride?: LocalizationService): string {\r\n if (value == null || value === \"\") return \"\";\r\n\r\n return (locContainerOverride || this.translationContainer).loc(value);\r\n }\r\n}","// Angular\r\nimport { Injectable } from \"@angular/core\";\r\n\r\n// RXJS\r\nimport { Observable, of } from \"rxjs\";\r\nimport { first } from \"rxjs/operators\";\r\nimport { LocalePersistor } from \"./LocalePersistor\";\r\n\r\n@Injectable()\r\nexport class LocalStorageLocalePersistor extends LocalePersistor {\r\n\r\n /** @ignore Vedi classe base */\r\n public persist(locale: string): Observable<boolean> {\r\n localStorage.setItem(this.LOCALE, locale);\r\n return of(true).pipe(first());\r\n }\r\n\r\n /** @ignore Vedi classe base */\r\n public recover(): Observable<string> {\r\n var ret = localStorage.getItem(this.LOCALE);\r\n return of(ret).pipe(first());\r\n }\r\n}","// Angular\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\n\r\n// Pipe\r\nimport { LocalizePipe } from './pipes/localize.pipe';\r\n\r\n// Servizi\r\nimport { LocalizationService } from './localizations.service';\r\nimport { BaseLocalization } from './core/localization.base';\r\nimport { LocalePersistor } from './locale-persistor/LocalePersistor';\r\nimport { LocalStorageLocalePersistor } from './locale-persistor/LocalStorageCachePersistor';\r\n\r\n// Modelli\r\nimport { LocalizationModuleConfig } from './models/LocalizationModuleConfig';\r\nimport { LocalizationMissingPolicy } from './models/LocalizationMissingPolicy';\r\nimport { LOC_LOCALE, LOC_MISSING_POLICY } from './tokens';\r\n\r\n@NgModule({\r\n declarations: [LocalizePipe],\r\n exports: [LocalizePipe]\r\n})\r\nexport class LocalizationModule {\r\n static forRoot(config?: LocalizationModuleConfig): ModuleWithProviders<LocalizationModule> {\r\n return {\r\n ngModule: LocalizationModule,\r\n providers: [\r\n LocalizationService,\r\n BaseLocalization,\r\n { provide: LOC_LOCALE, useValue: config?.defaultLocale || 'it-IT' },\r\n { provide: LOC_MISSING_POLICY, useValue: config?.localizationMissingPolicy || LocalizationMissingPolicy.PrintEmpty},\r\n { provide: LocalePersistor, useClass: config?.localePersistor || LocalStorageLocalePersistor },\r\n ]\r\n };\r\n }\r\n}","import { Type } from \"@angular/core\";\r\nimport { LocalePersistor } from \"../locale-persistor/LocalePersistor\";\r\nimport { LocalizationMissingPolicy } from \"./LocalizationMissingPolicy\";\r\n\r\n/**\r\n * Classe di configurazione per il modulo di localizzazione\r\n */\r\nexport class LocalizationModuleConfig {\r\n\r\n /** Locale di default utilizzato per richiedere le traduzioni */\r\n defaultLocale: string;\r\n\r\n /**\r\n * Classe che si deve occupare dello store \"Definitivo\" delle info sul locale utilizzato. Di default viene proposto uno store lato localStorage ma si può facilmente \r\n * fornire uno storage che porta le informazioni lato Database in modo da avere la stessa lingua fino a che non viene cambiata (Es. Preference storage)\r\n */\r\n localePersistor?: Type<LocalePersistor>;\r\n\r\n /** Policy di cosa fare in caso il sistema non riesca a trovare una delle traduzioni */\r\n localizationMissingPolicy?: LocalizationMissingPolicy\r\n}","/*\r\n * Public API Surface of localizations\r\n */\r\n\r\nexport * from './lib/core/localization.base';\r\nexport * from './lib/localizations.module';\r\nexport * from './lib/localizations.service';\r\nexport * from './lib/pipes/localize.pipe';\r\nexport * from './lib/tokens';\r\nexport * from './lib/models/LocalizationModuleConfig';\r\nexport * from './lib/models/BaseLocalizationTokens';\r\nexport * from './lib/models/LocalizationMissingPolicy';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.LocalizationService"],"mappings":";;;;;AAEA;;AAEG;MACU,gBAAgB,CAAA;AAE3B;;;;;;AAMG;AACH,IAAA,WAAA,CAAmB,KAAc,EAAS,QAAgB,EAAS,YAAuC,EAAA;QAAvF,IAAK,CAAA,KAAA,GAAL,KAAK,CAAS;QAAS,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;QAAS,IAAY,CAAA,YAAA,GAAZ,YAAY,CAA2B;KAAI;AAC/G;;ACdD;;AAEG;MACU,YAAY,CAAA;AAErB;;;;;;AAMG;AACH,IAAA,WAAA,CAAmB,EAAU,EAAS,WAAmB,EAAS,OAAiB,EAAA;QAAhE,IAAE,CAAA,EAAA,GAAF,EAAE,CAAQ;QAAS,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;QAAS,IAAO,CAAA,OAAA,GAAP,OAAO,CAAU;KAAK;AAC3F;;ACZD;AACA;AAEA;;AAEG;MACU,iBAAiB,CAAA;AAE1B;;;;AAIG;AACH,IAAA,WAAA,GAAA,GAAiB;AAUjB;;;;;;AAMG;IACI,OAAO,UAAU,CAAC,KAAa,EAAA;QAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,C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@ -2,10 +2,9 @@ import { ModuleWithProviders } from '@angular/core';
|
|
|
2
2
|
import { LocalizationModuleConfig } from './models/LocalizationModuleConfig';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import * as i1 from "./pipes/localize.pipe";
|
|
5
|
-
import * as i2 from "./pipes/loc_date.pipe";
|
|
6
5
|
export declare class LocalizationModule {
|
|
7
6
|
static forRoot(config?: LocalizationModuleConfig): ModuleWithProviders<LocalizationModule>;
|
|
8
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationModule, never>;
|
|
9
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationModule, [typeof i1.LocalizePipe
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationModule, [typeof i1.LocalizePipe], never, [typeof i1.LocalizePipe]>;
|
|
10
9
|
static ɵinj: i0.ɵɵInjectorDeclaration<LocalizationModule>;
|
|
11
10
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esfaenza/localizations",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.5",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.0.0"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@angular/common": "^15.2.9",
|
|
9
|
-
"@angular/core": "^15.2.9"
|
|
10
|
-
"@esfaenza/extensions": "^15.2.1"
|
|
9
|
+
"@angular/core": "^15.2.9"
|
|
11
10
|
},
|
|
12
11
|
"module": "fesm2015/esfaenza-localizations.mjs",
|
|
13
12
|
"es2020": "fesm2020/esfaenza-localizations.mjs",
|
package/public-api.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './lib/core/localization.base';
|
|
|
2
2
|
export * from './lib/localizations.module';
|
|
3
3
|
export * from './lib/localizations.service';
|
|
4
4
|
export * from './lib/pipes/localize.pipe';
|
|
5
|
-
export * from './lib/pipes/loc_date.pipe';
|
|
6
5
|
export * from './lib/tokens';
|
|
7
6
|
export * from './lib/models/LocalizationModuleConfig';
|
|
8
7
|
export * from './lib/models/BaseLocalizationTokens';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Angular
|
|
2
|
-
import { Pipe, Optional } from "@angular/core";
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "@esfaenza/extensions";
|
|
5
|
-
/**
|
|
6
|
-
* Pipe che permette di formattare una data in base al formato specificato. Utilizza il **DateService** di **@esfaenza/extensions** per ricondurre l'input a una data valida
|
|
7
|
-
*/
|
|
8
|
-
export class LocDatePipe {
|
|
9
|
-
/**
|
|
10
|
-
* @ignore
|
|
11
|
-
*/
|
|
12
|
-
constructor(dts) {
|
|
13
|
-
this.dts = dts;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Trasformazione della data in input in base al formato richiesto
|
|
17
|
-
*
|
|
18
|
-
* @param {any} value Valore da ricondurre ad una data e formattare
|
|
19
|
-
* @param {string} format Formato in output della data da visualizzare
|
|
20
|
-
*
|
|
21
|
-
* @returns {string} Data formattata in base al formato
|
|
22
|
-
*/
|
|
23
|
-
transform(value, format = "DD/MM/YYYY") {
|
|
24
|
-
if (value == null || value === "")
|
|
25
|
-
return null;
|
|
26
|
-
if (!this.dts) {
|
|
27
|
-
console.error("Tentativo di usare loc_date senza DateService. È possibile importare DateService installando e configurando il pacchetto @esfaenza/extensions");
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
var detatchedValue = JSON.parse(JSON.stringify(value));
|
|
31
|
-
var dt = this.dts.getDateConvertion(detatchedValue);
|
|
32
|
-
return dt.format(format);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
LocDatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, deps: [{ token: i1.DateService, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
36
|
-
LocDatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, name: "loc_date" });
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocDatePipe, decorators: [{
|
|
38
|
-
type: Pipe,
|
|
39
|
-
args: [{ name: "loc_date", pure: true }]
|
|
40
|
-
}], ctorParameters: function () { return [{ type: i1.DateService, decorators: [{
|
|
41
|
-
type: Optional
|
|
42
|
-
}] }]; } });
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jX2RhdGUucGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2xvY2FsaXphdGlvbnMvc3JjL2xpYi9waXBlcy9sb2NfZGF0ZS5waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFVBQVU7QUFDVixPQUFPLEVBQUUsSUFBSSxFQUFpQixRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7OztBQUs5RDs7R0FFRztBQUVILE1BQU0sT0FBTyxXQUFXO0lBRXBCOztPQUVHO0lBQ0gsWUFBZ0MsR0FBZ0I7UUFBaEIsUUFBRyxHQUFILEdBQUcsQ0FBYTtJQUFJLENBQUM7SUFFckQ7Ozs7Ozs7T0FPRztJQUNILFNBQVMsQ0FBQyxLQUFVLEVBQUUsU0FBaUIsWUFBWTtRQUMvQyxJQUFJLEtBQUssSUFBSSxJQUFJLElBQUksS0FBSyxLQUFLLEVBQUU7WUFBRSxPQUFPLElBQUksQ0FBQztRQUUvQyxJQUFHLENBQUMsSUFBSSxDQUFDLEdBQUcsRUFDWjtZQUNJLE9BQU8sQ0FBQyxLQUFLLENBQUMsK0lBQStJLENBQUMsQ0FBQTtZQUM5SixPQUFPLElBQUksQ0FBQztTQUNmO1FBQ0Qs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gIH1cclxuICAgICAgICB2YXIgZGV0YXRjaGVkVmFsdWUgPSBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KHZhbHVlKSk7XHJcbiAgICAgICAgdmFyIGR0ID0gdGhpcy5kdHMuZ2V0RGF0ZUNvbnZlcnRpb24oZGV0YXRjaGVkVmFsdWUpO1xyXG4gICAgICAgIHJldHVybiBkdC5mb3JtYXQoZm9ybWF0KTtcclxuICAgIH1cclxufSJdfQ==
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { PipeTransform } from "@angular/core";
|
|
2
|
-
import { DateService } from '@esfaenza/extensions';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* Pipe che permette di formattare una data in base al formato specificato. Utilizza il **DateService** di **@esfaenza/extensions** per ricondurre l'input a una data valida
|
|
6
|
-
*/
|
|
7
|
-
export declare class LocDatePipe implements PipeTransform {
|
|
8
|
-
private dts;
|
|
9
|
-
/**
|
|
10
|
-
* @ignore
|
|
11
|
-
*/
|
|
12
|
-
constructor(dts: DateService);
|
|
13
|
-
/**
|
|
14
|
-
* Trasformazione della data in input in base al formato richiesto
|
|
15
|
-
*
|
|
16
|
-
* @param {any} value Valore da ricondurre ad una data e formattare
|
|
17
|
-
* @param {string} format Formato in output della data da visualizzare
|
|
18
|
-
*
|
|
19
|
-
* @returns {string} Data formattata in base al formato
|
|
20
|
-
*/
|
|
21
|
-
transform(value: any, format?: string): string;
|
|
22
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<LocDatePipe, [{ optional: true; }]>;
|
|
23
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<LocDatePipe, "loc_date", false>;
|
|
24
|
-
}
|