@bigbinary/neeto-commons-frontend 4.13.92-beta.2 → 4.13.92
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/configs/esbuild/index.js +0 -4
- package/configs/esbuild/plugins/preval.js +6 -16
- package/configs/scripts/getPkgTranslations.js +45 -0
- package/configs/vite/index.js +0 -5
- package/configs/vite/plugins/preval.js +10 -32
- package/dist/cjs/initializers/i18n.js +130 -39
- package/dist/cjs/initializers/i18n.js.map +1 -1
- package/dist/cjs/initializers/index.js +19 -38
- package/dist/cjs/initializers/index.js.map +1 -1
- package/dist/initializers/i18n.js +130 -39
- package/dist/initializers/i18n.js.map +1 -1
- package/dist/initializers/index.js +19 -38
- package/dist/initializers/index.js.map +1 -1
- package/package.json +6 -10
- package/configs/esbuild/plugins/packageTranslations.js +0 -16
- package/configs/scripts/buildTranslationImports.js +0 -22
- package/configs/scripts/getEnglishTranslation.js +0 -17
- package/configs/utils/packageTranslations.js +0 -90
- package/configs/vite/plugins/packageTranslations.js +0 -14
- package/src/translations/ar.json +0 -111
- package/src/translations/bg.json +0 -111
- package/src/translations/ca.json +0 -111
- package/src/translations/cs.json +0 -111
- package/src/translations/da.json +0 -111
- package/src/translations/de.json +0 -111
- package/src/translations/en.json +0 -111
- package/src/translations/es-MX.json +0 -111
- package/src/translations/es.json +0 -111
- package/src/translations/et.json +0 -111
- package/src/translations/fi.json +0 -111
- package/src/translations/fil.json +0 -111
- package/src/translations/fr.json +0 -111
- package/src/translations/he.json +0 -111
- package/src/translations/hi.json +0 -111
- package/src/translations/hr.json +0 -111
- package/src/translations/id.json +0 -111
- package/src/translations/it.json +0 -111
- package/src/translations/ja.json +0 -111
- package/src/translations/ko.json +0 -111
- package/src/translations/nl.json +0 -111
- package/src/translations/pl.json +0 -111
- package/src/translations/pt-BR.json +0 -111
- package/src/translations/pt.json +0 -111
- package/src/translations/ro.json +0 -111
- package/src/translations/ru.json +0 -111
- package/src/translations/sk.json +0 -111
- package/src/translations/sl.json +0 -111
- package/src/translations/sv.json +0 -111
- package/src/translations/th.json +0 -111
- package/src/translations/tr.json +0 -111
- package/src/translations/uk.json +0 -111
- package/src/translations/vi.json +0 -111
- package/src/translations/zh-CN.json +0 -111
- package/src/translations/zh-TW.json +0 -111
package/configs/esbuild/index.js
CHANGED
|
@@ -15,9 +15,6 @@ 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");
|
|
21
18
|
const { prevalPlugin } = require("./plugins/preval.js");
|
|
22
19
|
const { reactGiphyPlugin } = require("./plugins/reactGiphy.js");
|
|
23
20
|
const { virtualizedPlugin } = require("./plugins/virtualized.js");
|
|
@@ -52,7 +49,6 @@ const config = {
|
|
|
52
49
|
plugins: [
|
|
53
50
|
rails(),
|
|
54
51
|
entrypointPlugin(isWatchMode),
|
|
55
|
-
packageTranslationsPlugin(),
|
|
56
52
|
prevalPlugin(),
|
|
57
53
|
babelPlugin(),
|
|
58
54
|
virtualizedPlugin(),
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
2
1
|
/* eslint-disable import/extensions */
|
|
3
|
-
const
|
|
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")';
|
|
2
|
+
const PkgTranslations = require("@bigbinary/neeto-commons-frontend/configs/scripts/getPkgTranslations.js");
|
|
11
3
|
|
|
12
4
|
const prevalPlugin = () => ({
|
|
13
5
|
name: "preval-plugin",
|
|
@@ -21,14 +13,12 @@ const prevalPlugin = () => ({
|
|
|
21
13
|
const fs = require("fs").promises;
|
|
22
14
|
const contents = await fs.readFile(args.path, "utf8");
|
|
23
15
|
|
|
24
|
-
const
|
|
25
|
-
.
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
JSON.stringify(englishTranslations)
|
|
29
|
-
);
|
|
16
|
+
const transformedContents = contents.replace(
|
|
17
|
+
`preval.require("../../configs/scripts/getPkgTranslations.js")`,
|
|
18
|
+
JSON.stringify(PkgTranslations)
|
|
19
|
+
);
|
|
30
20
|
|
|
31
|
-
return { contents:
|
|
21
|
+
return { contents: transformedContents, loader: "js" };
|
|
32
22
|
}
|
|
33
23
|
);
|
|
34
24
|
},
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const { mergeDeepLeft } = require("ramda");
|
|
5
|
+
|
|
6
|
+
const packageDir = path.join(__dirname, "../../../");
|
|
7
|
+
|
|
8
|
+
const getPkgTransPath = pkg => {
|
|
9
|
+
const basePath = path.join(packageDir, pkg);
|
|
10
|
+
|
|
11
|
+
const transPath1 = path.join(basePath, "app/javascript/src/translations");
|
|
12
|
+
const transPath2 = path.join(basePath, "src/translations");
|
|
13
|
+
|
|
14
|
+
return fs.existsSync(transPath1) ? transPath1 : transPath2;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const packages = fs.readdirSync(packageDir);
|
|
18
|
+
|
|
19
|
+
const loadTranslations = translationsDir => {
|
|
20
|
+
try {
|
|
21
|
+
const jsonFiles = fs
|
|
22
|
+
.readdirSync(translationsDir)
|
|
23
|
+
.filter(file => file.endsWith(".json"))
|
|
24
|
+
.map(file => path.join(translationsDir, file));
|
|
25
|
+
|
|
26
|
+
const translations = {};
|
|
27
|
+
|
|
28
|
+
jsonFiles.forEach(jsonFile => {
|
|
29
|
+
const content = fs.readFileSync(jsonFile, "utf8");
|
|
30
|
+
const basename = path.basename(jsonFile, ".json");
|
|
31
|
+
|
|
32
|
+
translations[basename] = { translation: JSON.parse(content) };
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return translations;
|
|
36
|
+
} catch {
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const packageTranslations = packages
|
|
42
|
+
.map(pkg => loadTranslations(getPkgTransPath(pkg)))
|
|
43
|
+
.reduce(mergeDeepLeft);
|
|
44
|
+
|
|
45
|
+
module.exports = packageTranslations;
|
package/configs/vite/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
/* eslint-disable import/extensions */
|
|
2
|
-
|
|
3
2
|
const { default: viteYaml } = require("@modyfi/vite-plugin-yaml");
|
|
4
3
|
const { default: react } = require("@vitejs/plugin-react");
|
|
5
4
|
const dotenv = require("dotenv");
|
|
6
5
|
|
|
7
6
|
const { nanoDevelopmentPlugin } = require("./plugins/nanoDevelopment.js");
|
|
8
|
-
const {
|
|
9
|
-
packageTranslationsPlugin,
|
|
10
|
-
} = require("./plugins/packageTranslations.js");
|
|
11
7
|
const { prevalPlugin } = require("./plugins/preval.js");
|
|
12
8
|
const { reactGiphyPlugin } = require("./plugins/reactGiphy.js");
|
|
13
9
|
const svgr = require("./plugins/svgr.js");
|
|
@@ -29,7 +25,6 @@ const config = {
|
|
|
29
25
|
react({ babel: VITE_BABEL_CONFIG }),
|
|
30
26
|
virtualizedPlugin(),
|
|
31
27
|
reactGiphyPlugin(),
|
|
32
|
-
packageTranslationsPlugin(),
|
|
33
28
|
prevalPlugin(),
|
|
34
29
|
viteYaml(),
|
|
35
30
|
nanoDevelopmentPlugin(),
|
|
@@ -1,45 +1,23 @@
|
|
|
1
1
|
/* eslint-disable import/extensions */
|
|
2
2
|
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
delete require.cache[
|
|
6
|
-
require.resolve("../../scripts/buildTranslationImports.js")
|
|
7
|
-
];
|
|
4
|
+
const getUncachedTranslations = () => {
|
|
5
|
+
delete require.cache[require.resolve("../../scripts/getPkgTranslations.js")];
|
|
8
6
|
|
|
9
|
-
return require("../../scripts/
|
|
7
|
+
return require("../../scripts/getPkgTranslations.js");
|
|
10
8
|
};
|
|
11
9
|
|
|
12
|
-
const
|
|
13
|
-
|
|
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")';
|
|
10
|
+
const PREVAL_IMPORT =
|
|
11
|
+
'preval.require("../../configs/scripts/getPkgTranslations.js")';
|
|
25
12
|
|
|
26
13
|
const prevalPlugin = () => ({
|
|
27
14
|
name: "preval-plugin",
|
|
28
15
|
transform(code, id) {
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
);
|
|
16
|
+
if (id.includes("node_modules") && code.includes(PREVAL_IMPORT)) {
|
|
17
|
+
const replacedCode = code.replace(
|
|
18
|
+
PREVAL_IMPORT,
|
|
19
|
+
JSON.stringify(getUncachedTranslations())
|
|
20
|
+
);
|
|
43
21
|
|
|
44
22
|
return { code: replacedCode, map: null };
|
|
45
23
|
}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var i18next = require('i18next');
|
|
6
6
|
var ramda = require('ramda');
|
|
7
7
|
var reactI18next = require('react-i18next');
|
|
8
|
-
var utils_retryImport = require('../utils/retryImport.js');
|
|
9
8
|
var initializers_constants = require('./constants.js');
|
|
10
9
|
var initializers_utils_customFormatters = require('./utils/customFormatters.js');
|
|
11
10
|
var initializers_utils_customPostProcessors = require('./utils/customPostProcessors.js');
|
|
@@ -428,52 +427,147 @@ var Browser = /*#__PURE__*/function () {
|
|
|
428
427
|
}();
|
|
429
428
|
Browser.type = 'languageDetector';
|
|
430
429
|
|
|
431
|
-
var
|
|
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
|
-
|
|
430
|
+
var generic = {
|
|
431
|
+
error: "Something went wrong. Please try again later."
|
|
432
|
+
};
|
|
433
|
+
var authentication = {
|
|
434
|
+
notLoggedIn: "Could not authenticate, please login to continue!",
|
|
435
|
+
couldNotAuth: "Could not authenticate with the provided {{parameter}}.",
|
|
436
|
+
incorrectPassword: "Current password is incorrect. Please try again.",
|
|
437
|
+
incorrectEmailPassword: "Incorrect email or password. Please try again."
|
|
438
|
+
};
|
|
439
|
+
var authorization = {
|
|
440
|
+
unauthorized: "You are not authorized to perform this action."
|
|
441
|
+
};
|
|
442
|
+
var resource = {
|
|
443
|
+
add_one: "{{entity}} has been added successfully.",
|
|
444
|
+
add_other: "{{entity}} have been added successfully.",
|
|
445
|
+
save: "{{entity}} has been saved successfully.",
|
|
446
|
+
save_one: "{{entity}} has been saved successfully.",
|
|
447
|
+
save_other: "{{entity}} have been saved successfully.",
|
|
448
|
+
update: "{{entity}} has been updated successfully.",
|
|
449
|
+
update_one: "{{entity}} has been updated successfully.",
|
|
450
|
+
update_other: "{{entity}} have been updated successfully.",
|
|
451
|
+
delete_one: "{{entity}} has been deleted successfully.",
|
|
452
|
+
delete_other: "{{entity}} have been deleted successfully.",
|
|
453
|
+
clone: "{{entity}} has been cloned successfully.",
|
|
454
|
+
notFound: "{{entity}} does not exist.",
|
|
455
|
+
remove_one: "{{entity}} has been removed successfully.",
|
|
456
|
+
remove_other: "{{entity}} have been removed successfully.",
|
|
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
|
|
458
554
|
};
|
|
459
555
|
|
|
460
556
|
// eslint-disable-next-line import/no-mutable-exports
|
|
461
557
|
exports.taxonomies = {};
|
|
462
|
-
var initializeI18n = function initializeI18n() {
|
|
558
|
+
var initializeI18n = function initializeI18n(hostTranslations) {
|
|
463
559
|
var _window$globalProps, _window$globalProps2;
|
|
464
|
-
var hostTranslations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
465
560
|
var enableDirAttribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
466
561
|
document.documentElement.removeAttribute("lang");
|
|
467
562
|
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;
|
|
468
563
|
if (userLanguage) document.documentElement.setAttribute("lang", userLanguage);
|
|
469
|
-
var
|
|
470
|
-
var
|
|
471
|
-
var englishResource = {
|
|
564
|
+
var packageTranslations = preval.require("../../../configs/scripts/getPkgTranslations.js");
|
|
565
|
+
var commonsTranslations = {
|
|
472
566
|
en: {
|
|
473
|
-
translation:
|
|
567
|
+
translation: commonsEn
|
|
474
568
|
}
|
|
475
569
|
};
|
|
476
|
-
var resources = ramda.mergeDeepLeft
|
|
570
|
+
var resources = [hostTranslations, commonsTranslations, packageTranslations].reduce(ramda.mergeDeepLeft);
|
|
477
571
|
var defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
|
|
478
572
|
var defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
|
|
479
573
|
return [key, {
|
|
@@ -483,11 +577,8 @@ var initializeI18n = function initializeI18n() {
|
|
|
483
577
|
}));
|
|
484
578
|
var hostTaxonomies = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.taxonomies) || {};
|
|
485
579
|
exports.taxonomies = initializers_utils_utils.replaceNullValuesWithGetter(ramda.mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
|
|
486
|
-
i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).
|
|
487
|
-
return utils_retryImport(translationImports === null || translationImports === void 0 ? void 0 : translationImports[language]);
|
|
488
|
-
})).init({
|
|
580
|
+
i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).init({
|
|
489
581
|
resources: resources,
|
|
490
|
-
partialBundledLanguages: true,
|
|
491
582
|
fallbackLng: "en",
|
|
492
583
|
interpolation: {
|
|
493
584
|
defaultVariables: {
|