From ecb73e1684b42265af3f8d93541600e4d0f9c414 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Tue, 24 Jun 2025 16:14:28 +0200 Subject: Implement i18n Closes #18 --- src/frontend/app/i18n/index.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/frontend/app/i18n/index.ts (limited to 'src/frontend/app/i18n/index.ts') diff --git a/src/frontend/app/i18n/index.ts b/src/frontend/app/i18n/index.ts new file mode 100644 index 0000000..a7ba6aa --- /dev/null +++ b/src/frontend/app/i18n/index.ts @@ -0,0 +1,31 @@ +import i18n from 'i18next'; +import { initReactI18next } from 'react-i18next'; +import LanguageDetector from 'i18next-browser-languagedetector'; +import esES from './locales/es-ES.json'; +import glES from './locales/gl-ES.json'; +import enGB from './locales/en-GB.json'; + +// Add more languages as needed +const resources = { + 'es-ES': { translation: esES }, + 'gl-ES': { translation: glES }, + 'en-GB': { translation: enGB }, +}; + +i18n + .use(LanguageDetector) + .use(initReactI18next) + .init({ + resources, + fallbackLng: 'es-ES', + interpolation: { + escapeValue: false, + }, + supportedLngs: ['es-ES', 'gl-ES', 'en-GB'], + detection: { + order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag'], + caches: ['localStorage', 'cookie'], + }, + }); + +export default i18n; -- cgit v1.3