Closed juanjoseluisgarcia closed 1 year ago
Hello , i use sveltekit-i18n in my project and yes sveltekit-i18n support cultures.
/** @type {import('sveltekit-i18n').Config} */ const config = { fallbackLocale: defaultLocale, translations: { 'en-US': { languages }, 'fr-FR': { languages } }, loaders: [...translateEn, ...translateFr] };
And my loaders :)
Sorry for my English , i'm french :/
Apologies for the question. Would you mind to give me a schema on how the translateEn functions looks like? Thanks
Oh yes!
index.ts
const locale = 'en-us';
const translations = [
{
locale: locale,
key: 'common',
loader: async () => (await import('./common.json')).default
},
{
locale: locale,
key: 'global',
loader: async () => await import('./global.json')
},
{
locale: locale,
key: 'auth',
loader: async () => (await import('./auth.json')).default
},
{
locale: locale,
key: 'legal',
loader: async () => (await import('./legal.json')).default
}
];
export default translations;
I call translate in my +page.svelte => $t('auth.password')
I found out that culture is a very sensitive issue and different cultures like to see things in their own 'flavour' of the language and syntax. Is it possible to have different loaders based on this?