Add internationalization support with astro-i18next integration
- Implemented astro-i18next for multi-language support, including English, Dutch, and Italian. - Configured default locale and language fallback settings. - Defined routes for localized content in the configuration. - Updated package.json and package-lock.json to include new dependencies for i18next and related plugins.
This commit is contained in:
57
astro-i18next.config.mjs
Normal file
57
astro-i18next.config.mjs
Normal file
@@ -0,0 +1,57 @@
|
||||
/** @type {import('astro-i18next').AstroI18nextConfig} */
|
||||
export default {
|
||||
defaultLocale: "en",
|
||||
locales: ["en", "nl", "it"],
|
||||
namespaces: ["translation"],
|
||||
defaultNamespace: "translation",
|
||||
load: ["server", "client"],
|
||||
i18nextServer: {
|
||||
debug: true,
|
||||
initImmediate: false,
|
||||
supportedLngs: ["en", "nl", "it"],
|
||||
fallbackLng: "en",
|
||||
ns: ["translation"],
|
||||
defaultNS: "translation",
|
||||
resources: {
|
||||
en: {
|
||||
translation: () => import("../public/locales/en/translation.json")
|
||||
},
|
||||
nl: {
|
||||
translation: () => import("../public/locales/nl/translation.json")
|
||||
},
|
||||
it: {
|
||||
translation: () => import("../public/locales/it/translation.json")
|
||||
}
|
||||
}
|
||||
},
|
||||
i18nextClient: {
|
||||
debug: false,
|
||||
supportedLngs: ["en", "nl", "it"],
|
||||
fallbackLng: "en",
|
||||
ns: ["translation"],
|
||||
defaultNS: "translation"
|
||||
},
|
||||
routes: {
|
||||
en: {
|
||||
about: 'about',
|
||||
services: 'services',
|
||||
contact: 'contact',
|
||||
privacy: 'privacy',
|
||||
terms: 'terms'
|
||||
},
|
||||
nl: {
|
||||
about: 'over-ons',
|
||||
services: 'diensten',
|
||||
contact: 'contact',
|
||||
privacy: 'privacy',
|
||||
terms: 'voorwaarden'
|
||||
},
|
||||
it: {
|
||||
about: 'chi-siamo',
|
||||
services: 'servizi',
|
||||
contact: 'contatti',
|
||||
privacy: 'privacy',
|
||||
terms: 'termini'
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user