mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 22:19:36 +02:00
fix: tsc
This commit is contained in:
@@ -1,36 +1,11 @@
|
|||||||
import i18n, { ParseKeys } from 'i18next';
|
import i18n, { ParseKeys } from 'i18next';
|
||||||
import { initReactI18next } from 'react-i18next';
|
import { initReactI18next } from 'react-i18next';
|
||||||
import enGlobal from './en.json';
|
|
||||||
import hiGlobal from './hi.json';
|
|
||||||
import enList from '../pages/tools/list/i18n/en.json';
|
|
||||||
import hiList from '../pages/tools/list/i18n/hi.json';
|
|
||||||
import enString from '../pages/tools/string/i18n/en.json';
|
|
||||||
import hiString from '../pages/tools/string/i18n/hi.json';
|
|
||||||
import enCsv from '../pages/tools/csv/i18n/en.json';
|
|
||||||
import hiCsv from '../pages/tools/csv/i18n/hi.json';
|
|
||||||
import enJson from '../pages/tools/json/i18n/en.json';
|
|
||||||
import hiJson from '../pages/tools/json/i18n/hi.json';
|
|
||||||
import enPdf from '../pages/tools/pdf/i18n/en.json';
|
|
||||||
import hiPdf from '../pages/tools/pdf/i18n/hi.json';
|
|
||||||
import enImage from '../pages/tools/image/i18n/en.json';
|
|
||||||
import hiImage from '../pages/tools/image/i18n/hi.json';
|
|
||||||
import enAudio from '../pages/tools/audio/i18n/en.json';
|
|
||||||
import hiAudio from '../pages/tools/audio/i18n/hi.json';
|
|
||||||
import enVideo from '../pages/tools/video/i18n/en.json';
|
|
||||||
import hiVideo from '../pages/tools/video/i18n/hi.json';
|
|
||||||
import enNumber from '../pages/tools/number/i18n/en.json';
|
|
||||||
import hiNumber from '../pages/tools/number/i18n/hi.json';
|
|
||||||
import enTime from '../pages/tools/time/i18n/en.json';
|
|
||||||
import hiTime from '../pages/tools/time/i18n/hi.json';
|
|
||||||
import enXml from '../pages/tools/xml/i18n/en.json';
|
|
||||||
import hiXml from '../pages/tools/xml/i18n/hi.json';
|
|
||||||
import Backend from 'i18next-http-backend';
|
import Backend from 'i18next-http-backend';
|
||||||
|
|
||||||
const isDevelopment = !import.meta.env.PROD;
|
const isDevelopment = !import.meta.env.PROD;
|
||||||
const isContributor = import.meta.env.VITE_CONTRIBUTOR_MODE === 'true';
|
const isContributor = import.meta.env.VITE_CONTRIBUTOR_MODE === 'true';
|
||||||
|
|
||||||
const useLocize = isDevelopment && isContributor;
|
const useLocize = isDevelopment && isContributor;
|
||||||
|
|
||||||
if (useLocize) {
|
if (useLocize) {
|
||||||
const { default: LocizeBackend } = await import('i18next-locize-backend');
|
const { default: LocizeBackend } = await import('i18next-locize-backend');
|
||||||
i18n.use(LocizeBackend);
|
i18n.use(LocizeBackend);
|
||||||
@@ -47,38 +22,20 @@ const locizeOptions = {
|
|||||||
version: 'latest'
|
version: 'latest'
|
||||||
};
|
};
|
||||||
// Merge translations for demonstration; in a real app, use namespaces
|
// Merge translations for demonstration; in a real app, use namespaces
|
||||||
export 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
|
|
||||||
},
|
|
||||||
hi: {
|
|
||||||
translation: hiGlobal,
|
|
||||||
list: hiList,
|
|
||||||
string: hiString,
|
|
||||||
csv: hiCsv,
|
|
||||||
json: hiJson,
|
|
||||||
pdf: hiPdf,
|
|
||||||
image: hiImage,
|
|
||||||
audio: hiAudio,
|
|
||||||
video: hiVideo,
|
|
||||||
number: hiNumber,
|
|
||||||
time: hiTime,
|
|
||||||
xml: hiXml
|
|
||||||
}
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type I18nNamespaces = keyof (typeof resources)['en'];
|
export type I18nNamespaces =
|
||||||
|
| 'translation'
|
||||||
|
| 'list'
|
||||||
|
| 'string'
|
||||||
|
| 'csv'
|
||||||
|
| 'json'
|
||||||
|
| 'pdf'
|
||||||
|
| 'image'
|
||||||
|
| 'audio'
|
||||||
|
| 'video'
|
||||||
|
| 'number'
|
||||||
|
| 'time'
|
||||||
|
| 'xml';
|
||||||
export type FullI18nKey = {
|
export type FullI18nKey = {
|
||||||
[K in I18nNamespaces]: `${K}:${ParseKeys<K>}`;
|
[K in I18nNamespaces]: `${K}:${ParseKeys<K>}`;
|
||||||
}[I18nNamespaces];
|
}[I18nNamespaces];
|
||||||
|
Reference in New Issue
Block a user