Closed Ebeldev closed 3 years ago
I too am getting the same warnings when start my server The message "text" was not found in "", "en".
, but my application loads with all of my messages correctly.
@Ebeldev I think in the hooks it is a typo, just rename the return to { acceptedLocale }
It is a typo indeed. Fixing it.
Fixed. Thanks for reporting it.
I missed the other points.
precompileIntl('src/locales')
in you svelte.config.js file. The argument passed in is the path to the folder containing the locales.context="module"
. I might be missing why you think that.@cibernox Thank you for your response.
I did adjust the svelte.config.js,
`import preprocess from 'svelte-preprocess'; import precompileIntl from "svelte-intl-precompile/sveltekit-plugin.js"; import typescript from '@rollup/plugin-typescript';
const production = !process.env.ROLLUP_WATCH /* @type {import('@sveltejs/kit').Config} / const config = { // Consult https://github.com/sveltejs/svelte-preprocess // for more information about preprocessors preprocess: preprocess({
}),
kit: {
// hydrate the <div id="svelte"> element in src/app.html
target: '#svelte',
vite: {
plugins: [
precompileIntl('src/locales'), // if your translations are defined in /locales/[lang].js,
typescript({
sourceMap: !production,
inlineSources: !production
})
]
}
}
};
export default config;`
But after restarting the server, I still get the The message 'name of my variable' was not found in''.
Hooks.js
export function getSession(request) { let acceptedLocale = request.headers["accept-language"].split(',')[0]; return { acceptedLocale }; }
_layout.svelte `
`
index.svelte `
Visit kit.svelte.dev to read the documentation
`
fr.js
export default { "general": { "site_name": "Le blog d'Etienne" }, "home": { "title": "Page d'accueil" }, "test": "Je sais pas ", }
My mistake. I was using _layout.svelte and not __layout.svelte.
Double underline that was my mistake.
Glad you figured it out 😃
I have followed the steps on the instruction how to set up but I do get a few errors.
So for me it doesn't work in sveltekit so far.
Thank you for your help.