mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-06-30 18:54:49 +02:00
Fix initialDictionary initialization
This commit is contained in:
parent
38dcecb724
commit
7dd50b7cf3
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "svelte-i18n",
|
"name": "svelte-i18n",
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/i18n.js",
|
"main": "dist/i18n.js",
|
||||||
"module": "dist/i18n.m.js",
|
"module": "dist/i18n.m.js",
|
||||||
|
|
10
src/index.js
10
src/index.js
|
@ -7,8 +7,10 @@ export { capital, title, upper, lower }
|
||||||
|
|
||||||
export function i18n(store, { dictionary: initialDictionary }) {
|
export function i18n(store, { dictionary: initialDictionary }) {
|
||||||
const formatter = new Formatter()
|
const formatter = new Formatter()
|
||||||
let dictionary
|
|
||||||
let currentLocale
|
let currentLocale
|
||||||
|
let dictionary = Array.isArray(initialDictionary)
|
||||||
|
? deepmerge.all(initialDictionary)
|
||||||
|
: initialDictionary
|
||||||
|
|
||||||
const getLocalizedMessage = (
|
const getLocalizedMessage = (
|
||||||
path,
|
path,
|
||||||
|
@ -94,11 +96,5 @@ export function i18n(store, { dictionary: initialDictionary }) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(initialDictionary)) {
|
|
||||||
dictionary = deepmerge.all(initialDictionary)
|
|
||||||
} else {
|
|
||||||
initialDictionary = dictionary
|
|
||||||
}
|
|
||||||
|
|
||||||
return store
|
return store
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user