mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-11-16 18:10:43 +01:00
Merge branch 'master' of github.com:kaisermann/svelte-i18n
This commit is contained in:
commit
38dcecb724
@ -7,7 +7,7 @@ export { capital, title, upper, lower }
|
||||
|
||||
export function i18n(store, { dictionary: initialDictionary }) {
|
||||
const formatter = new Formatter()
|
||||
let dictionary = {}
|
||||
let dictionary
|
||||
let currentLocale
|
||||
|
||||
const getLocalizedMessage = (
|
||||
@ -94,7 +94,11 @@ export function i18n(store, { dictionary: initialDictionary }) {
|
||||
},
|
||||
}
|
||||
|
||||
store.i18n.extendDictionary(initialDictionary)
|
||||
if (Array.isArray(initialDictionary)) {
|
||||
dictionary = deepmerge.all(initialDictionary)
|
||||
} else {
|
||||
initialDictionary = dictionary
|
||||
}
|
||||
|
||||
return store
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { i18n } from '../src/index'
|
||||
import { Store } from 'svelte/store.umd'
|
||||
import { capital, title, upper, lower, isObject } from '../src/utils'
|
||||
|
||||
const store = new Store()
|
||||
let store = new Store()
|
||||
const locales = {
|
||||
'pt-br': {
|
||||
test: 'teste',
|
||||
@ -30,11 +30,8 @@ const locales = {
|
||||
},
|
||||
}
|
||||
|
||||
i18n(store, { dictionary: locales })
|
||||
i18n(store, { dictionary: [locales] })
|
||||
|
||||
/**
|
||||
* Dummy test
|
||||
*/
|
||||
describe('Utilities', () => {
|
||||
it('should check if a variable is an object', () => {
|
||||
expect(isObject({})).toBe(true)
|
||||
|
Loading…
Reference in New Issue
Block a user