语言配置文件改到public下

dev/i18n
Lei OT 1 year ago
parent 7e0773fcb2
commit 353e713827

@ -13,6 +13,7 @@
"antd": "^5.4.2",
"i18next": "^23.11.5",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-http-backend": "^2.5.2",
"mobx": "^6.9.0",
"mobx-react": "^7.6.0",
"react": "^18.2.0",

@ -0,0 +1,71 @@
{
"lang": {
"en": "English",
"zh": "中文"
},
"menu": {
"Reservation": "Reservation",
"Invoice": "Invoice",
"Feedback": "Feedback",
"Notice": "Notice"
},
"loginAction": {
"ChangePassword": "Change password",
"Profile": "Profile",
"Logout": "Logout",
"ChangeVendor": "Change Vendor",
"LoginTimeout": "Login timeout",
"LoginTimeoutTip": "Please input your password"
},
"common": {
"Search": "Search",
"Reset": "Reset",
"Cancel": "Cancel",
"Submit": "Submit",
"Confirm": "Confirm",
"Close": "Close",
"Save": "Save",
"Edit": "Edit",
"Delete": "Delete",
"Add": "Add",
"View": "View",
"Back": "Back",
"Download": "Download",
"Login": "Login"
},
"form": {
"Username": "Username",
"Password": "Password"
},
"datetime": {
"thisWeek": "This Week",
"lastWeek": "Last Week",
"thisMonth": "This Month",
"lastMonth": "Last Month",
"lastThreeMonth": "Last Three Month",
"thisYear": "This Year"
},
"group": {
"ArrivalDate": "Arrival Date",
"RefNo": "Reference number",
"Pax": "Pax",
"Status": "Status",
"City": "City",
"Guide": "Guide",
"ResSendingDate": "Res. sending date",
"3DGuideTip": "Reservations without the tour guide information will be highlighted in red if the arrival date is within 3 days.",
"Attachments": "Attachments",
"ConfirmationDate": "Confirmation Date",
"ConfirmationDetails": "Confirmation Details",
"Rate Code": "Rate Code",
"Rate Plan": "Rate Plan",
"Rate Type": "Rate Type",
"Rate Category": "Rate Category",
"Rate Class": "Rate Class",
"Rate Family": "Rate Family",
"Rate Group": "Rate Group",
"Rate Sub Group": "Rate Sub Group",
"Rate Sub Group Code": "Rate Sub Group Code"
}
}

@ -0,0 +1,63 @@
{
"lang": {
"en": "English",
"zh": "中文"
},
"menu": {
"Reservation": "团预订",
"Invoice": "账单",
"Feedback": "反馈表",
"Notice": "通知"
},
"loginAction": {
"ChangePassword": "修改密码",
"Profile": "账户中心",
"Logout": "退出",
"ChangeVendor": "切换账户",
"LoginTimeout": "登录超时",
"LoginTimeoutTip": "请输入密码"
},
"common": {
"Search": "查询",
"Reset": "重置",
"Cancel": "取消",
"Submit": "提交",
"Confirm": "确认",
"Close": "关闭",
"Save": "保存",
"Edit": "编辑",
"Delete": "删除",
"Add": "添加",
"View": "查看",
"Back": "返回",
"Download": "下载",
"Login": "登录"
},
"form": {
"Username": "账户名",
"Password": "密码"
},
"datetime": {
"thisWeek": "本周",
"lastWeek": "上周",
"thisMonth": "本月",
"lastMonth": "上月",
"lastThreeMonth": "前三个月",
"thisYear": "今年"
},
"group": {
"ArrivalDate": "抵达日期",
"RefNo": "团号",
"Pax": "人数",
"Status": "状态",
"City": "城市",
"Guide": "导游",
"ResSendingDate": "发送时间",
"3DGuideTip": "红色突出显示:抵达日期在 3 天内,没有导游信息的预订。",
"Attachments": "附件",
"ConfirmationDate": "确认日期",
"ConfirmationDetails": "确认信息",
"Rate Code": "Rate Code"
}
}

@ -3,24 +3,29 @@ import i18n from 'i18next';
// https://github.com/i18next/i18next-browser-languageDetector
// localStorage.getItem('i18nextLng')
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-http-backend';
import { initReactI18next } from 'react-i18next';
import en from './locales/en.json';
import zh from './locales/zh.json';
// import en from './locales/en.json';
// import zh from './locales/zh.json';
i18n
.use(initReactI18next)
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
// https://www.i18next.com/overview/configuration-options
.init({
backend: {
loadPath: '/locales/{{lng}}.json',
},
// detection: {
// convertDetectedLanguage: 'Iso15897',
// convertDetectedLanguage: (lng) => lng.replace('-', '_')
// },
supportedLngs: ['en', 'zh'],
resources: {
en: { translation: en },
zh: { translation: zh },
},
// resources: {
// en: { translation: en },
// zh: { translation: zh },
// },
fallbackLng: 'en',
// fallbackLng: (code) => {
// if (!code || code === 'en') return ['en'];
@ -34,7 +39,7 @@ i18n
// console.log('fallbacks', fallbacks);
// return fallbacks;
// },
preload: ['en', 'zh'],
preload: ['en'],
interpolation: {
escapeValue: false,
},

@ -134,7 +134,7 @@ function Detail() {
confirmLoading={confirmLoading}
open={isModalOpen} onOk={handleOk} onCancel={handleCancel}
>
<Title level={4}>Confirm</Title>
<Title level={4}>{t('group.ConfirmationDetails')}</Title>
<Paragraph>
<blockquote>
<div style={{whiteSpace: 'pre-line'}}>

Loading…
Cancel
Save