- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files. - Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter. - Updated project structure and references to reflect these removals.
31 lines
841 B
TypeScript
31 lines
841 B
TypeScript
import i18n from 'i18next';
|
|
import {initReactI18next, useTranslation} from 'react-i18next';
|
|
import fr from '@/lib/locales/fr.json';
|
|
import en from '@/lib/locales/en.json';
|
|
|
|
i18n.use(initReactI18next).init({
|
|
resources: {
|
|
fr: {translation: fr},
|
|
en: {translation: en},
|
|
},
|
|
lng: 'fr',
|
|
fallbackLng: 'fr',
|
|
interpolation: {escapeValue: false},
|
|
});
|
|
|
|
export function useTranslations(namespace?: string) {
|
|
const {t} = useTranslation();
|
|
if (namespace) {
|
|
return (key: string, params?: Record<string, unknown>) =>
|
|
t(`${namespace}.${key}`, params as Record<string, string>);
|
|
}
|
|
return (key: string, params?: Record<string, unknown>) =>
|
|
t(key, params as Record<string, string>);
|
|
}
|
|
|
|
export function changeLanguage(lang: string) {
|
|
i18n.changeLanguage(lang);
|
|
}
|
|
|
|
export {i18n};
|