mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-11-16 09:59:58 +01:00
refactor: 💡 rename addMessagesTo to addMessages
This commit is contained in:
parent
6ee28e7d27
commit
06946ee3d1
@ -2,7 +2,7 @@ import { MessagesLoader } from '../types'
|
||||
import {
|
||||
hasLocaleDictionary,
|
||||
$dictionary,
|
||||
addMessagesTo,
|
||||
addMessages,
|
||||
} from '../stores/dictionary'
|
||||
import { getCurrentLocale } from '../stores/locale'
|
||||
import { $isLoading } from '../stores/loading'
|
||||
@ -62,7 +62,7 @@ export async function flushQueue(locale: string = getCurrentLocale()) {
|
||||
partials = partials.map(partial => partial.default || partial)
|
||||
|
||||
removeFromLookupCache(locale)
|
||||
addMessagesTo(locale, ...partials)
|
||||
addMessages(locale, ...partials)
|
||||
})
|
||||
.then(() => {
|
||||
clearTimeout(loadingDelay)
|
||||
|
@ -20,7 +20,7 @@ export { $locale as locale, loadLocale as preloadLocale } from './stores/locale'
|
||||
export {
|
||||
$dictionary as dictionary,
|
||||
$locales as locales,
|
||||
addMessagesTo,
|
||||
addMessages,
|
||||
} from './stores/dictionary'
|
||||
export { $isLoading as isLoading } from './stores/loading'
|
||||
export { $format as format, $format as _, $format as t } from './stores/format'
|
||||
|
@ -18,7 +18,7 @@ function hasLocaleDictionary(locale: string) {
|
||||
return locale in dictionary
|
||||
}
|
||||
|
||||
function addMessagesTo(locale: string, ...partials: LocaleDictionary[]) {
|
||||
function addMessages(locale: string, ...partials: LocaleDictionary[]) {
|
||||
$dictionary.update(d => {
|
||||
dictionary[locale] = merge.all([dictionary[locale] || {}].concat(partials))
|
||||
return d
|
||||
@ -34,5 +34,5 @@ export {
|
||||
$locales,
|
||||
getDictionary,
|
||||
hasLocaleDictionary,
|
||||
addMessagesTo,
|
||||
addMessages,
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// todo this is a mess
|
||||
// TODO remake this, it's a mess
|
||||
import { Formatter } from '../../src/client/types'
|
||||
import {
|
||||
dictionary,
|
||||
|
Loading…
Reference in New Issue
Block a user