25 lines
578 B
TypeScript
25 lines
578 B
TypeScript
import i18n from 'i18next'
|
|
import {initReactI18next} from 'react-i18next'
|
|
import {I18nProvider} from '@refinedev/core'
|
|
|
|
import translationRU from './locales/ru/translation.json'
|
|
|
|
i18n.use(initReactI18next).init({
|
|
resources: {
|
|
ru: {
|
|
translation: translationRU,
|
|
},
|
|
},
|
|
lng: 'ru',
|
|
fallbackLng: 'ru',
|
|
interpolation: {
|
|
escapeValue: false,
|
|
},
|
|
})
|
|
|
|
export const i18nProvider: I18nProvider = {
|
|
translate: (key, options) => i18n.t(key, options) as string,
|
|
changeLocale: (locale: string) => i18n.changeLanguage(locale),
|
|
getLocale: () => i18n.language,
|
|
}
|