mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-11-16 09:59:58 +01:00
chore: 🤖 use new register and waitLocale methods
This commit is contained in:
parent
bd2b3501e9
commit
3dce407f4f
@ -22,9 +22,9 @@
|
||||
|
||||
## TODO - WIP
|
||||
|
||||
- [ ] Maybe locale can be a promise so we can await for it on the template;
|
||||
- [x] Maybe locale can be a promise so we can await for it on the template;
|
||||
- [ ] Wiki on github;
|
||||
- [ ] Find a more flexible way to preload dictionaries so it's possible to preload partial dictionaries.
|
||||
- [x] Find a more flexible way to preload dictionaries so it's possible to preload partial dictionaries.
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { registerLocaleLoader } from 'svelte-i18n'
|
||||
import { register } from 'svelte-i18n'
|
||||
|
||||
registerLocaleLoader('en', () => import('../messages/en.json'))
|
||||
registerLocaleLoader('pt-BR', () => import('../messages/pt-BR.json'))
|
||||
registerLocaleLoader('en-US', () => import('../messages/en-US.json'))
|
||||
registerLocaleLoader('es-ES', () => import('../messages/es-ES.json'))
|
||||
register('en', () => import('../messages/en.json'))
|
||||
register('pt-BR', () => import('../messages/pt-BR.json'))
|
||||
register('en-US', () => import('../messages/en-US.json'))
|
||||
register('es-ES', () => import('../messages/es-ES.json'))
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script context="module">
|
||||
import { locale, locales, getClientLocale } from 'svelte-i18n'
|
||||
import { locale, locales, getClientLocale, waitLocale } from 'svelte-i18n'
|
||||
import Lang from 'svelte-i18n/Lang.svelte'
|
||||
|
||||
export async function preload() {
|
||||
|
@ -1,12 +1,12 @@
|
||||
<script context="module">
|
||||
import { registerLocaleLoader, flushLocaleQueue } from 'svelte-i18n'
|
||||
import { register, waitLocale } from 'svelte-i18n'
|
||||
|
||||
registerLocaleLoader('en-US', () => import('./_locales/en-US.json'))
|
||||
registerLocaleLoader('pt-BR', () => import('./_locales/pt-BR.json'))
|
||||
registerLocaleLoader('es-ES', () => import('./_locales/es-ES.json'))
|
||||
register('en-US', () => import('./_locales/en-US.json'))
|
||||
register('pt-BR', () => import('./_locales/pt-BR.json'))
|
||||
register('es-ES', () => import('./_locales/es-ES.json'))
|
||||
|
||||
export async function preload() {
|
||||
return flushLocaleQueue()
|
||||
return waitLocale()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user