Closed mr-islam closed 3 years ago
Basically, set a local storage item for user chosen langauge whenever $locale changes (for any reason, most likely language picker dropdown)
And load that as the first choice in the i18n.js init options, with fetching the navigator as a fallback (for first time visitors)
Really loved the example from svelte-i18n, makes life so easy: https://github.com/kaisermann/sapper-template-i18n/blob/master/src/i18n.js
Basically, set a local storage item for user chosen langauge whenever $locale changes (for any reason, most likely language picker dropdown)
And load that as the first choice in the i18n.js init options, with fetching the navigator as a fallback (for first time visitors)