FastGPT
FastGPT copied to clipboard
Added English Version
#160 Added English version
- You cann't use
useTranslation
in not-hook pages. - For these api files, you only need to return English and use useTranslation to translate after FE receives English.
I suggest you try to translate this file first: client/src/pages/account/index.tsx
Finally, for t(""), you need to fill in the string in English, not Chinese, and the Chinese translation should be placed in client/public/locales/zh/common.json
, the English translation in client/public/locales/en/common.json
.
For example: 登出
You should write: t('account.Log out'), and add translate json:
client/public/locales/zh/common.json
{
....
account: {
Log out: "登出"
}
...
}
client/public/locales/en/common.json
{
....
account: {
Log out: "Log out"
}
...
}
``
https://github.com/labring/FastGPT/pull/188/files#diff-a230fda8fcaeb65e8d9d6c6a7e46be5ab91f3b77f8fbd27bf477f7130b24457c
https://github.com/labring/FastGPT/pull/188/files#diff-1765c82f6dd349c4a5efe6884d44b21f0f0bdfd864fab200ced0bb2bd0f722cf
https://github.com/labring/FastGPT/pull/188/files#diff-f8c980e5d5a5fd5b2fcf72dfcb59b7041d3362cd80409341b8f19ab3851b7d25
tried to translate this file: client/src/pages/account/index.tsx
am I on the wrong path again? please confirm
https://github.com/labring/FastGPT/pull/188/files#diff-a230fda8fcaeb65e8d9d6c6a7e46be5ab91f3b77f8fbd27bf477f7130b24457c
https://github.com/labring/FastGPT/pull/188/files#diff-1765c82f6dd349c4a5efe6884d44b21f0f0bdfd864fab200ced0bb2bd0f722cf
https://github.com/labring/FastGPT/pull/188/files#diff-f8c980e5d5a5fd5b2fcf72dfcb59b7041d3362cd80409341b8f19ab3851b7d25
tried to translate this file: client/src/pages/account/index.tsx
am I on the wrong path again? please confirm
@c121914yu
https://github.com/labring/FastGPT/pull/188/files#diff-a230fda8fcaeb65e8d9d6c6a7e46be5ab91f3b77f8fbd27bf477f7130b24457c https://github.com/labring/FastGPT/pull/188/files#diff-1765c82f6dd349c4a5efe6884d44b21f0f0bdfd864fab200ced0bb2bd0f722cf https://github.com/labring/FastGPT/pull/188/files#diff-f8c980e5d5a5fd5b2fcf72dfcb59b7041d3362cd80409341b8f19ab3851b7d25 尝试翻译此文件:client/src/pages/account/index.tsx 难道我又走错路了?请确认
@c121914yu
yes.
- You need to write English in t(), not Chinese.
- You need to add the corresponding translation in local.
- You can install vscode's “I18n Ally” plugin to assist with translation.
I mean, you can try to modify the file: client/src/pages/account/index
, so that I can help you to correct. This pr is too big for me to comment on one by one
@c121914yu
- Added the English inside t()
- Added the corresponding in common.json
@c121914yu
![]()
- Added the English inside t()
![]()
- Added the corresponding in common.json
yes! We recommend that translations add prefixes by module.
example: Confirm to log out > account.Confirm to log out.
Prefixes are roughly divided: account, app, chat, kb, common
@c121914yu
![]()
- Added the English inside t()
![]()
- Added the corresponding in common.json
and please fetch and rebase latest code
Hi @c121914yu , I did the required changes, please review it
You need to pull the latest code and resolve conflicts first, and I recommend committing a small amount of code first. And I gave some code comment.
There are too many modified files, it is not convenient for me to merge after correction, please submit fewer files for the first time.