@flashist/flibs 0.0.217 → 0.0.219
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.
|
@@ -13,5 +13,7 @@ export declare class LocaleManager {
|
|
|
13
13
|
getText(textId: string, params?: any): string;
|
|
14
14
|
protected format(str: string, params?: any): string;
|
|
15
15
|
protected replaceRegExpKeyByStrings(substring: string, group1: string, ...args: any[]): string;
|
|
16
|
+
findAllUniqueCharactersForCurrentLocale(): string[];
|
|
17
|
+
protected getAllTextsOf(textNode: any, result: string[]): void;
|
|
16
18
|
}
|
|
17
19
|
export declare function getText(textId: string, params?: any): string;
|
package/locale/LocaleManager.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StringTools } from "@flashist/fcore";
|
|
1
|
+
import { ObjectTools, StringTools } from "@flashist/fcore";
|
|
2
2
|
import { getInstance } from "../servicelocator/ServiceLocatorShortcuts";
|
|
3
3
|
var LocaleManager = /** @class */ (function () {
|
|
4
4
|
function LocaleManager() {
|
|
@@ -84,6 +84,34 @@ var LocaleManager = /** @class */ (function () {
|
|
|
84
84
|
// return this.currentLocale.texts[group1];
|
|
85
85
|
return this.getText(group1);
|
|
86
86
|
};
|
|
87
|
+
LocaleManager.prototype.findAllUniqueCharactersForCurrentLocale = function () {
|
|
88
|
+
var allTexts = [];
|
|
89
|
+
this.getAllTextsOf(this.currentLocale.texts, allTexts);
|
|
90
|
+
var usedCharactersMap = {};
|
|
91
|
+
var result = [];
|
|
92
|
+
for (var singleText in allTexts) {
|
|
93
|
+
var singleCharsList = Array.from(singleText);
|
|
94
|
+
for (var _i = 0, singleCharsList_1 = singleCharsList; _i < singleCharsList_1.length; _i++) {
|
|
95
|
+
var singleChar = singleCharsList_1[_i];
|
|
96
|
+
if (!usedCharactersMap[singleChar]) {
|
|
97
|
+
usedCharactersMap[singleChar] = true;
|
|
98
|
+
result.push(singleChar);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
};
|
|
104
|
+
LocaleManager.prototype.getAllTextsOf = function (textNode, result) {
|
|
105
|
+
for (var singleKey in textNode) {
|
|
106
|
+
var childNode = textNode[singleKey];
|
|
107
|
+
if (ObjectTools.isObject(childNode)) {
|
|
108
|
+
this.getAllTextsOf(textNode[singleKey], result);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
result.push(textNode[singleKey]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
87
115
|
return LocaleManager;
|
|
88
116
|
}());
|
|
89
117
|
export { LocaleManager };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleManager.js","sourceRoot":"","sources":["../../src/locale/LocaleManager.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LocaleManager.js","sourceRoot":"","sources":["../../src/locale/LocaleManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,WAAW,EACX,WAAW,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAMxE;IAWI;QAJO,iBAAY,GAAY,IAAI,CAAC;QAKhC,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,mCAAmC,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErF,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAEM,iCAAS,GAAhB,UAAiB,IAAmB,EAAE,QAAgB;QAClD,+CAA+C;QAC/C,IAAI,SAAS,GAAkB;YAC3B,KAAK,EAAE,EAAE;SACZ,CAAC;QACF,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC9B,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;SAC5C;QAED,sDAAsD;QACrD,MAAc,CAAC,MAAM,CAClB,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