@bigbinary/neeto-commons-frontend 2.1.22 → 2.1.24
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/babel.js +1 -0
- package/configs/eslint/globals.js +1 -0
- package/configs/nanos/eslint/index.js +12 -6
- package/configs/nanos/webpack/resolve.js +5 -1
- package/configs/scripts/getPkgTranslations.js +38 -0
- package/configs/webpack/rules.js +7 -8
- package/initializers.cjs.js +9 -24
- package/initializers.cjs.js.map +1 -1
- package/initializers.js +10 -25
- package/initializers.js.map +1 -1
- package/package.json +1 -1
- package/react-utils.d.ts +6 -4
package/initializers.js
CHANGED
|
@@ -5,7 +5,7 @@ import i18n from 'i18next';
|
|
|
5
5
|
import { serializeKeysToSnakeCase, keysToCamelCase, matches, deepFreezeObject } from '@bigbinary/neeto-commons-frontend/pure';
|
|
6
6
|
import { resetAuthTokens } from '@bigbinary/neeto-commons-frontend/utils';
|
|
7
7
|
import { Toastr } from '@bigbinary/neetoui';
|
|
8
|
-
import { evolve, omit, values, mergeDeepLeft
|
|
8
|
+
import { evolve, omit, values, mergeDeepLeft } from 'ramda';
|
|
9
9
|
import { initReactI18next } from 'react-i18next';
|
|
10
10
|
import Logger from 'js-logger';
|
|
11
11
|
|
|
@@ -2393,18 +2393,6 @@ var commonsEn = {
|
|
|
2393
2393
|
neetoCommons: neetoCommons
|
|
2394
2394
|
};
|
|
2395
2395
|
|
|
2396
|
-
var packageNames = ["neeto-molecules", "neeto-integrations-frontend", "neeto-team-members-frontend", "neeto-tags-frontend", "neeto-form-frontend"];
|
|
2397
|
-
var getPackageTranslations = function getPackageTranslations(language, packageNames) {
|
|
2398
|
-
var loadTranslations = curry(function (language, packageName) {
|
|
2399
|
-
try {
|
|
2400
|
-
return require("../".concat(packageName, "/src/translations/").concat(language, ".json"));
|
|
2401
|
-
} catch (_unused) {
|
|
2402
|
-
return {};
|
|
2403
|
-
}
|
|
2404
|
-
});
|
|
2405
|
-
var allTranslations = packageNames.map(loadTranslations(language));
|
|
2406
|
-
return mergeAll(allTranslations);
|
|
2407
|
-
};
|
|
2408
2396
|
var sentenceCasePlaceholderAndTypographyProcessor = {
|
|
2409
2397
|
type: "postProcessor",
|
|
2410
2398
|
name: "sentenceCasePlaceholderAndTypography",
|
|
@@ -2417,20 +2405,17 @@ var sentenceCasePlaceholderAndTypographyProcessor = {
|
|
|
2417
2405
|
return value;
|
|
2418
2406
|
}
|
|
2419
2407
|
};
|
|
2420
|
-
var
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2408
|
+
var commonsTranslations = {
|
|
2409
|
+
en: {
|
|
2410
|
+
translation: commonsEn
|
|
2411
|
+
}
|
|
2412
|
+
};
|
|
2413
|
+
var initializeI18n = function initializeI18n(hostTranslations) {
|
|
2424
2414
|
var _i18n$services$format;
|
|
2415
|
+
var packageTranslations = preval.require("./configs/scripts/getPkgTranslations.js");
|
|
2416
|
+
var resources = [hostTranslations, commonsTranslations, packageTranslations].reduce(mergeDeepLeft);
|
|
2425
2417
|
i18n.use(Browser).use(initReactI18next).use(sentenceCasePlaceholderAndTypographyProcessor).init({
|
|
2426
|
-
resources:
|
|
2427
|
-
en: {
|
|
2428
|
-
translation: en
|
|
2429
|
-
},
|
|
2430
|
-
de: {
|
|
2431
|
-
translation: de
|
|
2432
|
-
}
|
|
2433
|
-
}),
|
|
2418
|
+
resources: resources,
|
|
2434
2419
|
fallbackLng: "en",
|
|
2435
2420
|
interpolation: {
|
|
2436
2421
|
escapeValue: false,
|