Skip to content

Commit

Permalink
feat: optimize i18n implementation for better localization (#2062)
Browse files Browse the repository at this point in the history
* feat: optimize i18n implementation for better localization

* delete i18n-ally-custom-framework.yml

* update common key
  • Loading branch information
zjy365 authored Jul 16, 2024
1 parent 1e4ffc2 commit fc96bb9
Show file tree
Hide file tree
Showing 206 changed files with 1,360 additions and 1,277 deletions.
46 changes: 0 additions & 46 deletions .vscode/i18n-ally-custom-framework.yml

This file was deleted.

9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
"i18n-ally.localesPaths": [
"packages/web/i18n",
],
"i18n-ally.enabledParsers": ["json", "yaml", "js", "ts"],
"i18n-ally.enabledParsers": [
"json",
"yaml",
"js",
"ts"
],
"i18n-ally.keystyle": "nested",
"i18n-ally.sortKeys": true,
"i18n-ally.keepFulfilled": false,
"i18n-ally.sourceLanguage": "zh", // 根据此语言文件翻译其他语言文件的变量和内容
"i18n-ally.displayLanguage": "zh", // 显示语言
"i18n-ally.namespace": true,
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key"
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"devDependencies": {
"@chakra-ui/cli": "^2.4.1",
"husky": "^8.0.3",
"i18next": "23.10.0",
"lint-staged": "^13.3.0",
"next-i18next": "15.2.0",
"i18next": "23.11.5",
"next-i18next": "15.3.0",
"react-i18next": "14.1.2",
"prettier": "3.2.4",
"react-i18next": "13.5.0",
"zhlint": "^0.7.4"
},
"lint-staged": {
Expand All @@ -29,4 +29,4 @@
"node": ">=18.16.0",
"pnpm": ">=9.0.0"
}
}
}
7 changes: 3 additions & 4 deletions packages/web/i18n/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,7 @@
"success": "Start syncing"
}
},
"training": {
}
"training": {}
},
"data": {
"Auxiliary Data": "Auxiliary data",
Expand Down Expand Up @@ -1373,7 +1372,7 @@
"Terms": "Terms of service",
"Username": "Username",
"Wechat": "Login with Wechat",
"Wx qr login": "Wechat QR code login"
"wx_qr_login": "Wechat QR code login"
},
"team": {
"Dataset usage": "Knowledge base capacity",
Expand Down Expand Up @@ -1638,4 +1637,4 @@
}
}
}
}
}
7 changes: 3 additions & 4 deletions packages/web/i18n/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,7 @@
"success": "开始同步"
}
},
"training": {
}
"training": {}
},
"data": {
"Auxiliary Data": "辅助数据",
Expand Down Expand Up @@ -1382,7 +1381,7 @@
"Terms": "服务协议",
"Username": "用户名",
"Wechat": "微信登录",
"Wx qr login": "微信扫码登录"
"wx_qr_login": "微信扫码登录"
},
"team": {
"Dataset usage": "知识库容量",
Expand Down Expand Up @@ -1647,4 +1646,4 @@
}
}
}
}
}
8 changes: 4 additions & 4 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
"ahooks": "^3.7.11",
"date-fns": "2.30.0",
"dayjs": "^1.11.7",
"i18next": "23.10.0",
"lexical": "0.12.6",
"lodash": "^4.17.21",
"next-i18next": "15.2.0",
"i18next": "23.11.5",
"next-i18next": "15.3.0",
"react-i18next": "14.1.2",
"papaparse": "^5.4.1",
"react": "18.3.1",
"react-beautiful-dnd": "^13.1.1",
"react-day-picker": "^8.7.1",
"react-dom": "18.3.1",
"react-hook-form": "7.43.1",
"react-i18next": "13.5.0",
"react-photo-view": "^1.2.6",
"use-context-selector": "^1.4.4"
},
Expand All @@ -42,4 +42,4 @@
"@types/react-beautiful-dnd": "^13.1.1",
"@types/react-dom": "18.3.0"
}
}
}
60 changes: 30 additions & 30 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/app/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ module.exports = {
localePath:
typeof window === 'undefined' ? require('path').resolve('../../packages/web/i18n') : '/i18n',
reloadOnPrerender: process.env.NODE_ENV === 'development'
};
}
8 changes: 4 additions & 4 deletions projects/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"formidable": "^2.1.1",
"framer-motion": "^9.0.6",
"hyperdown": "^2.4.29",
"i18next": "23.10.0",
"immer": "^9.0.19",
"js-yaml": "^4.1.0",
"jsonwebtoken": "^9.0.2",
Expand All @@ -44,14 +43,15 @@
"nanoid": "^4.0.1",
"next": "14.2.3",
"json5": "^2.2.3",
"next-i18next": "15.2.0",
"nextjs-node-loader": "^1.1.5",
"nprogress": "^0.2.0",
"react": "18.3.1",
"react-day-picker": "^8.7.1",
"react-dom": "18.3.1",
"react-hook-form": "7.43.1",
"react-i18next": "13.5.0",
"i18next": "23.11.5",
"next-i18next": "15.3.0",
"react-i18next": "14.1.2",
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "^15.5.0",
"reactflow": "^11.7.4",
Expand Down Expand Up @@ -81,4 +81,4 @@
"nextjs-node-loader": "^1.1.5",
"typescript": "^5.1.3"
}
}
}
7 changes: 6 additions & 1 deletion projects/app/src/components/CommunityModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ const CommunityModal = ({ onClose }: { onClose: () => void }) => {
const { feConfigs } = useSystemStore();

return (
<MyModal isOpen={true} onClose={onClose} iconSrc="modal/concat" title={t('system.Concat us')}>
<MyModal
isOpen={true}
onClose={onClose}
iconSrc="modal/concat"
title={t('common:system.Concat us')}
>
<ModalBody textAlign={'center'}>
<Markdown source={feConfigs?.concatMd || ''} />
</ModalBody>
Expand Down
Loading

0 comments on commit fc96bb9

Please sign in to comment.