-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP]国际化 #206
Open
yidafu
wants to merge
7
commits into
polarismesh:main
Choose a base branch
from
yidafu:feature/i18n
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[WIP]国际化 #206
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
貌似有一个专门的国际化开发分支,先提交PR到那边? |
代码差异有点多,merge 最新的 main 分支太麻烦了 |
translate scriptrun it by import en from './en.json' assert { type: 'json' };
function sleep() {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, (Math.round() * 100 * 10) | 0)
})
}
const youdaoMap = {};
const bingMap = {};
for (let word of Object.keys(en)) {
// try {
// const result = await fetch('http://fanyi.youdao.com/translate?&doctype=json&type=ZH_CN2EN&i=' + word).then(resp => resp.json());
// // { "type": "ZH_CN2EN", "errorCode": 0, "elapsedTime": 1, "translateResult": [[{ "src": "你好", "tgt": "hello" }]] }
// console.log('%s ==> %s', word, result?.translateResult?.[0]?.[0]?.tgt);
// youdaoMap[word] = result?.translateResult?.[0]?.[0]?.tgt ?? '';
// } catch (err) {
// console.log(err)
// }
try {
const result = await fetch('http://api.microsofttranslator.com/v2/Http.svc/Translate?appId=AFC76A66CF4F434ED080D245C30CF1E71C22959C&from=&to=en&text=' + word).then(resp => resp.text())
const target = /\>([^<]*)\</.exec(result)?.[1];
console.log('%s ==> %s', word, target);
bingMap[word] = target;
} catch (err) {
console.log(err);
}
await sleep()
}
// fs.writeFileSync('./youdao.json', JSON.stringify(youdaoMap, null, 2));
fs.writeFileSync('./bing.json', JSON.stringify(bingMap, null, 2)); translate result |
okk |
1. 使用 jscodeshift 完成中文字面量的提取和转化 2. 校对了一部分的 t 函数的使用
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
codemod
using
jscodeshift
usage
example
before
after