codenotch-react 1.0.65 → 1.0.66

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.
@@ -1,6 +1,7 @@
1
1
  import { ICodenotchEnv } from "..";
2
2
  export default abstract class I18nUtils {
3
3
  static compileAuml(auml: string, env: ICodenotchEnv): string;
4
+ private static revertI18n;
4
5
  private static injectI18n;
5
6
  }
6
7
  //# sourceMappingURL=I18nUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"I18nUtils.d.ts","sourceRoot":"","sources":["../../src/utils/I18nUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgB,MAAM,IAAI,CAAC;AAEhE,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,SAAS;WAErB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM;IAOnE,OAAO,CAAC,MAAM,CAAC,UAAU;CAqB5B"}
1
+ {"version":3,"file":"I18nUtils.d.ts","sourceRoot":"","sources":["../../src/utils/I18nUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgB,MAAM,IAAI,CAAC;AAEhE,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,SAAS;WAErB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM;IAOnE,OAAO,CAAC,MAAM,CAAC,UAAU;IAkBzB,OAAO,CAAC,MAAM,CAAC,UAAU;CAqB5B"}
@@ -5,8 +5,21 @@ class I18nUtils {
5
5
  auml = this.injectI18n(auml, env);
6
6
  return auml;
7
7
  }
8
+ static revertI18n(i18n) {
9
+ let result = {};
10
+ for (let language in i18n) {
11
+ let translations = i18n[language];
12
+ for (let key in translations) {
13
+ if (!result[key]) {
14
+ result[key] = {};
15
+ }
16
+ result[key][language] = translations[key];
17
+ }
18
+ }
19
+ return result;
20
+ }
8
21
  static injectI18n(auml, env) {
9
- let i18n = env.i18n ?? {};
22
+ let i18n = this.revertI18n(env.i18n ?? {});
10
23
  if (Object.keys(i18n).length === 0) {
11
24
  // No i18n variables, return original auml
12
25
  return auml;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codenotch-react",
3
- "version": "1.0.65",
3
+ "version": "1.0.66",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Codenotch SA",