@bigbinary/neeto-commons-frontend 4.13.91 → 4.13.92-beta.1
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/README.md +1 -0
- package/configs/esbuild/index.js +4 -0
- package/configs/esbuild/plugins/packageTranslations.js +16 -0
- package/configs/esbuild/plugins/preval.js +16 -6
- package/configs/scripts/buildTranslationImports.js +22 -0
- package/configs/scripts/getEnglishTranslation.js +17 -0
- package/configs/utils/packageTranslations.js +90 -0
- package/configs/vite/index.js +5 -0
- package/configs/vite/plugins/packageTranslations.js +14 -0
- package/configs/vite/plugins/preval.js +32 -10
- package/dist/cjs/initializers/i18n.js +39 -130
- package/dist/cjs/initializers/i18n.js.map +1 -1
- package/dist/cjs/initializers/index.js +37 -19
- package/dist/cjs/initializers/index.js.map +1 -1
- package/dist/cjs/react-utils/AppContainer/AppContainer.js +2 -2
- package/dist/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +2 -2
- package/dist/cjs/react-utils/index.js +6 -0
- package/dist/cjs/react-utils/index.js.map +1 -1
- package/dist/cjs/react-utils/lazyWithRetry/index.js +10 -0
- package/dist/cjs/react-utils/lazyWithRetry/index.js.map +1 -0
- package/dist/cjs/react-utils/lazyWithRetry/lazyWithRetry.js +15 -0
- package/dist/cjs/react-utils/lazyWithRetry/lazyWithRetry.js.map +1 -0
- package/dist/cjs/react-utils/mount/index.js +15 -0
- package/dist/cjs/react-utils/mount/index.js.map +1 -0
- package/dist/cjs/react-utils/mount/mount.js +86 -0
- package/dist/cjs/react-utils/mount/mount.js.map +1 -0
- package/dist/cjs/react-utils/useBreakpoints/index.js +2 -2
- package/dist/cjs/react-utils/useColumnConfig/useColumnConfig.js +2 -2
- package/dist/cjs/react-utils/useDebounce/useDebounce.js +3 -3
- package/dist/cjs/react-utils/useFieldSubmit/useFieldSubmit.js +4 -4
- package/dist/cjs/react-utils/useFuncDebounce/useFuncDebounce.js +2 -2
- package/dist/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js +2 -2
- package/dist/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +3 -3
- package/dist/cjs/react-utils/useLocalStorage/useLocalStorage.js +2 -2
- package/dist/cjs/react-utils/useOnClickOutside/useOnClickOutside.js +2 -2
- package/dist/cjs/react-utils/usePersistedQuery/usePersistedQuery.js +2 -2
- package/dist/cjs/react-utils/usePrevious/usePrevious.js +3 -3
- package/dist/cjs/react-utils/useRegisterNavigationCheckpoint/useRegisterNavigationCheckpoint.js +2 -2
- package/dist/cjs/react-utils/useRestoreScrollPosition/useRestoreScrollPosition.js +2 -2
- package/dist/cjs/react-utils/useStateWithDependency/useStateWithDependency.js +3 -3
- package/dist/cjs/react-utils/useTimer/useTimer.js +3 -3
- package/dist/cjs/react-utils/useUpdateEffect/useUpdateEffect.js +3 -3
- package/dist/cjs/utils/datetime.js +22 -13
- package/dist/cjs/utils/datetime.js.map +1 -1
- package/dist/cjs/utils/retryImport.js +37 -0
- package/dist/cjs/utils/retryImport.js.map +1 -0
- package/dist/initializers/i18n.js +39 -130
- package/dist/initializers/i18n.js.map +1 -1
- package/dist/initializers/index.js +37 -19
- package/dist/initializers/index.js.map +1 -1
- package/dist/react-utils/index.js +4 -0
- package/dist/react-utils/index.js.map +1 -1
- package/dist/react-utils/lazyWithRetry/index.js +4 -0
- package/dist/react-utils/lazyWithRetry/index.js.map +1 -0
- package/dist/react-utils/lazyWithRetry/lazyWithRetry.js +13 -0
- package/dist/react-utils/lazyWithRetry/lazyWithRetry.js.map +1 -0
- package/dist/react-utils/mount/index.js +9 -0
- package/dist/react-utils/mount/index.js.map +1 -0
- package/dist/react-utils/mount/mount.js +84 -0
- package/dist/react-utils/mount/mount.js.map +1 -0
- package/dist/utils/datetime.js +22 -13
- package/dist/utils/datetime.js.map +1 -1
- package/dist/utils/retryImport.js +35 -0
- package/dist/utils/retryImport.js.map +1 -0
- package/package.json +10 -6
- package/react-utils.d.ts +73 -1
- package/src/translations/ar.json +111 -0
- package/src/translations/bg.json +111 -0
- package/src/translations/ca.json +111 -0
- package/src/translations/cs.json +111 -0
- package/src/translations/da.json +111 -0
- package/src/translations/de.json +111 -0
- package/src/translations/en.json +111 -0
- package/src/translations/es-MX.json +111 -0
- package/src/translations/es.json +111 -0
- package/src/translations/et.json +111 -0
- package/src/translations/fi.json +111 -0
- package/src/translations/fil.json +111 -0
- package/src/translations/fr.json +111 -0
- package/src/translations/he.json +111 -0
- package/src/translations/hi.json +111 -0
- package/src/translations/hr.json +111 -0
- package/src/translations/id.json +111 -0
- package/src/translations/it.json +111 -0
- package/src/translations/ja.json +111 -0
- package/src/translations/ko.json +111 -0
- package/src/translations/nl.json +111 -0
- package/src/translations/pl.json +111 -0
- package/src/translations/pt-BR.json +111 -0
- package/src/translations/pt.json +111 -0
- package/src/translations/ro.json +111 -0
- package/src/translations/ru.json +111 -0
- package/src/translations/sk.json +111 -0
- package/src/translations/sl.json +111 -0
- package/src/translations/sv.json +111 -0
- package/src/translations/th.json +111 -0
- package/src/translations/tr.json +111 -0
- package/src/translations/uk.json +111 -0
- package/src/translations/vi.json +111 -0
- package/src/translations/zh-CN.json +111 -0
- package/src/translations/zh-TW.json +111 -0
- package/configs/scripts/getPkgTranslations.js +0 -45
package/README.md
CHANGED
|
@@ -80,6 +80,7 @@ React utilities [↗](./docs/react/README.md)
|
|
|
80
80
|
- [handleMetaClick](./docs/react/utils/handleMetaClick.md)
|
|
81
81
|
- [isMetaKeyPressed](./docs/react/utils/isMetaKeyPressed.md)
|
|
82
82
|
- [withT](./docs/react/utils/withT.md)
|
|
83
|
+
- [lazyWithRetry](./docs/react/utils/lazyWithRetry.md)
|
|
83
84
|
|
|
84
85
|
</td>
|
|
85
86
|
</tr>
|
package/configs/esbuild/index.js
CHANGED
|
@@ -15,6 +15,9 @@ const sass = require("sass");
|
|
|
15
15
|
const alias = require("./alias.js");
|
|
16
16
|
const { babelPlugin } = require("./plugins/babel.js");
|
|
17
17
|
const { entrypointPlugin } = require("./plugins/entrypoint.js");
|
|
18
|
+
const {
|
|
19
|
+
packageTranslationsPlugin,
|
|
20
|
+
} = require("./plugins/packageTranslations.js");
|
|
18
21
|
const { prevalPlugin } = require("./plugins/preval.js");
|
|
19
22
|
const { reactGiphyPlugin } = require("./plugins/reactGiphy.js");
|
|
20
23
|
const { virtualizedPlugin } = require("./plugins/virtualized.js");
|
|
@@ -49,6 +52,7 @@ const config = {
|
|
|
49
52
|
plugins: [
|
|
50
53
|
rails(),
|
|
51
54
|
entrypointPlugin(isWatchMode),
|
|
55
|
+
packageTranslationsPlugin(),
|
|
52
56
|
prevalPlugin(),
|
|
53
57
|
babelPlugin(),
|
|
54
58
|
virtualizedPlugin(),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const {
|
|
2
|
+
generateMergedTranslations,
|
|
3
|
+
writeTranslationsToDisk,
|
|
4
|
+
} = require("../../utils/packageTranslations");
|
|
5
|
+
|
|
6
|
+
const packageTranslationsPlugin = () => ({
|
|
7
|
+
name: "package-translations",
|
|
8
|
+
setup(build) {
|
|
9
|
+
build.onStart(() => {
|
|
10
|
+
const mergedTranslations = generateMergedTranslations();
|
|
11
|
+
writeTranslationsToDisk(mergedTranslations);
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
module.exports = { packageTranslationsPlugin };
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
1
2
|
/* eslint-disable import/extensions */
|
|
2
|
-
const
|
|
3
|
+
const translationImports = require("@bigbinary/neeto-commons-frontend/configs/scripts/buildTranslationImports.js");
|
|
4
|
+
const englishTranslations = require("@bigbinary/neeto-commons-frontend/configs/scripts/getEnglishTranslation.js");
|
|
5
|
+
|
|
6
|
+
const PREVAL_IMPORT_TRANSLATION_IMPORTS =
|
|
7
|
+
'preval.require("../../configs/scripts/buildTranslationImports.js")';
|
|
8
|
+
|
|
9
|
+
const PREVAL_IMPORT_ENGLISH_TRANSLATIONS =
|
|
10
|
+
'preval.require("../../configs/scripts/getEnglishTranslation.js")';
|
|
3
11
|
|
|
4
12
|
const prevalPlugin = () => ({
|
|
5
13
|
name: "preval-plugin",
|
|
@@ -13,12 +21,14 @@ const prevalPlugin = () => ({
|
|
|
13
21
|
const fs = require("fs").promises;
|
|
14
22
|
const contents = await fs.readFile(args.path, "utf8");
|
|
15
23
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
const transformedContent = contents
|
|
25
|
+
.replace(PREVAL_IMPORT_TRANSLATION_IMPORTS, translationImports)
|
|
26
|
+
.replace(
|
|
27
|
+
PREVAL_IMPORT_ENGLISH_TRANSLATIONS,
|
|
28
|
+
JSON.stringify(englishTranslations)
|
|
29
|
+
);
|
|
20
30
|
|
|
21
|
-
return { contents:
|
|
31
|
+
return { contents: transformedContent, loader: "js" };
|
|
22
32
|
}
|
|
23
33
|
);
|
|
24
34
|
},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const translationsDir = path.resolve("dist/translations");
|
|
5
|
+
if (!fs.existsSync(translationsDir)) {
|
|
6
|
+
fs.mkdirSync(translationsDir, { recursive: true });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const files = fs
|
|
10
|
+
.readdirSync(translationsDir)
|
|
11
|
+
.filter(file => file.endsWith(".json"));
|
|
12
|
+
|
|
13
|
+
// Create a map like { "en": () => import("dist/translations/en.json") }
|
|
14
|
+
const entries = files.map(file => {
|
|
15
|
+
const lang = path.basename(file, ".json");
|
|
16
|
+
|
|
17
|
+
return `"${lang}": () => import("${process.cwd()}/dist/translations/${file}")`;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const content = `{ ${entries.join(",\n")} }`;
|
|
21
|
+
|
|
22
|
+
module.exports = content;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const filePath = path.resolve(process.cwd(), "dist/translations/en.json");
|
|
5
|
+
|
|
6
|
+
let englishTranslations = {};
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
if (fs.existsSync(filePath)) {
|
|
10
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
11
|
+
englishTranslations = JSON.parse(content);
|
|
12
|
+
}
|
|
13
|
+
} catch {
|
|
14
|
+
englishTranslations = {};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = englishTranslations;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const { mergeDeepLeft } = require("ramda");
|
|
5
|
+
|
|
6
|
+
const getPkgTransPath = pkg => {
|
|
7
|
+
const packageDir = path.join(__dirname, "../../..");
|
|
8
|
+
|
|
9
|
+
const basePath = path.join(packageDir, pkg);
|
|
10
|
+
const transPath1 = path.join(basePath, "app/javascript/src/translations");
|
|
11
|
+
const transPath2 = path.join(basePath, "src/translations");
|
|
12
|
+
|
|
13
|
+
return fs.existsSync(transPath1) ? transPath1 : transPath2;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const loadTranslations = translationsDir => {
|
|
17
|
+
try {
|
|
18
|
+
const jsonFiles = fs
|
|
19
|
+
.readdirSync(translationsDir)
|
|
20
|
+
.filter(file => file.endsWith(".json"))
|
|
21
|
+
.map(file => path.join(translationsDir, file));
|
|
22
|
+
|
|
23
|
+
const translations = {};
|
|
24
|
+
|
|
25
|
+
jsonFiles.forEach(jsonFile => {
|
|
26
|
+
const content = fs.readFileSync(jsonFile, "utf8");
|
|
27
|
+
const basename = path.basename(jsonFile, ".json");
|
|
28
|
+
translations[basename] = { translation: JSON.parse(content) };
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return translations;
|
|
32
|
+
} catch {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const generatePackageTranslations = () => {
|
|
38
|
+
const packageDir = "./node_modules/@bigbinary";
|
|
39
|
+
const packages = fs.readdirSync(packageDir);
|
|
40
|
+
|
|
41
|
+
return packages
|
|
42
|
+
.map(pkg => {
|
|
43
|
+
const transPath = getPkgTransPath(pkg);
|
|
44
|
+
|
|
45
|
+
return fs.existsSync(transPath) ? loadTranslations(transPath) : {};
|
|
46
|
+
})
|
|
47
|
+
.reduce(mergeDeepLeft, {});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const getHostTranslations = () => {
|
|
51
|
+
const hostTranslationsDir = "./app/javascript/src/translations";
|
|
52
|
+
|
|
53
|
+
return fs.existsSync(hostTranslationsDir)
|
|
54
|
+
? loadTranslations(hostTranslationsDir)
|
|
55
|
+
: {};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const generateMergedTranslations = () => {
|
|
59
|
+
const packageTranslations = generatePackageTranslations();
|
|
60
|
+
const hostTranslations = getHostTranslations();
|
|
61
|
+
|
|
62
|
+
return mergeDeepLeft(hostTranslations, packageTranslations);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const writeTranslationsToDisk = mergedTranslations => {
|
|
66
|
+
const publicTranslationsDir = path.join(
|
|
67
|
+
process.cwd(),
|
|
68
|
+
"dist",
|
|
69
|
+
"translations"
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
if (!fs.existsSync(publicTranslationsDir)) {
|
|
73
|
+
fs.mkdirSync(publicTranslationsDir, { recursive: true });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Object.keys(mergedTranslations).forEach(lang => {
|
|
77
|
+
const translationData = mergedTranslations[lang];
|
|
78
|
+
const outputPath = path.join(publicTranslationsDir, `${lang}.json`);
|
|
79
|
+
|
|
80
|
+
fs.writeFileSync(
|
|
81
|
+
outputPath,
|
|
82
|
+
JSON.stringify(translationData.translation, null, 2)
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
module.exports = {
|
|
88
|
+
generateMergedTranslations,
|
|
89
|
+
writeTranslationsToDisk,
|
|
90
|
+
};
|
package/configs/vite/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/* eslint-disable import/extensions */
|
|
2
|
+
|
|
2
3
|
const { default: viteYaml } = require("@modyfi/vite-plugin-yaml");
|
|
3
4
|
const { default: react } = require("@vitejs/plugin-react");
|
|
4
5
|
const dotenv = require("dotenv");
|
|
5
6
|
|
|
6
7
|
const { nanoDevelopmentPlugin } = require("./plugins/nanoDevelopment.js");
|
|
8
|
+
const {
|
|
9
|
+
packageTranslationsPlugin,
|
|
10
|
+
} = require("./plugins/packageTranslations.js");
|
|
7
11
|
const { prevalPlugin } = require("./plugins/preval.js");
|
|
8
12
|
const { reactGiphyPlugin } = require("./plugins/reactGiphy.js");
|
|
9
13
|
const svgr = require("./plugins/svgr.js");
|
|
@@ -25,6 +29,7 @@ const config = {
|
|
|
25
29
|
react({ babel: VITE_BABEL_CONFIG }),
|
|
26
30
|
virtualizedPlugin(),
|
|
27
31
|
reactGiphyPlugin(),
|
|
32
|
+
packageTranslationsPlugin(),
|
|
28
33
|
prevalPlugin(),
|
|
29
34
|
viteYaml(),
|
|
30
35
|
nanoDevelopmentPlugin(),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const {
|
|
2
|
+
generateMergedTranslations,
|
|
3
|
+
writeTranslationsToDisk,
|
|
4
|
+
} = require("../../utils/packageTranslations");
|
|
5
|
+
|
|
6
|
+
const packageTranslationsPlugin = () => ({
|
|
7
|
+
name: "package-translations",
|
|
8
|
+
buildStart() {
|
|
9
|
+
const mergedTranslations = generateMergedTranslations();
|
|
10
|
+
writeTranslationsToDisk(mergedTranslations);
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
module.exports = { packageTranslationsPlugin };
|
|
@@ -1,23 +1,45 @@
|
|
|
1
1
|
/* eslint-disable import/extensions */
|
|
2
2
|
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
delete require.cache[
|
|
4
|
+
const getUncachedTranslationImports = () => {
|
|
5
|
+
delete require.cache[
|
|
6
|
+
require.resolve("../../scripts/buildTranslationImports.js")
|
|
7
|
+
];
|
|
6
8
|
|
|
7
|
-
return require("../../scripts/
|
|
9
|
+
return require("../../scripts/buildTranslationImports.js");
|
|
8
10
|
};
|
|
9
11
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
+
const getUncachedEnglishTranslations = () => {
|
|
13
|
+
delete require.cache[
|
|
14
|
+
require.resolve("../../scripts/getEnglishTranslation.js")
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
return require("../../scripts/getEnglishTranslation.js");
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const PREVAL_IMPORT_TRANSLATION_IMPORTS =
|
|
21
|
+
'preval.require("../../configs/scripts/buildTranslationImports.js")';
|
|
22
|
+
|
|
23
|
+
const PREVAL_IMPORT_ENGLISH_TRANSLATIONS =
|
|
24
|
+
'preval.require("../../configs/scripts/getEnglishTranslation.js")';
|
|
12
25
|
|
|
13
26
|
const prevalPlugin = () => ({
|
|
14
27
|
name: "preval-plugin",
|
|
15
28
|
transform(code, id) {
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
if (
|
|
30
|
+
id.includes("node_modules") &&
|
|
31
|
+
(code.includes(PREVAL_IMPORT_TRANSLATION_IMPORTS) ||
|
|
32
|
+
code.includes(PREVAL_IMPORT_ENGLISH_TRANSLATIONS))
|
|
33
|
+
) {
|
|
34
|
+
const replacedCode = code
|
|
35
|
+
.replace(
|
|
36
|
+
PREVAL_IMPORT_TRANSLATION_IMPORTS,
|
|
37
|
+
getUncachedTranslationImports()
|
|
38
|
+
)
|
|
39
|
+
.replace(
|
|
40
|
+
PREVAL_IMPORT_ENGLISH_TRANSLATIONS,
|
|
41
|
+
JSON.stringify(getUncachedEnglishTranslations())
|
|
42
|
+
);
|
|
21
43
|
|
|
22
44
|
return { code: replacedCode, map: null };
|
|
23
45
|
}
|
|
@@ -427,147 +427,52 @@ var Browser = /*#__PURE__*/function () {
|
|
|
427
427
|
}();
|
|
428
428
|
Browser.type = 'languageDetector';
|
|
429
429
|
|
|
430
|
-
var
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
sent: "{{entity}} sent successfully.",
|
|
458
|
-
merged: "{{entity}} have been successfully merged.",
|
|
459
|
-
disconnected: "{{entity}} has been successfully disconnected."
|
|
460
|
-
};
|
|
461
|
-
var otp = {
|
|
462
|
-
sent: "OTP has been sent successfully.",
|
|
463
|
-
invalid: "Invalid OTP",
|
|
464
|
-
verified: "OTP has been verified successfully."
|
|
465
|
-
};
|
|
466
|
-
var upload = {
|
|
467
|
-
error: "An error occurred while uploading the file"
|
|
468
|
-
};
|
|
469
|
-
var image = {
|
|
470
|
-
profile: {
|
|
471
|
-
removalFailed: "Failed to remove profile picture",
|
|
472
|
-
removalSuccess: "Profile picture successfully removed"
|
|
473
|
-
},
|
|
474
|
-
contentTypeInvalid: "Other than jpg, png, svg are not supported",
|
|
475
|
-
sizeOutOfRange: "Should not be more than {{maxSize, number}} MB"
|
|
476
|
-
};
|
|
477
|
-
var userRole = {
|
|
478
|
-
deactivateActiveAdmin: "You cannot deactivate active admin from the workspace!"
|
|
479
|
-
};
|
|
480
|
-
var activeRecord = {
|
|
481
|
-
error: {
|
|
482
|
-
blankName: "Name can't be blank",
|
|
483
|
-
blankDescription: "Description can't be blank",
|
|
484
|
-
blankValue: "Value can't be blank",
|
|
485
|
-
prefixType: "Prefix type {{value}} is not valid",
|
|
486
|
-
minimumEntryLimit: "Minimum entry limit must be less than or equal to {{maximumEntryLimit, number}}",
|
|
487
|
-
maximumEntryLimit: "Maximum entry limit must be greater than or equal to {{minimumEntryLimit, number}}"
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
var sessions = {
|
|
491
|
-
expiry: "Your session has expired. Please login again."
|
|
492
|
-
};
|
|
493
|
-
var payment = {
|
|
494
|
-
error: {
|
|
495
|
-
incomplete: "Your payment could not be completed"
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
var invitations = {
|
|
499
|
-
deleted_one: "Invitation has been deleted successfully",
|
|
500
|
-
deleted_other: "{{count, number}} Invitations have been deleted successfully",
|
|
501
|
-
sent_one: "Invitation has been sent successfully",
|
|
502
|
-
sent_other: "{{count, number}} Invitations have been sent successfully",
|
|
503
|
-
notFound: "{{email}} was not invited to test this website."
|
|
504
|
-
};
|
|
505
|
-
var github = {
|
|
506
|
-
error: {
|
|
507
|
-
webhookPermissionDenied: "Permission denied. Ensure you have permission to create webhooks for the repository.",
|
|
508
|
-
primaryNonDeletable: "Primary Github account cannot be deleted."
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
var neetoCommons = {
|
|
512
|
-
fallbackComponent: {
|
|
513
|
-
somethingWentWrong: "Sorry, something went wrong.",
|
|
514
|
-
description: "Please try <reloading>reloading</reloading> the page.<br> If the problem persists, <contactus>contact us</contactus>."
|
|
515
|
-
},
|
|
516
|
-
toastr: {
|
|
517
|
-
success: {
|
|
518
|
-
copiedToClipboard: "Copied to clipboard!"
|
|
519
|
-
},
|
|
520
|
-
error: {
|
|
521
|
-
noInternetConnection: "No Internet Connection.",
|
|
522
|
-
networkError: "Network error. Please check your connection and try again."
|
|
523
|
-
}
|
|
524
|
-
},
|
|
525
|
-
notice: {
|
|
526
|
-
errorOccurred: "Some error occurred."
|
|
527
|
-
},
|
|
528
|
-
validators: {
|
|
529
|
-
isRequired: "{{what}} is required.",
|
|
530
|
-
mustNotContainCapitalLetters: "{{what}} must not contain capital letters.",
|
|
531
|
-
mustNotContainSpaces: "{{what}} must not contain spaces.",
|
|
532
|
-
mustNotContainSpecialCharactersExceptHyphen: "{{what}} must not contain any special characters, except '-'",
|
|
533
|
-
mustNotStartOrEndWithSpecialCharacters: "{{what}} must not start or end with special characters."
|
|
534
|
-
},
|
|
535
|
-
copyToClipboard: {
|
|
536
|
-
failed: "Failed to copy to clipboard"
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
var commonsEn = {
|
|
540
|
-
generic: generic,
|
|
541
|
-
authentication: authentication,
|
|
542
|
-
authorization: authorization,
|
|
543
|
-
resource: resource,
|
|
544
|
-
otp: otp,
|
|
545
|
-
upload: upload,
|
|
546
|
-
image: image,
|
|
547
|
-
userRole: userRole,
|
|
548
|
-
activeRecord: activeRecord,
|
|
549
|
-
sessions: sessions,
|
|
550
|
-
payment: payment,
|
|
551
|
-
invitations: invitations,
|
|
552
|
-
github: github,
|
|
553
|
-
neetoCommons: neetoCommons
|
|
430
|
+
var resourcesToBackend = function resourcesToBackend(res) {
|
|
431
|
+
return {
|
|
432
|
+
type: 'backend',
|
|
433
|
+
init: function init(services, backendOptions, i18nextOptions) {},
|
|
434
|
+
read: function read(language, namespace, callback) {
|
|
435
|
+
if (typeof res === 'function') {
|
|
436
|
+
if (res.length < 3) {
|
|
437
|
+
try {
|
|
438
|
+
var r = res(language, namespace);
|
|
439
|
+
if (r && typeof r.then === 'function') {
|
|
440
|
+
r.then(function (data) {
|
|
441
|
+
return callback(null, data && data.default || data);
|
|
442
|
+
}).catch(callback);
|
|
443
|
+
} else {
|
|
444
|
+
callback(null, r);
|
|
445
|
+
}
|
|
446
|
+
} catch (err) {
|
|
447
|
+
callback(err);
|
|
448
|
+
}
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
res(language, namespace, callback);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
callback(null, res && res[language] && res[language][namespace]);
|
|
455
|
+
}
|
|
456
|
+
};
|
|
554
457
|
};
|
|
555
458
|
|
|
556
459
|
// eslint-disable-next-line import/no-mutable-exports
|
|
557
460
|
exports.taxonomies = {};
|
|
558
|
-
var initializeI18n = function initializeI18n(
|
|
461
|
+
var initializeI18n = function initializeI18n() {
|
|
559
462
|
var _window$globalProps, _window$globalProps2;
|
|
463
|
+
var hostTranslations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
560
464
|
var enableDirAttribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
561
465
|
document.documentElement.removeAttribute("lang");
|
|
562
466
|
var userLanguage = (_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 || (_window$globalProps = _window$globalProps.user) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.language;
|
|
563
467
|
if (userLanguage) document.documentElement.setAttribute("lang", userLanguage);
|
|
564
|
-
var
|
|
565
|
-
var
|
|
468
|
+
var translationImports = preval.require("../../../configs/scripts/buildTranslationImports.js");
|
|
469
|
+
var englishTranslations = preval.require("../../../configs/scripts/getEnglishTranslation.js");
|
|
470
|
+
var englishResource = {
|
|
566
471
|
en: {
|
|
567
|
-
translation:
|
|
472
|
+
translation: englishTranslations || {}
|
|
568
473
|
}
|
|
569
474
|
};
|
|
570
|
-
var resources =
|
|
475
|
+
var resources = ramda.mergeDeepLeft(hostTranslations, englishResource);
|
|
571
476
|
var defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
|
|
572
477
|
var defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
|
|
573
478
|
return [key, {
|
|
@@ -577,8 +482,12 @@ var initializeI18n = function initializeI18n(hostTranslations) {
|
|
|
577
482
|
}));
|
|
578
483
|
var hostTaxonomies = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.taxonomies) || {};
|
|
579
484
|
exports.taxonomies = initializers_utils_utils.replaceNullValuesWithGetter(ramda.mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
|
|
580
|
-
i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).
|
|
485
|
+
i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).use(resourcesToBackend(function (language) {
|
|
486
|
+
var _translationImports$l;
|
|
487
|
+
return translationImports === null || translationImports === void 0 || (_translationImports$l = translationImports[language]) === null || _translationImports$l === void 0 ? void 0 : _translationImports$l.call(translationImports);
|
|
488
|
+
})).init({
|
|
581
489
|
resources: resources,
|
|
490
|
+
partialBundledLanguages: true,
|
|
582
491
|
fallbackLng: "en",
|
|
583
492
|
interpolation: {
|
|
584
493
|
defaultVariables: {
|