@bigbinary/neeto-commons-frontend 4.13.92-beta.5 → 4.13.93

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.
Files changed (76) hide show
  1. package/configs/esbuild/index.js +0 -4
  2. package/configs/esbuild/plugins/preval.js +6 -33
  3. package/configs/scripts/getPkgTranslations.js +45 -0
  4. package/configs/vite/index.js +0 -5
  5. package/configs/vite/plugins/preval.js +10 -32
  6. package/dist/cjs/initializers/i18n.js +183 -120
  7. package/dist/cjs/initializers/i18n.js.map +1 -1
  8. package/dist/cjs/initializers/index.js +19 -43
  9. package/dist/cjs/initializers/index.js.map +1 -1
  10. package/dist/cjs/react-utils/PrivateRoute/PrivateRoute.js +17 -13
  11. package/dist/cjs/react-utils/PrivateRoute/PrivateRoute.js.map +1 -1
  12. package/dist/cjs/react-utils/PrivateRoute/constants.js +8 -0
  13. package/dist/cjs/react-utils/PrivateRoute/constants.js.map +1 -0
  14. package/dist/cjs/react-utils/PrivateRoute/index.js +2 -0
  15. package/dist/cjs/react-utils/PrivateRoute/index.js.map +1 -1
  16. package/dist/cjs/react-utils/PrivateRoute/utils.js +16 -0
  17. package/dist/cjs/react-utils/PrivateRoute/utils.js.map +1 -0
  18. package/dist/cjs/react-utils/index.js +2 -0
  19. package/dist/cjs/react-utils/index.js.map +1 -1
  20. package/dist/initializers/i18n.js +183 -120
  21. package/dist/initializers/i18n.js.map +1 -1
  22. package/dist/initializers/index.js +19 -43
  23. package/dist/initializers/index.js.map +1 -1
  24. package/dist/react-utils/PrivateRoute/PrivateRoute.js +17 -13
  25. package/dist/react-utils/PrivateRoute/PrivateRoute.js.map +1 -1
  26. package/dist/react-utils/PrivateRoute/constants.js +5 -0
  27. package/dist/react-utils/PrivateRoute/constants.js.map +1 -0
  28. package/dist/react-utils/PrivateRoute/index.js +2 -0
  29. package/dist/react-utils/PrivateRoute/index.js.map +1 -1
  30. package/dist/react-utils/PrivateRoute/utils.js +14 -0
  31. package/dist/react-utils/PrivateRoute/utils.js.map +1 -0
  32. package/dist/react-utils/index.js +2 -0
  33. package/dist/react-utils/index.js.map +1 -1
  34. package/initializers.d.ts +1 -1
  35. package/package.json +2 -4
  36. package/react-utils.d.ts +1 -0
  37. package/configs/esbuild/plugins/packageTranslations.js +0 -16
  38. package/configs/scripts/buildTranslationImports.js +0 -19
  39. package/configs/scripts/getEnglishTranslation.js +0 -9
  40. package/configs/utils/packageTranslations.js +0 -90
  41. package/configs/vite/plugins/packageTranslations.js +0 -14
  42. package/src/translations/ar.json +0 -111
  43. package/src/translations/bg.json +0 -111
  44. package/src/translations/ca.json +0 -111
  45. package/src/translations/cs.json +0 -111
  46. package/src/translations/da.json +0 -111
  47. package/src/translations/de.json +0 -111
  48. package/src/translations/en.json +0 -111
  49. package/src/translations/es-MX.json +0 -111
  50. package/src/translations/es.json +0 -111
  51. package/src/translations/et.json +0 -111
  52. package/src/translations/fi.json +0 -111
  53. package/src/translations/fil.json +0 -111
  54. package/src/translations/fr.json +0 -111
  55. package/src/translations/he.json +0 -111
  56. package/src/translations/hi.json +0 -111
  57. package/src/translations/hr.json +0 -111
  58. package/src/translations/id.json +0 -111
  59. package/src/translations/it.json +0 -111
  60. package/src/translations/ja.json +0 -111
  61. package/src/translations/ko.json +0 -111
  62. package/src/translations/nl.json +0 -111
  63. package/src/translations/pl.json +0 -111
  64. package/src/translations/pt-BR.json +0 -111
  65. package/src/translations/pt.json +0 -111
  66. package/src/translations/ro.json +0 -111
  67. package/src/translations/ru.json +0 -111
  68. package/src/translations/sk.json +0 -111
  69. package/src/translations/sl.json +0 -111
  70. package/src/translations/sv.json +0 -111
  71. package/src/translations/th.json +0 -111
  72. package/src/translations/tr.json +0 -111
  73. package/src/translations/uk.json +0 -111
  74. package/src/translations/vi.json +0 -111
  75. package/src/translations/zh-CN.json +0 -111
  76. package/src/translations/zh-TW.json +0 -111
@@ -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,27 +1,5 @@
1
- /* eslint-disable @bigbinary/neeto/no-dangling-constants */
2
1
  /* eslint-disable import/extensions */
3
-
4
- const getUncachedTranslationImports = () => {
5
- delete require.cache[
6
- require.resolve("../../scripts/buildTranslationImports.js")
7
- ];
8
-
9
- return require("../../scripts/buildTranslationImports.js");
10
- };
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")';
2
+ const PkgTranslations = require("@bigbinary/neeto-commons-frontend/configs/scripts/getPkgTranslations.js");
25
3
 
26
4
  const prevalPlugin = () => ({
27
5
  name: "preval-plugin",
@@ -35,17 +13,12 @@ const prevalPlugin = () => ({
35
13
  const fs = require("fs").promises;
36
14
  const contents = await fs.readFile(args.path, "utf8");
37
15
 
38
- const transformedContent = contents
39
- .replace(
40
- PREVAL_IMPORT_TRANSLATION_IMPORTS,
41
- getUncachedTranslationImports()
42
- )
43
- .replace(
44
- PREVAL_IMPORT_ENGLISH_TRANSLATIONS,
45
- JSON.stringify(getUncachedEnglishTranslations())
46
- );
16
+ const transformedContents = contents.replace(
17
+ `preval.require("../../configs/scripts/getPkgTranslations.js")`,
18
+ JSON.stringify(PkgTranslations)
19
+ );
47
20
 
48
- return { contents: transformedContent, loader: "js" };
21
+ return { contents: transformedContents, loader: "js" };
49
22
  }
50
23
  );
51
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;
@@ -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 getUncachedTranslationImports = () => {
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/buildTranslationImports.js");
7
+ return require("../../scripts/getPkgTranslations.js");
10
8
  };
11
9
 
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")';
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
- 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
- );
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
  }
@@ -2,16 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../index-bFmfHzbL.js');
6
5
  var i18next = require('i18next');
7
6
  var ramda = require('ramda');
8
7
  var reactI18next = require('react-i18next');
9
- var utils_retryImport = require('../utils/retryImport.js');
10
8
  var initializers_constants = require('./constants.js');
11
9
  var initializers_utils_customFormatters = require('./utils/customFormatters.js');
12
10
  var initializers_utils_customPostProcessors = require('./utils/customPostProcessors.js');
13
11
  var initializers_utils_utils = require('./utils/utils.js');
14
- require('../_commonjsHelpers-BJu3ubxk.js');
15
12
  require('dompurify');
16
13
  require('../typeof-D4ZZ_FlZ.js');
17
14
  require('../slicedToArray-BcL7fKuL.js');
@@ -430,129 +427,195 @@ var Browser = /*#__PURE__*/function () {
430
427
  }();
431
428
  Browser.type = 'languageDetector';
432
429
 
433
- var resourcesToBackend = function resourcesToBackend(res) {
434
- return {
435
- type: 'backend',
436
- init: function init(services, backendOptions, i18nextOptions) {},
437
- read: function read(language, namespace, callback) {
438
- if (typeof res === 'function') {
439
- if (res.length < 3) {
440
- try {
441
- var r = res(language, namespace);
442
- if (r && typeof r.then === 'function') {
443
- r.then(function (data) {
444
- return callback(null, data && data.default || data);
445
- }).catch(callback);
446
- } else {
447
- callback(null, r);
448
- }
449
- } catch (err) {
450
- callback(err);
451
- }
452
- return;
453
- }
454
- res(language, namespace, callback);
455
- return;
456
- }
457
- callback(null, res && res[language] && res[language][namespace]);
458
- }
459
- };
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
460
554
  };
461
555
 
462
556
  // eslint-disable-next-line import/no-mutable-exports
463
557
  exports.taxonomies = {};
464
- var initializeI18n = /*#__PURE__*/function () {
465
- var _ref = index._asyncToGenerator(/*#__PURE__*/index._regeneratorRuntime.mark(function _callee() {
466
- var _window$globalProps, _window$globalProps2;
467
- var hostTranslations,
468
- enableDirAttribute,
469
- userLanguage,
470
- translationImports,
471
- englishTranslations,
472
- englishResource,
473
- resources,
474
- defaultTaxonomyKeys,
475
- defaultTaxonomies,
476
- hostTaxonomies,
477
- _args = arguments;
478
- return index._regeneratorRuntime.wrap(function _callee$(_context) {
479
- while (1) switch (_context.prev = _context.next) {
480
- case 0:
481
- hostTranslations = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
482
- enableDirAttribute = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
483
- document.documentElement.removeAttribute("lang");
484
- 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;
485
- if (userLanguage) document.documentElement.setAttribute("lang", userLanguage);
486
- translationImports = preval.require("../../../configs/scripts/buildTranslationImports.js");
487
- englishTranslations = preval.require("../../../configs/scripts/getEnglishTranslation.js");
488
- englishResource = {
489
- en: {
490
- translation: englishTranslations || {}
491
- }
492
- };
493
- resources = ramda.mergeDeepLeft(hostTranslations, englishResource);
494
- defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
495
- defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
496
- return [key, {
497
- singular: null,
498
- plural: null
499
- }];
500
- }));
501
- hostTaxonomies = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.taxonomies) || {};
502
- exports.taxonomies = initializers_utils_utils.replaceNullValuesWithGetter(ramda.mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
503
- _context.next = 15;
504
- return i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).use(resourcesToBackend(function (language) {
505
- return utils_retryImport(translationImports === null || translationImports === void 0 ? void 0 : translationImports[language]);
506
- })).init({
507
- resources: resources,
508
- partialBundledLanguages: true,
509
- fallbackLng: "en",
510
- interpolation: {
511
- defaultVariables: {
512
- taxonomies: exports.taxonomies
513
- },
514
- escapeValue: false,
515
- skipOnVariables: false,
516
- alwaysFormat: true,
517
- format: function format(value, _format, lng, options) {
518
- var newValue = value;
519
- if (initializers_constants.LIST_FORMATS.includes(_format)) {
520
- newValue = initializers_utils_customFormatters.listFormatter({
521
- value: newValue,
522
- format: _format,
523
- lng: lng,
524
- options: options
525
- });
526
- return newValue;
527
- }
528
- return initializers_utils_customFormatters.lowerCaseDynamicTextFormatter(newValue, _format);
529
- }
530
- },
531
- postProcess: [initializers_utils_customPostProcessors.sentenceCaseProcessor.name],
532
- detection: {
533
- order: ["querystring", "htmlTag", "navigator", "cookie"],
534
- caches: ["cookie"],
535
- lookupQuerystring: "lang",
536
- lookupCookie: "lang"
537
- }
558
+ var initializeI18n = function initializeI18n(hostTranslations) {
559
+ var _window$globalProps, _window$globalProps2;
560
+ var enableDirAttribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
561
+ document.documentElement.removeAttribute("lang");
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;
563
+ if (userLanguage) document.documentElement.setAttribute("lang", userLanguage);
564
+ var packageTranslations = preval.require("../../../configs/scripts/getPkgTranslations.js");
565
+ var commonsTranslations = {
566
+ en: {
567
+ translation: commonsEn
568
+ }
569
+ };
570
+ var resources = [hostTranslations, commonsTranslations, packageTranslations].reduce(ramda.mergeDeepLeft);
571
+ var defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
572
+ var defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
573
+ return [key, {
574
+ singular: null,
575
+ plural: null
576
+ }];
577
+ }));
578
+ var hostTaxonomies = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.taxonomies) || {};
579
+ exports.taxonomies = initializers_utils_utils.replaceNullValuesWithGetter(ramda.mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
580
+ i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).init({
581
+ resources: resources,
582
+ fallbackLng: "en",
583
+ interpolation: {
584
+ defaultVariables: {
585
+ taxonomies: exports.taxonomies
586
+ },
587
+ escapeValue: false,
588
+ skipOnVariables: false,
589
+ alwaysFormat: true,
590
+ format: function format(value, _format, lng, options) {
591
+ var newValue = value;
592
+ if (initializers_constants.LIST_FORMATS.includes(_format)) {
593
+ newValue = initializers_utils_customFormatters.listFormatter({
594
+ value: newValue,
595
+ format: _format,
596
+ lng: lng,
597
+ options: options
538
598
  });
539
- case 15:
540
- if (enableDirAttribute) {
541
- document.documentElement.setAttribute("dir", i18next.dir() || "ltr");
542
- }
543
- if (!userLanguage) {
544
- document.documentElement.setAttribute("lang", i18next.resolvedLanguage || "en");
545
- }
546
- case 17:
547
- case "end":
548
- return _context.stop();
599
+ return newValue;
600
+ }
601
+ return initializers_utils_customFormatters.lowerCaseDynamicTextFormatter(newValue, _format);
549
602
  }
550
- }, _callee);
551
- }));
552
- return function initializeI18n() {
553
- return _ref.apply(this, arguments);
554
- };
555
- }();
603
+ },
604
+ postProcess: [initializers_utils_customPostProcessors.sentenceCaseProcessor.name],
605
+ detection: {
606
+ order: ["querystring", "htmlTag", "navigator", "cookie"],
607
+ caches: ["cookie"],
608
+ lookupQuerystring: "lang",
609
+ lookupCookie: "lang"
610
+ }
611
+ });
612
+ if (enableDirAttribute) {
613
+ document.documentElement.setAttribute("dir", i18next.dir() || "ltr");
614
+ }
615
+ if (!userLanguage) {
616
+ document.documentElement.setAttribute("lang", i18next.resolvedLanguage || "en");
617
+ }
618
+ };
556
619
 
557
620
  exports.default = initializeI18n;
558
621
  //# sourceMappingURL=i18n.js.map