Commit c231d789 authored by Matija Obreza's avatar Matija Obreza
Browse files

Using lodash _merge

parent be1285f5
import _merge from 'lodash/merge';
export interface WithConfig {
appConfig: Config;
}
......@@ -28,13 +29,13 @@ export class Config {
this.i18n = config.i18n || defaultConfig.i18n;
// Merge feature config
this.accession = { ...defaultConfig.accession, ...config.accession };
this.shoppingCart = { ...defaultConfig.shoppingCart, ...config.shoppingCart };
this.accession = _merge(defaultConfig.accession, config.accession);
this.shoppingCart = _merge(defaultConfig.shoppingCart, config.shoppingCart);
if (!this.captchaSiteKey) {
// Force disable shopping cart if captchaSiteKey is missing
this.shoppingCart.enabled = false;
}
this.map = { ...defaultConfig.map, ...config.map };
this.map = _merge(defaultConfig.map, config.map);
// console.log('Source and merged configuration', config, this);
}
}
......
import i18n from 'i18next';
import * as _ from 'lodash';
import _merge from 'lodash/merge';
// import HttpApi from 'i18next-http-backend';
import { initReactI18next } from 'react-i18next';
import transEn from 'locales/en/translations.json';
......@@ -45,7 +45,7 @@ const initI18n = (language = 'en', translations?: { [key: string]: Translations
react: {
useSuspense: false,
},
resources: _.merge(resources, translations),
resources: _merge(resources, translations),
// partialBundledLanguages: true,
// backend: loaderOptions, // backend options
interpolation: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment