Closed gwendal5 closed 2 years ago
The locales have to be imported as import en from '$locales/en'
instead of '../locales/en.json'
in order for the svelteIntlPrecompile
-plugin to do it's magic.
@gwendal5 I edited your codesandbox: https://codesandbox.io/s/great-rubin-bjdelo?file=/src/routes/__layout.svelte
As @icalvin102 mentioned you should import from '$locales/fr'
instead of from '../locales/fr.json'
. Another thing that was wrong is that your configuration line (plugins: [precompileIntl("locales")]
) specified that your locales were in /locales
but you had them in /src/locales
instead. I moved them to the root of the project.
Hopefully this helps. I'm going to close this, please reopen if necessary.
Hello. I'm having a problem with the
$t(key, ops)
, it doesnt replace the parameters with the attributes I give it. Maybe I am missing something. Here is a codesandbox that shows the problem : https://codesandbox.io/s/falling-thunder-cdkpn1?file=/src/routes/__layout.svelte