enable i18n
support for russian-only
This commit is contained in:
@ -15,6 +15,7 @@ import {Login} from './pages/login'
|
||||
import {Register} from './pages/register'
|
||||
import {ForgotPassword} from './pages/forgotPassword'
|
||||
import {authProvider} from './authProvider'
|
||||
import {i18nProvider} from './i18nProvider'
|
||||
|
||||
import {CountryList, CountryCreate, CountryEdit, CountryShow} from './pages/country'
|
||||
import {CityList, CityCreate, CityEdit, CityShow} from './pages/city'
|
||||
@ -43,6 +44,7 @@ function App() {
|
||||
notificationProvider={useNotificationProvider}
|
||||
routerProvider={routerBindings}
|
||||
authProvider={authProvider}
|
||||
i18nProvider={i18nProvider}
|
||||
resources={[
|
||||
{
|
||||
name: 'country',
|
||||
|
24
src/i18nProvider.ts
Normal file
24
src/i18nProvider.ts
Normal file
@ -0,0 +1,24 @@
|
||||
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,
|
||||
}
|
18
src/locales/ru/translation.json
Normal file
18
src/locales/ru/translation.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"actions": {
|
||||
"create": "Создать",
|
||||
"show": "Просмотр",
|
||||
"edit": "Редактировать",
|
||||
"delete": "Удалить",
|
||||
"save": "Сохранить"
|
||||
},
|
||||
"buttons": {
|
||||
"edit": "Редактировать",
|
||||
"refresh": "Обновить",
|
||||
"delete": "Удалить",
|
||||
"save": "Сохранить",
|
||||
"submit": "Отправить",
|
||||
"create": "Создать",
|
||||
"logout": "Выход"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user