mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-24 08:29:32 +02:00
feat: add internationalization support
This commit is contained in:
45
src/i18n/index.ts
Normal file
45
src/i18n/index.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
import enGlobal from './en.json';
|
||||
import enList from '../pages/tools/list/i18n/en.json';
|
||||
import enString from '../pages/tools/string/i18n/en.json';
|
||||
import enCsv from '../pages/tools/csv/i18n/en.json';
|
||||
import enJson from '../pages/tools/json/i18n/en.json';
|
||||
import enPdf from '../pages/tools/pdf/i18n/en.json';
|
||||
import enImage from '../pages/tools/image/i18n/en.json';
|
||||
import enAudio from '../pages/tools/audio/i18n/en.json';
|
||||
import enVideo from '../pages/tools/video/i18n/en.json';
|
||||
import enNumber from '../pages/tools/number/i18n/en.json';
|
||||
import enTime from '../pages/tools/time/i18n/en.json';
|
||||
import enXml from '../pages/tools/xml/i18n/en.json';
|
||||
|
||||
// Merge translations for demonstration; in a real app, use namespaces
|
||||
const resources = {
|
||||
en: {
|
||||
translation: {
|
||||
...enGlobal,
|
||||
list: enList,
|
||||
string: enString,
|
||||
csv: enCsv,
|
||||
json: enJson,
|
||||
pdf: enPdf,
|
||||
image: enImage,
|
||||
audio: enAudio,
|
||||
video: enVideo,
|
||||
number: enNumber,
|
||||
time: enTime,
|
||||
xml: enXml
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
i18n.use(initReactI18next).init({
|
||||
resources,
|
||||
lng: 'en',
|
||||
fallbackLng: 'en',
|
||||
interpolation: {
|
||||
escapeValue: false
|
||||
}
|
||||
});
|
||||
|
||||
export default i18n;
|
Reference in New Issue
Block a user