@itrocks/framework 0.6.5 → 0.6.7
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/cjs/language.js +6 -4
- package/package.json +3 -2
package/cjs/language.js
CHANGED
|
@@ -11,11 +11,13 @@ const translate_2 = require("@itrocks/translate");
|
|
|
11
11
|
const translate_3 = require("@itrocks/translate");
|
|
12
12
|
const node_path_1 = require("node:path");
|
|
13
13
|
let configuration = {
|
|
14
|
-
defaultLanguage: '
|
|
15
|
-
supportedLanguages: ['
|
|
14
|
+
defaultLanguage: 'en-US',
|
|
15
|
+
supportedLanguages: ['en-US']
|
|
16
16
|
};
|
|
17
17
|
let loading = Promise.resolve(undefined);
|
|
18
18
|
function canonicalLanguage(value) {
|
|
19
|
+
if (!value)
|
|
20
|
+
return;
|
|
19
21
|
try {
|
|
20
22
|
return Intl.getCanonicalLocales(value)[0];
|
|
21
23
|
}
|
|
@@ -25,8 +27,8 @@ function canonicalLanguage(value) {
|
|
|
25
27
|
}
|
|
26
28
|
function configureLanguages() {
|
|
27
29
|
const options = (config_1.config.translate ?? {});
|
|
28
|
-
const defaultLanguage = canonicalLanguage(options.defaultLanguage) ??
|
|
29
|
-
const supportedLanguages = options.supportedLanguages
|
|
30
|
+
const defaultLanguage = canonicalLanguage(options.defaultLanguage) ?? configuration.defaultLanguage;
|
|
31
|
+
const supportedLanguages = (options.supportedLanguages ?? configuration.supportedLanguages)
|
|
30
32
|
.map(language => canonicalLanguage(language))
|
|
31
33
|
.filter((language) => !!language);
|
|
32
34
|
if (!supportedLanguages.includes(defaultLanguage)) {
|
package/package.json
CHANGED
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"@itrocks/compose": "latest",
|
|
23
23
|
"@itrocks/composition": "latest",
|
|
24
24
|
"@itrocks/config": "latest",
|
|
25
|
-
"@itrocks/confirm": "latest",
|
|
26
25
|
"@itrocks/contained-auto-width": "latest",
|
|
27
26
|
"@itrocks/core-transformers": "latest",
|
|
27
|
+
"@itrocks/decorator": "latest",
|
|
28
28
|
"@itrocks/default-action-workflow": "latest",
|
|
29
29
|
"@itrocks/fastify": "latest",
|
|
30
30
|
"@itrocks/fastify-file-session-store": "latest",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@itrocks/transformer": "latest",
|
|
57
57
|
"@itrocks/translate": "latest",
|
|
58
58
|
"@itrocks/xtarget": "latest",
|
|
59
|
+
"@itrocks/uses": "latest",
|
|
59
60
|
"air-datepicker": "^3.6",
|
|
60
61
|
"date-fns": "^4.1"
|
|
61
62
|
},
|
|
@@ -103,5 +104,5 @@
|
|
|
103
104
|
"build:front": "tsc -p src/front/tsconfig.json && node -e \"const fs=require('node:fs');for(const file of fs.readdirSync('.').filter(file=>file.endsWith('.js')||file.endsWith('.d.ts')))fs.writeFileSync(file,fs.readFileSync(file,'utf8').replaceAll('../../',''))\"",
|
|
104
105
|
"test": "npm run build && node --test test/*.test.js"
|
|
105
106
|
},
|
|
106
|
-
"version": "0.6.
|
|
107
|
+
"version": "0.6.7"
|
|
107
108
|
}
|