Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 8x 8x 8x | /**
* i18n Configuration
* Internationalization setup using react-i18next
*/
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
// Import translation files
import en from './locales/en.json';
import es from './locales/es.json';
import fr from './locales/fr.json';
import de from './locales/de.json';
export const supportedLanguages = [
{ code: 'en', name: 'English', flag: '🇺🇸' },
{ code: 'es', name: 'Español', flag: '🇪🇸' },
{ code: 'fr', name: 'Français', flag: '🇫🇷' },
{ code: 'de', name: 'Deutsch', flag: '🇩🇪' },
] as const;
export type SupportedLanguage = typeof supportedLanguages[number]['code'];
const resources = {
en: { translation: en },
es: { translation: es },
fr: { translation: fr },
de: { translation: de },
};
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources,
fallbackLng: 'en',
debug: false, // Disable debug logging
interpolation: {
escapeValue: false, // React already escapes values
},
detection: {
// Order of language detection
order: ['localStorage', 'navigator', 'htmlTag'],
// Cache user language preference
caches: ['localStorage'],
lookupLocalStorage: 'smoothschedule_language',
},
});
export default i18n;
|