Skip to content

Commit

Permalink
fix(overwrites): perform deep clone
Browse files Browse the repository at this point in the history
Signed-off-by: Till Sanders <mail@till-sanders.de>
  • Loading branch information
tillsanders committed Aug 22, 2022
1 parent 49c8938 commit 1292e4b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@open-election-compass/client",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.4",
"author": "Till Sanders <mail@till-sanders.de>",
"license": "GPL-3.0",
"main": "dist/open-election-compass.umd.min.js",
Expand Down
7 changes: 3 additions & 4 deletions src/store/modules/languages/languages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import getUserLocale from 'get-user-locale';
import i18n from '/src/locales/i18n';
import cloneDeep from 'lodash/cloneDeep';

const officialLanguages = ['ar', 'de', 'en', 'es', 'fr', 'hu', 'id', 'it', 'nl', 'pl', 'pt', 'tr'];

Expand Down Expand Up @@ -39,7 +40,7 @@ export default {
);
}
if (typeof language.overwrites === 'object' && language.overwrites !== null) {
i18n.global.mergeLocaleMessage(language.code, language.overwrites);
i18n.global.mergeLocaleMessage(language.code, cloneDeep(language.overwrites));
}
state.languages.push({
code: language.code,
Expand Down Expand Up @@ -70,10 +71,8 @@ export default {
...translations.content,
ui: translations.ui,
});
console.log('overwriting', language, language.overwrites);
if (typeof language.overwrites === 'object' && language.overwrites !== null) {
console.log('overwritten', language, language.overwrites);
i18n.global.mergeLocaleMessage(language.code, language.overwrites);
i18n.global.mergeLocaleMessage(language.code, cloneDeep(language.overwrites));
}
},
setFallbackLanguage(state, code) {
Expand Down

0 comments on commit 1292e4b

Please sign in to comment.