@esfaenza/localizations 16.2.29 → 17.3.0
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/esm2022/esfaenza-localizations.mjs +4 -4
- package/esm2022/lib/core/localization.base.mjs +80 -80
- package/esm2022/lib/core/localization.persistor.mjs +103 -103
- package/esm2022/lib/locale-persistor/LocalStorageCachePersistor.mjs +24 -24
- package/esm2022/lib/locale-persistor/LocalePersistor.mjs +7 -7
- package/esm2022/lib/localizations.module.mjs +37 -37
- package/esm2022/lib/localizations.service.mjs +145 -145
- package/esm2022/lib/models/BaseLocalizationTokens.mjs +13 -13
- package/esm2022/lib/models/ItemLocalization.mjs +17 -17
- package/esm2022/lib/models/LocaleDefinitions.mjs +25 -25
- package/esm2022/lib/models/LocaleObject.mjs +19 -19
- package/esm2022/lib/models/LocalizationMissingPolicy.mjs +10 -10
- package/esm2022/lib/models/LocalizationModuleConfig.mjs +5 -5
- package/esm2022/lib/models/SpecializedLocalization.mjs +15 -15
- package/esm2022/lib/pipes/localize.pipe.mjs +38 -38
- package/esm2022/lib/tokens.mjs +7 -7
- package/esm2022/public-api.mjs +11 -11
- package/fesm2022/esfaenza-localizations.mjs +494 -494
- package/fesm2022/esfaenza-localizations.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/lib/core/localization.base.d.ts +32 -32
- package/lib/core/localization.persistor.d.ts +57 -57
- package/lib/locale-persistor/LocalStorageCachePersistor.d.ts +11 -11
- package/lib/locale-persistor/LocalePersistor.d.ts +18 -18
- package/lib/localizations.module.d.ts +10 -10
- package/lib/localizations.service.d.ts +74 -74
- package/lib/models/BaseLocalizationTokens.d.ts +12 -12
- package/lib/models/ItemLocalization.d.ts +17 -17
- package/lib/models/LocaleDefinitions.d.ts +20 -20
- package/lib/models/LocaleObject.d.ts +18 -18
- package/lib/models/LocalizationMissingPolicy.d.ts +9 -9
- package/lib/models/LocalizationModuleConfig.d.ts +19 -19
- package/lib/models/SpecializedLocalization.d.ts +14 -14
- package/lib/pipes/localize.pipe.d.ts +28 -28
- package/lib/tokens.d.ts +8 -8
- package/package.json +3 -3
- package/public-api.d.ts +8 -8
|
@@ -1,530 +1,530 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken,
|
|
2
|
+
import { InjectionToken, Inject, Injectable, Injector, Pipe, NgModule } from '@angular/core';
|
|
3
3
|
import { take, first } from 'rxjs/operators';
|
|
4
4
|
import { ReplaySubject, of } from 'rxjs';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Contenitore delle localizzazioni collegate ad un testo "base", una per ogni linguaggio supportato
|
|
8
|
-
*/
|
|
9
|
-
class ItemLocalization {
|
|
10
|
-
/**
|
|
11
|
-
* Costruttore
|
|
12
|
-
*
|
|
13
|
-
* @param {boolean} token Indica se è un token o se è un testo
|
|
14
|
-
* @param {string} baseText Testo base che verrà richiesto quando verrà cercata la localizzazione
|
|
15
|
-
* @param {SpecializedLocalization[]} translations Lista di traduzioni in base al testo base
|
|
16
|
-
*/
|
|
17
|
-
constructor(token, baseText, translations) {
|
|
18
|
-
this.token = token;
|
|
19
|
-
this.baseText = baseText;
|
|
20
|
-
this.translations = translations;
|
|
21
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
* Contenitore delle localizzazioni collegate ad un testo "base", una per ogni linguaggio supportato
|
|
8
|
+
*/
|
|
9
|
+
class ItemLocalization {
|
|
10
|
+
/**
|
|
11
|
+
* Costruttore
|
|
12
|
+
*
|
|
13
|
+
* @param {boolean} token Indica se è un token o se è un testo
|
|
14
|
+
* @param {string} baseText Testo base che verrà richiesto quando verrà cercata la localizzazione
|
|
15
|
+
* @param {SpecializedLocalization[]} translations Lista di traduzioni in base al testo base
|
|
16
|
+
*/
|
|
17
|
+
constructor(token, baseText, translations) {
|
|
18
|
+
this.token = token;
|
|
19
|
+
this.baseText = baseText;
|
|
20
|
+
this.translations = translations;
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Classe che rappresenta un locale (Es. 'Italiano') con i propri alias (Es. 'it' oppure 'it-IT')
|
|
26
|
-
*/
|
|
27
|
-
class LocaleObject {
|
|
28
|
-
/**
|
|
29
|
-
* Costruttore
|
|
30
|
-
*
|
|
31
|
-
* @param {string} id Codice locale
|
|
32
|
-
* @param {string} description Descrizione locale
|
|
33
|
-
* @param {string[]} aliases Alias con cui quel locale è conosciuto
|
|
34
|
-
* @param {string} smallVersion Versione standard "small" del locale. Es. "it-IT" -> "it"
|
|
35
|
-
*/
|
|
36
|
-
constructor(id, description, aliases, smallVersion) {
|
|
37
|
-
this.id = id;
|
|
38
|
-
this.description = description;
|
|
39
|
-
this.aliases = aliases;
|
|
40
|
-
this.smallVersion = smallVersion;
|
|
41
|
-
}
|
|
24
|
+
/**
|
|
25
|
+
* Classe che rappresenta un locale (Es. 'Italiano') con i propri alias (Es. 'it' oppure 'it-IT')
|
|
26
|
+
*/
|
|
27
|
+
class LocaleObject {
|
|
28
|
+
/**
|
|
29
|
+
* Costruttore
|
|
30
|
+
*
|
|
31
|
+
* @param {string} id Codice locale
|
|
32
|
+
* @param {string} description Descrizione locale
|
|
33
|
+
* @param {string[]} aliases Alias con cui quel locale è conosciuto
|
|
34
|
+
* @param {string} smallVersion Versione standard "small" del locale. Es. "it-IT" -> "it"
|
|
35
|
+
*/
|
|
36
|
+
constructor(id, description, aliases, smallVersion) {
|
|
37
|
+
this.id = id;
|
|
38
|
+
this.description = description;
|
|
39
|
+
this.aliases = aliases;
|
|
40
|
+
this.smallVersion = smallVersion;
|
|
41
|
+
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
/** Classe che gestisce le definizioni dei locali disponibili */
|
|
45
|
-
class LocaleDefinitions {
|
|
46
|
-
/** Cache per ottimizzare la chiamata **getByAlias** */
|
|
47
|
-
static { this.LocaleCache = {}; }
|
|
48
|
-
/** @ignore Costruttore */
|
|
49
|
-
constructor() { }
|
|
50
|
-
/** Lista dei locali disponibili, definiti anche con i vari alias */
|
|
51
|
-
static { this.AvailableLocales = [
|
|
52
|
-
new LocaleObject('it-IT', 'Italiano', ['it', 'it-IT'], "it"),
|
|
53
|
-
new LocaleObject('en-US', 'English', ['en', 'en-US'], "en")
|
|
54
|
-
]; }
|
|
55
|
-
/**
|
|
56
|
-
* In base a un alias restituisce il locale rappresentato
|
|
57
|
-
*
|
|
58
|
-
* @param {string} alias Alias in base al quale raccogliere il Locale
|
|
59
|
-
*
|
|
60
|
-
* @returns {LocaleObject} Locale richiesto dall'alias
|
|
61
|
-
*/
|
|
62
|
-
static getByAlias(alias) {
|
|
63
|
-
if (!this.LocaleCache[alias])
|
|
64
|
-
this.LocaleCache[alias] = this.AvailableLocales.find(t => !!t.aliases.find(a => a == alias));
|
|
65
|
-
return this.LocaleCache[alias];
|
|
66
|
-
}
|
|
44
|
+
/** Classe che gestisce le definizioni dei locali disponibili */
|
|
45
|
+
class LocaleDefinitions {
|
|
46
|
+
/** Cache per ottimizzare la chiamata **getByAlias** */
|
|
47
|
+
static { this.LocaleCache = {}; }
|
|
48
|
+
/** @ignore Costruttore */
|
|
49
|
+
constructor() { }
|
|
50
|
+
/** Lista dei locali disponibili, definiti anche con i vari alias */
|
|
51
|
+
static { this.AvailableLocales = [
|
|
52
|
+
new LocaleObject('it-IT', 'Italiano', ['it', 'it-IT'], "it"),
|
|
53
|
+
new LocaleObject('en-US', 'English', ['en', 'en-US'], "en")
|
|
54
|
+
]; }
|
|
55
|
+
/**
|
|
56
|
+
* In base a un alias restituisce il locale rappresentato
|
|
57
|
+
*
|
|
58
|
+
* @param {string} alias Alias in base al quale raccogliere il Locale
|
|
59
|
+
*
|
|
60
|
+
* @returns {LocaleObject} Locale richiesto dall'alias
|
|
61
|
+
*/
|
|
62
|
+
static getByAlias(alias) {
|
|
63
|
+
if (!this.LocaleCache[alias])
|
|
64
|
+
this.LocaleCache[alias] = this.AvailableLocales.find(t => !!t.aliases.find(a => a == alias));
|
|
65
|
+
return this.LocaleCache[alias];
|
|
66
|
+
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* Classe che rappresenta la localizzazione di un test base per una certa lingua
|
|
71
|
-
*/
|
|
72
|
-
class SpecializedLocalization {
|
|
73
|
-
/**
|
|
74
|
-
* Costruttore
|
|
75
|
-
*
|
|
76
|
-
* @param {string} culture Culture della traduzione
|
|
77
|
-
* @param {string} translation Traduzione nella lingua specificata dalla **culture**
|
|
78
|
-
*/
|
|
79
|
-
constructor(culture, translation) {
|
|
80
|
-
this.culture = culture;
|
|
81
|
-
this.translation = translation;
|
|
82
|
-
}
|
|
69
|
+
/**
|
|
70
|
+
* Classe che rappresenta la localizzazione di un test base per una certa lingua
|
|
71
|
+
*/
|
|
72
|
+
class SpecializedLocalization {
|
|
73
|
+
/**
|
|
74
|
+
* Costruttore
|
|
75
|
+
*
|
|
76
|
+
* @param {string} culture Culture della traduzione
|
|
77
|
+
* @param {string} translation Traduzione nella lingua specificata dalla **culture**
|
|
78
|
+
*/
|
|
79
|
+
constructor(culture, translation) {
|
|
80
|
+
this.culture = culture;
|
|
81
|
+
this.translation = translation;
|
|
82
|
+
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
class LocalizationPersistor {
|
|
86
|
-
constructor(LocCache = null) {
|
|
87
|
-
this.LocCache = LocCache;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Imposta la localizzazione di un token all'interno della cache scelta
|
|
91
|
-
*
|
|
92
|
-
* @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.
|
|
93
|
-
* Ad esempio, "en->it" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right**
|
|
94
|
-
* è 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"
|
|
95
|
-
* @param {string} token Nome del token
|
|
96
|
-
* @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**
|
|
97
|
-
* @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**
|
|
98
|
-
*/
|
|
99
|
-
setToken(direction, token, left, right) {
|
|
100
|
-
let parsingRegex = /([a-zA-Z]+)[\s]*->[\s]*([a-zA-Z,\s]+)+/g;
|
|
101
|
-
var parsingRes = parsingRegex.exec(direction);
|
|
102
|
-
let from = parsingRes[1];
|
|
103
|
-
let to = parsingRes[2].replace(/\s/g, '').split(',');
|
|
104
|
-
let localeFrom = LocaleDefinitions.getByAlias(from);
|
|
105
|
-
this._set(token, localeFrom.id, left, true);
|
|
106
|
-
to.forEach((t, index) => {
|
|
107
|
-
let localeTo = LocaleDefinitions.getByAlias(t);
|
|
108
|
-
this._set(token, localeTo.id, right[index], true);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Imposta la localizzazione di una frase all'interno della cache scelta
|
|
113
|
-
*
|
|
114
|
-
* @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.
|
|
115
|
-
* Ad esempio, "en->it" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right**
|
|
116
|
-
* è 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"
|
|
117
|
-
* @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**
|
|
118
|
-
* @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**
|
|
119
|
-
*/
|
|
120
|
-
set(direction, left, right) {
|
|
121
|
-
let parsingRegex = /([a-zA-Z]+)[\s]*->[\s]*([a-zA-Z,\s]+)+/g;
|
|
122
|
-
var parsingRes = parsingRegex.exec(direction);
|
|
123
|
-
let from = parsingRes[1];
|
|
124
|
-
let to = parsingRes[2].replace(/\s/g, '').split(',');
|
|
125
|
-
let localeFrom = LocaleDefinitions.getByAlias(from);
|
|
126
|
-
this._set(left, localeFrom.id, left);
|
|
127
|
-
to.forEach((t, index) => {
|
|
128
|
-
let localeTo = LocaleDefinitions.getByAlias(t);
|
|
129
|
-
this._set(left, localeTo.id, right[index]);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Imposta all'interno della cache specificata un'unica traduzione partendo da un testo di base
|
|
134
|
-
*
|
|
135
|
-
* @param {string} text Testo da tradurre
|
|
136
|
-
* @param {string} culture Lingua per cui inserire la traduzione
|
|
137
|
-
* @param {string} translation Traduzione del **text** nella lingua specificata da **culture**
|
|
138
|
-
* @param {boolean} token Indica se il **text** è un token o è una frase normale
|
|
139
|
-
*/
|
|
140
|
-
_set(text, culture, translation, token) {
|
|
141
|
-
let item = this.get(text, token);
|
|
142
|
-
if (!item) {
|
|
143
|
-
this.LocCache[text] = new ItemLocalization(token, text, [new SpecializedLocalization(culture, translation)]);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
var trs = this.translationByCulture(item, culture);
|
|
147
|
-
if (trs) {
|
|
148
|
-
console.warn("Localization already loaded for sentence '" + text + "' and culture " + culture);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
item.translations.push(new SpecializedLocalization(culture, translation));
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Partendo da una cache di localizzazione, dato un testo che può essere o meno un token, cerca quell'elemento all'interno della cache
|
|
155
|
-
*
|
|
156
|
-
* @param {string} text Testo da cercare nella **LocCache**
|
|
157
|
-
* @param {boolean} allowtokens Indica se l'elemento cercato può essere un token o se dev'essere per forza una frase (per evitare rari
|
|
158
|
-
* casi di collisione in cui magari un token è uguale a una frase tradotta)
|
|
159
|
-
*
|
|
160
|
-
* @returns {ItemLocalization} Informazioni di localizzazione per il **text** cercato
|
|
161
|
-
*/
|
|
162
|
-
get(text, allowtokens) {
|
|
163
|
-
let possibleItem = this.LocCache[text];
|
|
164
|
-
var item = possibleItem && (allowtokens || !possibleItem.token) ? possibleItem : null;
|
|
165
|
-
return item;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Date le informazioni di localizzazione per un testo cerca e restituisce la traduzione per una lingua specifica
|
|
169
|
-
*
|
|
170
|
-
* @param {ItemLocalization} Informazioni di localizzazione
|
|
171
|
-
* @param {string} culture Lingua della traduzione richiesta
|
|
172
|
-
*
|
|
173
|
-
* @returns {SpecializedLocalization} Informazioni di localizzazione specifiche della lingua richiesta
|
|
174
|
-
*/
|
|
175
|
-
translationByCulture(item, culture) {
|
|
176
|
-
for (let i = 0; i < item.translations.length; i++) {
|
|
177
|
-
let trl = item.translations[i];
|
|
178
|
-
if (trl.culture == culture)
|
|
179
|
-
return trl;
|
|
180
|
-
}
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
85
|
+
class LocalizationPersistor {
|
|
86
|
+
constructor(LocCache = null) {
|
|
87
|
+
this.LocCache = LocCache;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Imposta la localizzazione di un token all'interno della cache scelta
|
|
91
|
+
*
|
|
92
|
+
* @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.
|
|
93
|
+
* Ad esempio, "en->it" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right**
|
|
94
|
+
* è 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"
|
|
95
|
+
* @param {string} token Nome del token
|
|
96
|
+
* @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**
|
|
97
|
+
* @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**
|
|
98
|
+
*/
|
|
99
|
+
setToken(direction, token, left, right) {
|
|
100
|
+
let parsingRegex = /([a-zA-Z]+)[\s]*->[\s]*([a-zA-Z,\s]+)+/g;
|
|
101
|
+
var parsingRes = parsingRegex.exec(direction);
|
|
102
|
+
let from = parsingRes[1];
|
|
103
|
+
let to = parsingRes[2].replace(/\s/g, '').split(',');
|
|
104
|
+
let localeFrom = LocaleDefinitions.getByAlias(from);
|
|
105
|
+
this._set(token, localeFrom.id, left, true);
|
|
106
|
+
to.forEach((t, index) => {
|
|
107
|
+
let localeTo = LocaleDefinitions.getByAlias(t);
|
|
108
|
+
this._set(token, localeTo.id, right[index], true);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Imposta la localizzazione di una frase all'interno della cache scelta
|
|
113
|
+
*
|
|
114
|
+
* @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.
|
|
115
|
+
* Ad esempio, "en->it" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right**
|
|
116
|
+
* è 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"
|
|
117
|
+
* @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**
|
|
118
|
+
* @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**
|
|
119
|
+
*/
|
|
120
|
+
set(direction, left, right) {
|
|
121
|
+
let parsingRegex = /([a-zA-Z]+)[\s]*->[\s]*([a-zA-Z,\s]+)+/g;
|
|
122
|
+
var parsingRes = parsingRegex.exec(direction);
|
|
123
|
+
let from = parsingRes[1];
|
|
124
|
+
let to = parsingRes[2].replace(/\s/g, '').split(',');
|
|
125
|
+
let localeFrom = LocaleDefinitions.getByAlias(from);
|
|
126
|
+
this._set(left, localeFrom.id, left);
|
|
127
|
+
to.forEach((t, index) => {
|
|
128
|
+
let localeTo = LocaleDefinitions.getByAlias(t);
|
|
129
|
+
this._set(left, localeTo.id, right[index]);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Imposta all'interno della cache specificata un'unica traduzione partendo da un testo di base
|
|
134
|
+
*
|
|
135
|
+
* @param {string} text Testo da tradurre
|
|
136
|
+
* @param {string} culture Lingua per cui inserire la traduzione
|
|
137
|
+
* @param {string} translation Traduzione del **text** nella lingua specificata da **culture**
|
|
138
|
+
* @param {boolean} token Indica se il **text** è un token o è una frase normale
|
|
139
|
+
*/
|
|
140
|
+
_set(text, culture, translation, token) {
|
|
141
|
+
let item = this.get(text, token);
|
|
142
|
+
if (!item) {
|
|
143
|
+
this.LocCache[text] = new ItemLocalization(token, text, [new SpecializedLocalization(culture, translation)]);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
var trs = this.translationByCulture(item, culture);
|
|
147
|
+
if (trs) {
|
|
148
|
+
console.warn("Localization already loaded for sentence '" + text + "' and culture " + culture);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
item.translations.push(new SpecializedLocalization(culture, translation));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Partendo da una cache di localizzazione, dato un testo che può essere o meno un token, cerca quell'elemento all'interno della cache
|
|
155
|
+
*
|
|
156
|
+
* @param {string} text Testo da cercare nella **LocCache**
|
|
157
|
+
* @param {boolean} allowtokens Indica se l'elemento cercato può essere un token o se dev'essere per forza una frase (per evitare rari
|
|
158
|
+
* casi di collisione in cui magari un token è uguale a una frase tradotta)
|
|
159
|
+
*
|
|
160
|
+
* @returns {ItemLocalization} Informazioni di localizzazione per il **text** cercato
|
|
161
|
+
*/
|
|
162
|
+
get(text, allowtokens) {
|
|
163
|
+
let possibleItem = this.LocCache[text];
|
|
164
|
+
var item = possibleItem && (allowtokens || !possibleItem.token) ? possibleItem : null;
|
|
165
|
+
return item;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Date le informazioni di localizzazione per un testo cerca e restituisce la traduzione per una lingua specifica
|
|
169
|
+
*
|
|
170
|
+
* @param {ItemLocalization} Informazioni di localizzazione
|
|
171
|
+
* @param {string} culture Lingua della traduzione richiesta
|
|
172
|
+
*
|
|
173
|
+
* @returns {SpecializedLocalization} Informazioni di localizzazione specifiche della lingua richiesta
|
|
174
|
+
*/
|
|
175
|
+
translationByCulture(item, culture) {
|
|
176
|
+
for (let i = 0; i < item.translations.length; i++) {
|
|
177
|
+
let trl = item.translations[i];
|
|
178
|
+
if (trl.culture == culture)
|
|
179
|
+
return trl;
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
var BaseLocalizationTokens;
|
|
186
|
-
(function (BaseLocalizationTokens) {
|
|
187
|
-
BaseLocalizationTokens["getDateMonthPosition"] = "getDateMonthPosition";
|
|
188
|
-
BaseLocalizationTokens["getDisplayDateMonthPosition"] = "getDisplayDateMonthPosition";
|
|
189
|
-
BaseLocalizationTokens["getLocale"] = "getLocale";
|
|
190
|
-
BaseLocalizationTokens["getSmallDateFormat"] = "getSmallDateFormat";
|
|
191
|
-
BaseLocalizationTokens["getDefaultDateFormat"] = "getDefaultDateFormat";
|
|
192
|
-
BaseLocalizationTokens["getSmallDateDisplayFormat"] = "getSmallDateDisplayFormat";
|
|
193
|
-
BaseLocalizationTokens["getFullDateFormat"] = "getFullDateFormat";
|
|
194
|
-
BaseLocalizationTokens["getFullDateDisplayFormat"] = "getFullDateDisplayFormat";
|
|
195
|
-
BaseLocalizationTokens["getFullDateFormatNoSeconds"] = "getFullDateFormatNoSeconds";
|
|
196
|
-
BaseLocalizationTokens["getFullDateDisplayFormatNoSeconds"] = "getFullDateDisplayFormatNoSeconds";
|
|
185
|
+
var BaseLocalizationTokens;
|
|
186
|
+
(function (BaseLocalizationTokens) {
|
|
187
|
+
BaseLocalizationTokens["getDateMonthPosition"] = "getDateMonthPosition";
|
|
188
|
+
BaseLocalizationTokens["getDisplayDateMonthPosition"] = "getDisplayDateMonthPosition";
|
|
189
|
+
BaseLocalizationTokens["getLocale"] = "getLocale";
|
|
190
|
+
BaseLocalizationTokens["getSmallDateFormat"] = "getSmallDateFormat";
|
|
191
|
+
BaseLocalizationTokens["getDefaultDateFormat"] = "getDefaultDateFormat";
|
|
192
|
+
BaseLocalizationTokens["getSmallDateDisplayFormat"] = "getSmallDateDisplayFormat";
|
|
193
|
+
BaseLocalizationTokens["getFullDateFormat"] = "getFullDateFormat";
|
|
194
|
+
BaseLocalizationTokens["getFullDateDisplayFormat"] = "getFullDateDisplayFormat";
|
|
195
|
+
BaseLocalizationTokens["getFullDateFormatNoSeconds"] = "getFullDateFormatNoSeconds";
|
|
196
|
+
BaseLocalizationTokens["getFullDateDisplayFormatNoSeconds"] = "getFullDateDisplayFormatNoSeconds";
|
|
197
197
|
})(BaseLocalizationTokens || (BaseLocalizationTokens = {}));
|
|
198
198
|
|
|
199
|
-
/** Locale da utilizzare per le traduzioni */
|
|
200
|
-
const LOC_LOCALE = new InjectionToken('LOC_LOCALE');
|
|
201
|
-
/** Policy da utilizzare per traduzioni mancanti */
|
|
202
|
-
const LOC_MISSING_POLICY = new InjectionToken('LOC_MISSING_POLICY');
|
|
203
|
-
/** Modalità di Debug */
|
|
199
|
+
/** Locale da utilizzare per le traduzioni */
|
|
200
|
+
const LOC_LOCALE = new InjectionToken('LOC_LOCALE');
|
|
201
|
+
/** Policy da utilizzare per traduzioni mancanti */
|
|
202
|
+
const LOC_MISSING_POLICY = new InjectionToken('LOC_MISSING_POLICY');
|
|
203
|
+
/** Modalità di Debug */
|
|
204
204
|
const LOC_DEBUG_MODE = new InjectionToken('LOC_DEBUG_MODE');
|
|
205
205
|
|
|
206
|
-
/** Classe astratta che rappresenta lo stato di persistenza fra la libreria e uno storage */
|
|
207
|
-
class LocalePersistor {
|
|
208
|
-
constructor() {
|
|
209
|
-
/** Chiave su cui salvare il locale */
|
|
210
|
-
this.LOCALE = "LOCALE";
|
|
211
|
-
}
|
|
206
|
+
/** Classe astratta che rappresenta lo stato di persistenza fra la libreria e uno storage */
|
|
207
|
+
class LocalePersistor {
|
|
208
|
+
constructor() {
|
|
209
|
+
/** Chiave su cui salvare il locale */
|
|
210
|
+
this.LOCALE = "LOCALE";
|
|
211
|
+
}
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
/**
|
|
215
|
-
* Classe singleton che contiene le traduzioni di base (per evitare di ripeterle in oggi classe di traduzione) e le funzioni base per
|
|
216
|
-
* inserire e leggere traduzioni in/da una cache
|
|
217
|
-
*/
|
|
218
|
-
class BaseLocalization {
|
|
219
|
-
/**
|
|
220
|
-
* Costruttore. Da qui utilizzando il metodo statico **BaseLocalization.set** si va a popolare la cache delle traduzioni **BaseTranslations**
|
|
221
|
-
*/
|
|
222
|
-
constructor(LocalePersistor, defaultLocale) {
|
|
223
|
-
this.LocalePersistor = LocalePersistor;
|
|
224
|
-
/**
|
|
225
|
-
* Cache di tutte le localizzazioni di base
|
|
226
|
-
*/
|
|
227
|
-
this.LocCache = {};
|
|
228
|
-
/**
|
|
229
|
-
* Locale di riferimento per tutte le traduzioni
|
|
230
|
-
*/
|
|
231
|
-
this.Locale = new ReplaySubject(1);
|
|
232
|
-
// Recupero il locale alla partenza del BaseLocalization in modo, spero di dare tempo all'applicazione di tirarlo su
|
|
233
|
-
this.LocalePersistor.recover().pipe(take(1)).subscribe(async (l) => {
|
|
234
|
-
if (!l) {
|
|
235
|
-
l = defaultLocale;
|
|
236
|
-
this.LocalePersistor.persist(defaultLocale);
|
|
237
|
-
}
|
|
238
|
-
this.Locale.next(l);
|
|
239
|
-
});
|
|
240
|
-
this.Persistor = new LocalizationPersistor(this.LocCache);
|
|
241
|
-
this.Persistor.set("it->en", "Sì", ["Yes"]);
|
|
242
|
-
this.Persistor.set("it->en", "No", ["No"]);
|
|
243
|
-
this.Persistor.set("it->en", "Errore", ["Error"]);
|
|
244
|
-
this.Persistor.set("it->en", "Avviso", ["Warning"]);
|
|
245
|
-
this.Persistor.set("it->en", "Informazione", ["Information"]);
|
|
246
|
-
this.Persistor.set("it->en", "Salva", ["Save"]);
|
|
247
|
-
this.Persistor.set("it->en", "Indietro", ["Back"]);
|
|
248
|
-
this.Persistor.set("it->en", "Da", ["From"]);
|
|
249
|
-
this.Persistor.set("it->en", "A", ["To"]);
|
|
250
|
-
this.Persistor.set("it->en", "Note", ["Notes"]);
|
|
251
|
-
this.Persistor.set("it->en", "Modifica Note", ["Edit Notes"]);
|
|
252
|
-
this.Persistor.set("it->en", "Annulla", ["Cancel"]);
|
|
253
|
-
this.Persistor.set("it->en", "Conferma", ["Confirm"]);
|
|
254
|
-
this.Persistor.set("it->en", "Visualizza", ["View"]);
|
|
255
|
-
this.Persistor.set("it->en", "Elimina", ["Delete"]);
|
|
256
|
-
this.Persistor.set("it->en", "Chiudi", ["Close"]);
|
|
257
|
-
this.Persistor.set("it->en", "Seleziona", ["Select"]);
|
|
258
|
-
this.Persistor.set("it->en", "Elettricità", ["Electricity"]);
|
|
259
|
-
this.Persistor.set("it->en", "Gas", ["Gas"]);
|
|
260
|
-
this.Persistor.set("it->en", "Acqua", ["Water"]);
|
|
261
|
-
this.Persistor.set("it->en", "Questa operazione non può essere annullata", ["This operation cannot be reverted"]);
|
|
262
|
-
this.Persistor.set("it->en", "Nascondi", ["Hide"]);
|
|
263
|
-
// Informazioni sulle date
|
|
264
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getDateMonthPosition, "0", ["1"]);
|
|
265
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getDisplayDateMonthPosition, "1", ["1"]);
|
|
266
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getLocale, "en-US", ["it-IT"]);
|
|
267
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getSmallDateFormat, "MM/DD/YYYY", ["DD/MM/YYYY"]);
|
|
268
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getDefaultDateFormat, "MM/DD/YYYY", ["MM/DD/YYYY"]);
|
|
269
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getSmallDateDisplayFormat, "DD/MM/YYYY", ["DD/MM/YYYY"]);
|
|
270
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getFullDateFormat, "MM/DD/YYYY HH:mm:ss", ["DD/MM/YYYY HH:mm:ss"]);
|
|
271
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getFullDateDisplayFormat, "DD/MM/YYYY HH:mm:ss", ["DD/MM/YYYY HH:mm:ss"]);
|
|
272
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getFullDateFormatNoSeconds, "MM/DD/YYYY HH:mm", ["DD/MM/YYYY HH:mm"]);
|
|
273
|
-
this.Persistor.setToken("en->it", BaseLocalizationTokens.getFullDateDisplayFormatNoSeconds, "DD/MM/YYYY HH:mm", ["DD/MM/YYYY HH:mm"]);
|
|
274
|
-
}
|
|
275
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
276
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
277
|
-
}
|
|
278
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
279
|
-
type: Injectable,
|
|
280
|
-
args: [{ providedIn: 'root' }]
|
|
281
|
-
}], ctorParameters:
|
|
282
|
-
type: Inject,
|
|
283
|
-
args: [LOC_LOCALE]
|
|
284
|
-
}] }]
|
|
214
|
+
/**
|
|
215
|
+
* Classe singleton che contiene le traduzioni di base (per evitare di ripeterle in oggi classe di traduzione) e le funzioni base per
|
|
216
|
+
* inserire e leggere traduzioni in/da una cache
|
|
217
|
+
*/
|
|
218
|
+
class BaseLocalization {
|
|
219
|
+
/**
|
|
220
|
+
* Costruttore. Da qui utilizzando il metodo statico **BaseLocalization.set** si va a popolare la cache delle traduzioni **BaseTranslations**
|
|
221
|
+
*/
|
|
222
|
+
constructor(LocalePersistor, defaultLocale) {
|
|
223
|
+
this.LocalePersistor = LocalePersistor;
|
|
224
|
+
/**
|
|
225
|
+
* Cache di tutte le localizzazioni di base
|
|
226
|
+
*/
|
|
227
|
+
this.LocCache = {};
|
|
228
|
+
/**
|
|
229
|
+
* Locale di riferimento per tutte le traduzioni
|
|
230
|
+
*/
|
|
231
|
+
this.Locale = new ReplaySubject(1);
|
|
232
|
+
// Recupero il locale alla partenza del BaseLocalization in modo, spero di dare tempo all'applicazione di tirarlo su
|
|
233
|
+
this.LocalePersistor.recover().pipe(take(1)).subscribe(async (l) => {
|
|
234
|
+
if (!l) {
|
|
235
|
+
l = defaultLocale;
|
|
236
|
+
this.LocalePersistor.persist(defaultLocale);
|
|
237
|
+
}
|
|
238
|
+
this.Locale.next(l);
|
|
239
|
+
});
|
|
240
|
+
this.Persistor = new LocalizationPersistor(this.LocCache);
|
|
241
|
+
this.Persistor.set("it->en", "Sì", ["Yes"]);
|
|
242
|
+
this.Persistor.set("it->en", "No", ["No"]);
|
|
243
|
+
this.Persistor.set("it->en", "Errore", ["Error"]);
|
|
244
|
+
this.Persistor.set("it->en", "Avviso", ["Warning"]);
|
|
245
|
+
this.Persistor.set("it->en", "Informazione", ["Information"]);
|
|
246
|
+
this.Persistor.set("it->en", "Salva", ["Save"]);
|
|
247
|
+
this.Persistor.set("it->en", "Indietro", ["Back"]);
|
|
248
|
+
this.Persistor.set("it->en", "Da", ["From"]);
|
|
249
|
+
this.Persistor.set("it->en", "A", ["To"]);
|
|
250
|
+
this.Persistor.set("it->en", "Note", ["Notes"]);
|
|
251
|
+
this.Persistor.set("it->en", "Modifica Note", ["Edit Notes"]);
|
|
252
|
+
this.Persistor.set("it->en", "Annulla", ["Cancel"]);
|
|
253
|
+
this.Persistor.set("it->en", "Conferma", ["Confirm"]);
|
|
254
|
+
this.Persistor.set("it->en", "Visualizza", ["View"]);
|
|
255
|
+
this.Persistor.set("it->en", "Elimina", ["Delete"]);
|
|
256
|
+
this.Persistor.set("it->en", "Chiudi", ["Close"]);
|
|
257
|
+
this.Persistor.set("it->en", "Seleziona", ["Select"]);
|
|
258
|
+
this.Persistor.set("it->en", "Elettricità", ["Electricity"]);
|
|
259
|
+
this.Persistor.set("it->en", "Gas", ["Gas"]);
|
|
260
|
+
this.Persistor.set("it->en", "Acqua", ["Water"]);
|
|
261
|
+
this.Persistor.set("it->en", "Questa operazione non può essere annullata", ["This operation cannot be reverted"]);
|
|
262
|
+
this.Persistor.set("it->en", "Nascondi", ["Hide"]);
|
|
263
|
+
// Informazioni sulle date
|
|
264
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getDateMonthPosition, "0", ["1"]);
|
|
265
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getDisplayDateMonthPosition, "1", ["1"]);
|
|
266
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getLocale, "en-US", ["it-IT"]);
|
|
267
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getSmallDateFormat, "MM/DD/YYYY", ["DD/MM/YYYY"]);
|
|
268
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getDefaultDateFormat, "MM/DD/YYYY", ["MM/DD/YYYY"]);
|
|
269
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getSmallDateDisplayFormat, "DD/MM/YYYY", ["DD/MM/YYYY"]);
|
|
270
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getFullDateFormat, "MM/DD/YYYY HH:mm:ss", ["DD/MM/YYYY HH:mm:ss"]);
|
|
271
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getFullDateDisplayFormat, "DD/MM/YYYY HH:mm:ss", ["DD/MM/YYYY HH:mm:ss"]);
|
|
272
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getFullDateFormatNoSeconds, "MM/DD/YYYY HH:mm", ["DD/MM/YYYY HH:mm"]);
|
|
273
|
+
this.Persistor.setToken("en->it", BaseLocalizationTokens.getFullDateDisplayFormatNoSeconds, "DD/MM/YYYY HH:mm", ["DD/MM/YYYY HH:mm"]);
|
|
274
|
+
}
|
|
275
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: BaseLocalization, deps: [{ token: LocalePersistor }, { token: LOC_LOCALE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
276
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: BaseLocalization, providedIn: 'root' }); }
|
|
277
|
+
}
|
|
278
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: BaseLocalization, decorators: [{
|
|
279
|
+
type: Injectable,
|
|
280
|
+
args: [{ providedIn: 'root' }]
|
|
281
|
+
}], ctorParameters: () => [{ type: LocalePersistor }, { type: undefined, decorators: [{
|
|
282
|
+
type: Inject,
|
|
283
|
+
args: [LOC_LOCALE]
|
|
284
|
+
}] }] });
|
|
285
285
|
|
|
286
|
-
/**
|
|
287
|
-
* Enum che rappresenta le policy di comportamento qualore il sistema di localizzazione non trovi la localizzazione cercata,
|
|
288
|
-
* usare **ThrowException** solo se ci si sente infallibili o si vuole debuggare in maniera approfondita l'applicazione
|
|
289
|
-
*/
|
|
290
|
-
var LocalizationMissingPolicy;
|
|
291
|
-
(function (LocalizationMissingPolicy) {
|
|
292
|
-
LocalizationMissingPolicy[LocalizationMissingPolicy["PrintEmpty"] = 0] = "PrintEmpty";
|
|
293
|
-
LocalizationMissingPolicy[LocalizationMissingPolicy["PrintSource"] = 1] = "PrintSource";
|
|
294
|
-
LocalizationMissingPolicy[LocalizationMissingPolicy["ThrowException"] = 2] = "ThrowException";
|
|
286
|
+
/**
|
|
287
|
+
* Enum che rappresenta le policy di comportamento qualore il sistema di localizzazione non trovi la localizzazione cercata,
|
|
288
|
+
* usare **ThrowException** solo se ci si sente infallibili o si vuole debuggare in maniera approfondita l'applicazione
|
|
289
|
+
*/
|
|
290
|
+
var LocalizationMissingPolicy;
|
|
291
|
+
(function (LocalizationMissingPolicy) {
|
|
292
|
+
LocalizationMissingPolicy[LocalizationMissingPolicy["PrintEmpty"] = 0] = "PrintEmpty";
|
|
293
|
+
LocalizationMissingPolicy[LocalizationMissingPolicy["PrintSource"] = 1] = "PrintSource";
|
|
294
|
+
LocalizationMissingPolicy[LocalizationMissingPolicy["ThrowException"] = 2] = "ThrowException";
|
|
295
295
|
})(LocalizationMissingPolicy || (LocalizationMissingPolicy = {}));
|
|
296
296
|
|
|
297
|
-
/**
|
|
298
|
-
* Classe di localizzazione estendibile che permette di specificare le proprie localizzazioni e comunque rendere disponibili le localizzazioni globali
|
|
299
|
-
*/
|
|
300
|
-
class LocalizationService {
|
|
301
|
-
/**
|
|
302
|
-
* Costruttore
|
|
303
|
-
*
|
|
304
|
-
* @param {string} Locale Locale da utilizzare nel momento che questo servizio richiede le traduzioni
|
|
305
|
-
* @param {baseLocalization} baseLocalization Classe base di localizzazione già fornita a livello di root dalla libreria stessa.
|
|
306
|
-
* È sufficiente iniettarla nell'eventuale costruttore che estende questa classe e passarla as-is
|
|
307
|
-
*/
|
|
308
|
-
constructor(injector) {
|
|
309
|
-
this.injector = injector;
|
|
310
|
-
/**
|
|
311
|
-
* Cache di tutte le localizzazioni disonibili all'interno di questa classe
|
|
312
|
-
*/
|
|
313
|
-
this.TranslationCache = {};
|
|
314
|
-
this.LocalePersistor = this.injector.get(LocalePersistor);
|
|
315
|
-
this.baseLocalization = this.injector.get(BaseLocalization);
|
|
316
|
-
this.onMissing = this.injector.get(LOC_MISSING_POLICY);
|
|
317
|
-
this.Persistor = new LocalizationPersistor(this.TranslationCache);
|
|
318
|
-
this.baseLocalization.Locale.subscribe(lr => {
|
|
319
|
-
this.Locale = lr;
|
|
320
|
-
this.SmallLocale = LocaleDefinitions.getByAlias(lr).smallVersion;
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Genera un nuovo servizio di localizzazione data una classe in modo che le localizzazioni non siano più solo da provide-are a livello di componente, ma possano
|
|
325
|
-
* anche essere create al volo dal componente/servizio/qualsiasicosa che le deve utilizzare
|
|
326
|
-
*
|
|
327
|
-
* @param {Type<LocalizationService>} lcst Classe da usare per crare il nuovo servizio di localizzazione
|
|
328
|
-
*/
|
|
329
|
-
generateFromType(lcst) {
|
|
330
|
-
const injector = Injector.create({
|
|
331
|
-
providers: [
|
|
332
|
-
{ provide: LOC_MISSING_POLICY, useValue: this.onMissing },
|
|
333
|
-
{ provide: BaseLocalization, useValue: this.baseLocalization },
|
|
334
|
-
{ provide: LocalePersistor, useValue: this.LocalePersistor },
|
|
335
|
-
{ provide: LocalizationService, useClass: lcst }
|
|
336
|
-
]
|
|
337
|
-
});
|
|
338
|
-
return injector.get(LocalizationService);
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Imposta la localizzazione di un token all'interno della **TranslationCache**
|
|
342
|
-
*
|
|
343
|
-
* @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.
|
|
344
|
-
* Ad esempio, "en->it" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right**
|
|
345
|
-
* è 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"
|
|
346
|
-
* @param {string} token Nome del token
|
|
347
|
-
* @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**
|
|
348
|
-
* @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**
|
|
349
|
-
*/
|
|
350
|
-
setToken(direction, token, left, right) {
|
|
351
|
-
this.Persistor.setToken(direction, token, left, right);
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Imposta la localizzazione di una frase all'interno della **TranslationCache**
|
|
355
|
-
*
|
|
356
|
-
* @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.
|
|
357
|
-
* Ad esempio, "en->it" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right**
|
|
358
|
-
* è 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"
|
|
359
|
-
* @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**
|
|
360
|
-
* @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**
|
|
361
|
-
*/
|
|
362
|
-
set(direction, left, right) {
|
|
363
|
-
// Controlla di non reinserire la stessa localizzazione presente nel BaseLocalization
|
|
364
|
-
// i controlli per il non reinserimento della stessa localizzazione all'interno della stessa istanza è fatto lato Persistor
|
|
365
|
-
if (this.baseLocalization.Persistor.get(left, false)) {
|
|
366
|
-
console.warn(`La localizzazione per ${left} è già presente fra le localizzazioni base, ignoro l'operazione`);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
this.Persistor.set(direction, left, right);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Localizza un token
|
|
373
|
-
*
|
|
374
|
-
* @param {string} text Il token da localizzare
|
|
375
|
-
*
|
|
376
|
-
* @returns {string} Token localizzato
|
|
377
|
-
*/
|
|
378
|
-
token(text) {
|
|
379
|
-
return this.loc(text, true);
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Localizza una frase
|
|
383
|
-
*
|
|
384
|
-
* @param {string} text Frase da localizzare
|
|
385
|
-
* @param {boolean} allowtokens Indica se la frase **text** potrebbe essere un token o no
|
|
386
|
-
*
|
|
387
|
-
* @returns {string} Frase localizzata
|
|
388
|
-
*/
|
|
389
|
-
loc(text, allowtokens) {
|
|
390
|
-
if (!this.Locale)
|
|
391
|
-
throw "Il sistema di localizzazione non ha ancora caricato il Locale, assicurarsi di caricare l'APP solo al retrieve del locale'";
|
|
392
|
-
if (!text || text == "undefined")
|
|
393
|
-
return "";
|
|
394
|
-
// Prendo la localizzazione o dalla cache attuale o dalla cache del servizio base
|
|
395
|
-
var item = this.Persistor.get(text, allowtokens) || this.baseLocalization.Persistor.get(text, allowtokens);
|
|
396
|
-
if (!item) {
|
|
397
|
-
let message = `Impossibile trovare la localizzazione per '${text}'`;
|
|
398
|
-
switch (this.onMissing) {
|
|
399
|
-
case LocalizationMissingPolicy.PrintEmpty:
|
|
400
|
-
console.error(message);
|
|
401
|
-
return "";
|
|
402
|
-
case LocalizationMissingPolicy.PrintSource:
|
|
403
|
-
console.warn(message);
|
|
404
|
-
return text;
|
|
405
|
-
case LocalizationMissingPolicy.ThrowException:
|
|
406
|
-
throw message;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
var loc = this.Persistor.translationByCulture(item, this.Locale);
|
|
410
|
-
if (!loc) {
|
|
411
|
-
console.error("Impossibile trovare la localizzazione per '" + text + "', culture " + this.Locale);
|
|
412
|
-
return "";
|
|
413
|
-
}
|
|
414
|
-
return loc.translation;
|
|
415
|
-
}
|
|
416
|
-
async changeLocale(newLocale) {
|
|
417
|
-
let locale = await this.LocalePersistor.recover().toPromise();
|
|
418
|
-
if (newLocale == locale) {
|
|
419
|
-
console.info("Il locale richiesto è lo stesso del locale attuale. Ignoro l'operazione");
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
else {
|
|
423
|
-
await this.LocalePersistor.persist(newLocale).toPromise();
|
|
424
|
-
location.reload();
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
428
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
429
|
-
}
|
|
430
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
431
|
-
type: Injectable
|
|
432
|
-
}], ctorParameters:
|
|
297
|
+
/**
|
|
298
|
+
* Classe di localizzazione estendibile che permette di specificare le proprie localizzazioni e comunque rendere disponibili le localizzazioni globali
|
|
299
|
+
*/
|
|
300
|
+
class LocalizationService {
|
|
301
|
+
/**
|
|
302
|
+
* Costruttore
|
|
303
|
+
*
|
|
304
|
+
* @param {string} Locale Locale da utilizzare nel momento che questo servizio richiede le traduzioni
|
|
305
|
+
* @param {baseLocalization} baseLocalization Classe base di localizzazione già fornita a livello di root dalla libreria stessa.
|
|
306
|
+
* È sufficiente iniettarla nell'eventuale costruttore che estende questa classe e passarla as-is
|
|
307
|
+
*/
|
|
308
|
+
constructor(injector) {
|
|
309
|
+
this.injector = injector;
|
|
310
|
+
/**
|
|
311
|
+
* Cache di tutte le localizzazioni disonibili all'interno di questa classe
|
|
312
|
+
*/
|
|
313
|
+
this.TranslationCache = {};
|
|
314
|
+
this.LocalePersistor = this.injector.get(LocalePersistor);
|
|
315
|
+
this.baseLocalization = this.injector.get(BaseLocalization);
|
|
316
|
+
this.onMissing = this.injector.get(LOC_MISSING_POLICY);
|
|
317
|
+
this.Persistor = new LocalizationPersistor(this.TranslationCache);
|
|
318
|
+
this.baseLocalization.Locale.subscribe(lr => {
|
|
319
|
+
this.Locale = lr;
|
|
320
|
+
this.SmallLocale = LocaleDefinitions.getByAlias(lr).smallVersion;
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Genera un nuovo servizio di localizzazione data una classe in modo che le localizzazioni non siano più solo da provide-are a livello di componente, ma possano
|
|
325
|
+
* anche essere create al volo dal componente/servizio/qualsiasicosa che le deve utilizzare
|
|
326
|
+
*
|
|
327
|
+
* @param {Type<LocalizationService>} lcst Classe da usare per crare il nuovo servizio di localizzazione
|
|
328
|
+
*/
|
|
329
|
+
generateFromType(lcst) {
|
|
330
|
+
const injector = Injector.create({
|
|
331
|
+
providers: [
|
|
332
|
+
{ provide: LOC_MISSING_POLICY, useValue: this.onMissing },
|
|
333
|
+
{ provide: BaseLocalization, useValue: this.baseLocalization },
|
|
334
|
+
{ provide: LocalePersistor, useValue: this.LocalePersistor },
|
|
335
|
+
{ provide: LocalizationService, useClass: lcst }
|
|
336
|
+
]
|
|
337
|
+
});
|
|
338
|
+
return injector.get(LocalizationService);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Imposta la localizzazione di un token all'interno della **TranslationCache**
|
|
342
|
+
*
|
|
343
|
+
* @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.
|
|
344
|
+
* Ad esempio, "en->it" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right**
|
|
345
|
+
* è 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"
|
|
346
|
+
* @param {string} token Nome del token
|
|
347
|
+
* @param {string} left Valore del token per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**
|
|
348
|
+
* @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**
|
|
349
|
+
*/
|
|
350
|
+
setToken(direction, token, left, right) {
|
|
351
|
+
this.Persistor.setToken(direction, token, left, right);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Imposta la localizzazione di una frase all'interno della **TranslationCache**
|
|
355
|
+
*
|
|
356
|
+
* @param {string} direction Direzione della traduzione, rappresenta la lingua base in cui aspettarsi il testo e le varie lingue in cui viene tradotta.
|
|
357
|
+
* Ad esempio, "en->it" indica che il parametro **left** è valido per le localizzazioni in inglese, mentre nell'elemento 0 del parametro **right**
|
|
358
|
+
* è 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"
|
|
359
|
+
* @param {string} left Valore della frase per la lingua specificata nel lato immediatamente sinistro alla freccia del parametro **direction**
|
|
360
|
+
* @param {string} right Array con i valori facenti riferimento all'N-esima lingua del lato destro del parametro **direction**
|
|
361
|
+
*/
|
|
362
|
+
set(direction, left, right) {
|
|
363
|
+
// Controlla di non reinserire la stessa localizzazione presente nel BaseLocalization
|
|
364
|
+
// i controlli per il non reinserimento della stessa localizzazione all'interno della stessa istanza è fatto lato Persistor
|
|
365
|
+
if (this.baseLocalization.Persistor.get(left, false)) {
|
|
366
|
+
console.warn(`La localizzazione per ${left} è già presente fra le localizzazioni base, ignoro l'operazione`);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
this.Persistor.set(direction, left, right);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Localizza un token
|
|
373
|
+
*
|
|
374
|
+
* @param {string} text Il token da localizzare
|
|
375
|
+
*
|
|
376
|
+
* @returns {string} Token localizzato
|
|
377
|
+
*/
|
|
378
|
+
token(text) {
|
|
379
|
+
return this.loc(text, true);
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Localizza una frase
|
|
383
|
+
*
|
|
384
|
+
* @param {string} text Frase da localizzare
|
|
385
|
+
* @param {boolean} allowtokens Indica se la frase **text** potrebbe essere un token o no
|
|
386
|
+
*
|
|
387
|
+
* @returns {string} Frase localizzata
|
|
388
|
+
*/
|
|
389
|
+
loc(text, allowtokens) {
|
|
390
|
+
if (!this.Locale)
|
|
391
|
+
throw "Il sistema di localizzazione non ha ancora caricato il Locale, assicurarsi di caricare l'APP solo al retrieve del locale'";
|
|
392
|
+
if (!text || text == "undefined")
|
|
393
|
+
return "";
|
|
394
|
+
// Prendo la localizzazione o dalla cache attuale o dalla cache del servizio base
|
|
395
|
+
var item = this.Persistor.get(text, allowtokens) || this.baseLocalization.Persistor.get(text, allowtokens);
|
|
396
|
+
if (!item) {
|
|
397
|
+
let message = `Impossibile trovare la localizzazione per '${text}'`;
|
|
398
|
+
switch (this.onMissing) {
|
|
399
|
+
case LocalizationMissingPolicy.PrintEmpty:
|
|
400
|
+
console.error(message);
|
|
401
|
+
return "";
|
|
402
|
+
case LocalizationMissingPolicy.PrintSource:
|
|
403
|
+
console.warn(message);
|
|
404
|
+
return text;
|
|
405
|
+
case LocalizationMissingPolicy.ThrowException:
|
|
406
|
+
throw message;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
var loc = this.Persistor.translationByCulture(item, this.Locale);
|
|
410
|
+
if (!loc) {
|
|
411
|
+
console.error("Impossibile trovare la localizzazione per '" + text + "', culture " + this.Locale);
|
|
412
|
+
return "";
|
|
413
|
+
}
|
|
414
|
+
return loc.translation;
|
|
415
|
+
}
|
|
416
|
+
async changeLocale(newLocale) {
|
|
417
|
+
let locale = await this.LocalePersistor.recover().toPromise();
|
|
418
|
+
if (newLocale == locale) {
|
|
419
|
+
console.info("Il locale richiesto è lo stesso del locale attuale. Ignoro l'operazione");
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
await this.LocalePersistor.persist(newLocale).toPromise();
|
|
424
|
+
location.reload();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalizationService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
428
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalizationService }); }
|
|
429
|
+
}
|
|
430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalizationService, decorators: [{
|
|
431
|
+
type: Injectable
|
|
432
|
+
}], ctorParameters: () => [{ type: i0.Injector }] });
|
|
433
433
|
|
|
434
|
-
// Angular
|
|
435
|
-
/**
|
|
436
|
-
* Pipe di localizzazione per tradurre direttamente da template
|
|
437
|
-
*/
|
|
438
|
-
class LocalizePipe {
|
|
439
|
-
/**
|
|
440
|
-
* Costruttore
|
|
441
|
-
*
|
|
442
|
-
* @param {LocalizationService} translationContainer Container delle traduzioni disponibili nel contesto in cui viene usata la pipe.
|
|
443
|
-
*
|
|
444
|
-
* Viene iniettata dal provider dichiarato nel singolo componente che utilizza la traduzione e, se non esiste, viene iniettato dal default
|
|
445
|
-
*/
|
|
446
|
-
constructor(translationContainer) {
|
|
447
|
-
this.translationContainer = translationContainer;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Trasformazione della stringa in input ad una stringa tradotta
|
|
451
|
-
*
|
|
452
|
-
* @param {string} value Testo da tradurre
|
|
453
|
-
* @param {LocalizationService} locContainerOverride Override al contenitore della traduzione iniettato dal costruttore, qualora serva
|
|
454
|
-
*
|
|
455
|
-
* @returns {string} Frase tradotta
|
|
456
|
-
*/
|
|
457
|
-
transform(value, locContainerOverride) {
|
|
458
|
-
if (value == null || value === "")
|
|
459
|
-
return "";
|
|
460
|
-
return (locContainerOverride || this.translationContainer).loc(value);
|
|
461
|
-
}
|
|
462
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
463
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
464
|
-
}
|
|
465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
466
|
-
type: Pipe,
|
|
467
|
-
args: [{ name: "localize", pure: true }]
|
|
468
|
-
}], ctorParameters:
|
|
434
|
+
// Angular
|
|
435
|
+
/**
|
|
436
|
+
* Pipe di localizzazione per tradurre direttamente da template
|
|
437
|
+
*/
|
|
438
|
+
class LocalizePipe {
|
|
439
|
+
/**
|
|
440
|
+
* Costruttore
|
|
441
|
+
*
|
|
442
|
+
* @param {LocalizationService} translationContainer Container delle traduzioni disponibili nel contesto in cui viene usata la pipe.
|
|
443
|
+
*
|
|
444
|
+
* Viene iniettata dal provider dichiarato nel singolo componente che utilizza la traduzione e, se non esiste, viene iniettato dal default
|
|
445
|
+
*/
|
|
446
|
+
constructor(translationContainer) {
|
|
447
|
+
this.translationContainer = translationContainer;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Trasformazione della stringa in input ad una stringa tradotta
|
|
451
|
+
*
|
|
452
|
+
* @param {string} value Testo da tradurre
|
|
453
|
+
* @param {LocalizationService} locContainerOverride Override al contenitore della traduzione iniettato dal costruttore, qualora serva
|
|
454
|
+
*
|
|
455
|
+
* @returns {string} Frase tradotta
|
|
456
|
+
*/
|
|
457
|
+
transform(value, locContainerOverride) {
|
|
458
|
+
if (value == null || value === "")
|
|
459
|
+
return "";
|
|
460
|
+
return (locContainerOverride || this.translationContainer).loc(value);
|
|
461
|
+
}
|
|
462
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalizePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
463
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: LocalizePipe, name: "localize" }); }
|
|
464
|
+
}
|
|
465
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalizePipe, decorators: [{
|
|
466
|
+
type: Pipe,
|
|
467
|
+
args: [{ name: "localize", pure: true }]
|
|
468
|
+
}], ctorParameters: () => [{ type: LocalizationService }] });
|
|
469
469
|
|
|
470
|
-
// Angular
|
|
471
|
-
class LocalStorageLocalePersistor extends LocalePersistor {
|
|
472
|
-
/** @ignore Vedi classe base */
|
|
473
|
-
persist(locale) {
|
|
474
|
-
localStorage.setItem(this.LOCALE, locale);
|
|
475
|
-
return of(true).pipe(first());
|
|
476
|
-
}
|
|
477
|
-
/** @ignore Vedi classe base */
|
|
478
|
-
recover() {
|
|
479
|
-
var ret = localStorage.getItem(this.LOCALE);
|
|
480
|
-
return of(ret).pipe(first());
|
|
481
|
-
}
|
|
482
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
483
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
484
|
-
}
|
|
485
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
486
|
-
type: Injectable
|
|
470
|
+
// Angular
|
|
471
|
+
class LocalStorageLocalePersistor extends LocalePersistor {
|
|
472
|
+
/** @ignore Vedi classe base */
|
|
473
|
+
persist(locale) {
|
|
474
|
+
localStorage.setItem(this.LOCALE, locale);
|
|
475
|
+
return of(true).pipe(first());
|
|
476
|
+
}
|
|
477
|
+
/** @ignore Vedi classe base */
|
|
478
|
+
recover() {
|
|
479
|
+
var ret = localStorage.getItem(this.LOCALE);
|
|
480
|
+
return of(ret).pipe(first());
|
|
481
|
+
}
|
|
482
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalStorageLocalePersistor, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
483
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalStorageLocalePersistor }); }
|
|
484
|
+
}
|
|
485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalStorageLocalePersistor, decorators: [{
|
|
486
|
+
type: Injectable
|
|
487
487
|
}] });
|
|
488
488
|
|
|
489
|
-
// Angular
|
|
490
|
-
class LocalizationModule {
|
|
491
|
-
static forRoot(config) {
|
|
492
|
-
return {
|
|
493
|
-
ngModule: LocalizationModule,
|
|
494
|
-
providers: [
|
|
495
|
-
LocalizationService,
|
|
496
|
-
BaseLocalization,
|
|
497
|
-
{ provide: LOC_LOCALE, useValue: config?.defaultLocale || 'it-IT' },
|
|
498
|
-
{ provide: LOC_MISSING_POLICY, useValue: config?.localizationMissingPolicy || LocalizationMissingPolicy.PrintEmpty },
|
|
499
|
-
{ provide: LocalePersistor, useClass: config?.localePersistor || LocalStorageLocalePersistor },
|
|
500
|
-
{ provide: LOC_DEBUG_MODE, useValue: config?.debugMode || false },
|
|
501
|
-
]
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
505
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
506
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
507
|
-
}
|
|
508
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
509
|
-
type: NgModule,
|
|
510
|
-
args: [{
|
|
511
|
-
declarations: [LocalizePipe],
|
|
512
|
-
exports: [LocalizePipe]
|
|
513
|
-
}]
|
|
489
|
+
// Angular
|
|
490
|
+
class LocalizationModule {
|
|
491
|
+
static forRoot(config) {
|
|
492
|
+
return {
|
|
493
|
+
ngModule: LocalizationModule,
|
|
494
|
+
providers: [
|
|
495
|
+
LocalizationService,
|
|
496
|
+
BaseLocalization,
|
|
497
|
+
{ provide: LOC_LOCALE, useValue: config?.defaultLocale || 'it-IT' },
|
|
498
|
+
{ provide: LOC_MISSING_POLICY, useValue: config?.localizationMissingPolicy || LocalizationMissingPolicy.PrintEmpty },
|
|
499
|
+
{ provide: LocalePersistor, useClass: config?.localePersistor || LocalStorageLocalePersistor },
|
|
500
|
+
{ provide: LOC_DEBUG_MODE, useValue: config?.debugMode || false },
|
|
501
|
+
]
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
505
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: LocalizationModule, declarations: [LocalizePipe], exports: [LocalizePipe] }); }
|
|
506
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalizationModule }); }
|
|
507
|
+
}
|
|
508
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
509
|
+
type: NgModule,
|
|
510
|
+
args: [{
|
|
511
|
+
declarations: [LocalizePipe],
|
|
512
|
+
exports: [LocalizePipe]
|
|
513
|
+
}]
|
|
514
514
|
}] });
|
|
515
515
|
|
|
516
|
-
/**
|
|
517
|
-
* Classe di configurazione per il modulo di localizzazione
|
|
518
|
-
*/
|
|
519
|
-
class LocalizationModuleConfig {
|
|
516
|
+
/**
|
|
517
|
+
* Classe di configurazione per il modulo di localizzazione
|
|
518
|
+
*/
|
|
519
|
+
class LocalizationModuleConfig {
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
/*
|
|
523
|
-
* Public API Surface of localizations
|
|
522
|
+
/*
|
|
523
|
+
* Public API Surface of localizations
|
|
524
524
|
*/
|
|
525
525
|
|
|
526
|
-
/**
|
|
527
|
-
* Generated bundle index. Do not edit.
|
|
526
|
+
/**
|
|
527
|
+
* Generated bundle index. Do not edit.
|
|
528
528
|
*/
|
|
529
529
|
|
|
530
530
|
export { BaseLocalization, BaseLocalizationTokens, LOC_DEBUG_MODE, LOC_LOCALE, LOC_MISSING_POLICY, LocalizationMissingPolicy, LocalizationModule, LocalizationModuleConfig, LocalizationService, LocalizePipe };
|