Remove unused components and models for improved maintainability
- 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.
This commit is contained in:
30
lib/i18n.ts
Normal file
30
lib/i18n.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
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};
|
||||
Reference in New Issue
Block a user