mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-10-06 02:54:49 +02:00
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import merge from 'deepmerge'
|
|
|
|
import { GetClientLocaleOptions, MessageObject } from './types'
|
|
import { getClientLocale } from './includes/utils'
|
|
import { $locale } from './stores/locale'
|
|
|
|
// defineMessages allow us to define and extract dynamic message ids
|
|
export function defineMessages(i: Record<string, MessageObject>) {
|
|
return i
|
|
}
|
|
|
|
export function waitInitialLocale(options: GetClientLocaleOptions | string) {
|
|
if (typeof options === 'string') {
|
|
return $locale.set(options)
|
|
}
|
|
return $locale.set(getClientLocale(options))
|
|
}
|
|
|
|
export { $locale as locale, loadLocale as preloadLocale } from './stores/locale'
|
|
export {
|
|
$dictionary as dictionary,
|
|
$locales as locales,
|
|
addMessages,
|
|
} from './stores/dictionary'
|
|
export { $isLoading as isLoading } from './stores/loading'
|
|
export { $format as format, $format as _, $format as t } from './stores/format'
|
|
|
|
// utilities
|
|
export { getClientLocale, merge }
|
|
export { customFormats, addCustomFormats } from './includes/formats'
|
|
export {
|
|
flushQueue as waitLocale,
|
|
registerLocaleLoader as register,
|
|
} from './includes/loaderQueue'
|