I am using Svelte 3 + Snowpack 3 + Routify + Svelte-i18n. I am not using Sapper. I installed everything with this template. And this is my repo where you can see all my files.
I am following the official tutorial of svelte-i18n.
Problem: I can't translate my page with their tutorial. I want it to work async because I will have lots of translations for lots of pages.
But when I use this script in my .svelte
file it just works:
import { _ } from 'svelte-i18n';
import { addMessages, init } from "svelte-i18n";
import en from "./lang/en.json";
import az from "./lang/az.json";
addMessages("en", en);
addMessages("az", az);
init({
initialLocale: "az",
});
When I delete it and use only this as they suggest, I get a blank screen without any error:
import { _ } from 'svelte-i18n';
Everything other than that is exactly the same as the tutorial. I suspect the source of reason in _layout.svelte
file as I don't know what is that for. And as my researches, it is something related to Sapper. I don't know if Snowpack uses it but maybe I need to make some changes to make it work with Snowpack. Also, it looks like the tutorial is written Sapper in mind as they call its name several times.