Switching language
For language management, the Tolgee integration provides the getTolgee
function. Use this function with subscription to the language
event. Below is an example of how to use it for switching languages.
<script>
import { getTolgee } from '@tolgee/svelte';
const tolgee = getTolgee(['language'])
function handleLanguageChange(e) {
$tolgee.changeLanguage(e.currentTarget.value)
}
</script>
<select value={$tolgee.getLanguage()} on:change={handleLanguageChange}>
...
</select>
Read more about Language change, detection and storage