@fluid-topics/ft-app-context 1.1.102 → 1.1.103
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.
|
@@ -23,6 +23,8 @@ export declare class FtI18nServiceInternalClass extends FtServiceWithCache {
|
|
|
23
23
|
addContext(context: FtMessageContext): void;
|
|
24
24
|
getAllContexts(): Array<FtMessageContext>;
|
|
25
25
|
prepareContext(name: string, defaultMessages: Record<string, string>): Promise<void>;
|
|
26
|
+
private resolveContext;
|
|
27
|
+
resolveRawMessage(contextName: string, messageKey: string): any;
|
|
26
28
|
resolveMessage(contextName: string, message: string, ...args: any[]): string;
|
|
27
29
|
private fetchContext;
|
|
28
30
|
subscribe(contextName: string, callback: Function): Unsubscribe;
|
|
@@ -53,12 +53,21 @@ export class FtI18nServiceInternalClass extends FtServiceWithCache {
|
|
|
53
53
|
}
|
|
54
54
|
await this.fetchContext(name);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
var _b, _c
|
|
58
|
-
contextName = contextName.toLowerCase();
|
|
56
|
+
resolveContext(contextName) {
|
|
57
|
+
var _b, _c;
|
|
59
58
|
this.fetchContext(contextName);
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
return (_c = (_b = this.cache.getNow(contextName)) === null || _b === void 0 ? void 0 : _b.messages) !== null && _c !== void 0 ? _c : {};
|
|
60
|
+
}
|
|
61
|
+
resolveRawMessage(contextName, messageKey) {
|
|
62
|
+
const lowerCaseContextName = contextName.toLowerCase();
|
|
63
|
+
// They might be limitation when message key depends on parameter (plurals)
|
|
64
|
+
return this.resolveContext(lowerCaseContextName)[messageKey];
|
|
65
|
+
}
|
|
66
|
+
resolveMessage(contextName, message, ...args) {
|
|
67
|
+
var _b;
|
|
68
|
+
const lowerCaseContextName = contextName.toLowerCase();
|
|
69
|
+
const messages = this.resolveContext(lowerCaseContextName);
|
|
70
|
+
return new ParametrizedLabelResolver(((_b = this.defaultMessages[lowerCaseContextName]) !== null && _b !== void 0 ? _b : {}), messages).resolve(message, ...args);
|
|
62
71
|
}
|
|
63
72
|
async fetchContext(name) {
|
|
64
73
|
if (!this.cache.has(name)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-app-context",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.103",
|
|
4
4
|
"description": "Global application context for Fluid Topics integrations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "1.1.103",
|
|
23
23
|
"lit": "3.1.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@fluid-topics/public-api": "1.0.73"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "395d0494bf2cf416b65b0bd3e07875131284cfa9"
|
|
29
29
|
}
|