Fix initialDictionary initialization

This commit is contained in:
Christian Kaisermann 2018-08-14 15:23:41 -03:00
parent 38dcecb724
commit 7dd50b7cf3
2 changed files with 4 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "svelte-i18n",
"version": "0.0.4",
"version": "0.0.5",
"license": "MIT",
"main": "dist/i18n.js",
"module": "dist/i18n.m.js",

View File

@ -7,8 +7,10 @@ export { capital, title, upper, lower }
export function i18n(store, { dictionary: initialDictionary }) {
const formatter = new Formatter()
let dictionary
let currentLocale
let dictionary = Array.isArray(initialDictionary)
? deepmerge.all(initialDictionary)
: initialDictionary
const getLocalizedMessage = (
path,
@ -94,11 +96,5 @@ export function i18n(store, { dictionary: initialDictionary }) {
},
}
if (Array.isArray(initialDictionary)) {
dictionary = deepmerge.all(initialDictionary)
} else {
initialDictionary = dictionary
}
return store
}