VsCode - platformio IDE汉化教程 (使用translate.js 前端翻译)
translate.js是一款开源的网站自动翻译api,使用极其简单。 无需任何前期准备,直接加入几行代码即可拥有多种语言全自动切换能力。
注:
已更新 translate.js 至 3.5.1 版本。
附上完成汉化图:
使用教程,
1.打开 platformio 安装目录,一般在这里:
C:\Users\”你的用户名“\.platformio\packages\contrib-piohome
2.复制如下代码到图中位置:
<script> //translate.js 前端翻译
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'https://cdn.staticfile.net/translate.js/3.5.1/translate.js';
script.onload = script.onreadystatechange = function() {
translate.selectLanguageTag.show = false; //不出现的select的选择语言框
translate.service.use('client.edge'); //设置机器翻译服务通道,直接客户端本身,不依赖服务端
translate.ignore.class.push('ant-card-head');
translate.ignore.class.push('inline-block-tight');
translate.ignore.class.push('last-keywords');
translate.ignore.class.push('ant-table-tbody');
translate.ignore.class.push('ant-select-dropdown-menu-item-group-list');
translate.ignore.class.push('ant-select-dropdown-menu-vertical');
translate.ignore.class.push('ant-select-selection-selected-value');
translate.language.setDefaultTo('chinese_simplified'); //设置默认翻译成后的语言为 简体中文
window.onload = function() {
translate.listener.start();
translate.execute();
};
}
head.appendChild(script);
</script>
粘贴至 </html> 之前即可。
更多问题资料到官网查询即可:https://translate.zvo.cn/index.html