当前位置:网站首页>Operation instructions of star boundary automatic text translator (advanced version)
Operation instructions of star boundary automatic text translator (advanced version)
2022-04-23 14:11:00 【Senzhiqianshou】
Preface
The advanced version of automatic text translator has finally been developed , Previously, pure html Develop the graphical interface of , But it's not automatic enough , Need to manually locate file copy overwrite . Theories like this can be used python Development , But I only know the front end and Android . So I found a compromise , use nodeJS Development .
Tool features
Cross platform
Support multiple operating systems , Include Windows、Linux、Mac
Baidu translation API
Use free ( The standard version ). Support term base ( premium ). The advanced version has a month 200 Million free character access . Standard Edition unlimited use . Because of the shit stick, especially FU There are many new words in it , Adopt term base , It can greatly reduce the problem of inaccurate translation .
Automatic translation
Just a simple command , Can automatically translate all files in the specified directory
Use the tutorial
One 、 Register Baidu translation account , obtain key and appid
You can refer to the previous Semi automatic translation tutorial
Two 、 Installation configuration node
1、 Download installation package
Get into node Official website , Select the platform version corresponding to your system , With windows For example , branch 32 Bit version and 64 Bit version , If you don't clear it, choose 32 position , because 64 Bit compatible 32 Bit program , But today's systems are generally 64 Bit . After downloading, double-click install , No brain, just click next .
2、 Check whether the installation is successful
win+R Call out ’ function ‘, Input cmd
determine , Open the terminal , type
node -v
If you can see it node Version information for , Proof of successful installation
It should be noted that , If your account is not Administrator Account , This step and even subsequent steps may fail . Then you need to call Administrator authority PowerShell. The opening mode is , Hold down shift Right click at the same time win The logo of :
3、 Download the configuration tool file
Download address :github Portal
Enter the root directory of the source code , It's better not to have Chinese path , In the blank area shift+ Right click , Call up here to open powershell
Type the following command for dependent installation .
npm install
The above picture is a successful screenshot . There may be anti-virus software alarm during installation , allow . In addition, as mentioned earlier , No Adminstrtor In terms of account , Running instructions may fail , Just open the administrator's powershell then cd Enter the source directory for installation .
Next, find the root directory project.config.js file
/** * Baidu translation api Of key * @type {string} */
const BD_TRANSLATE_KEY = ''
/** * Baidu translated api Of appid * @type {string} */
const BD_TRANSLATE_APP_ID = ''
/** * The delay between translated documents , Too often can lead to api Call failed * @type {number} millisecond */
const TRANSLATE_DELAY = 5000
/** * Whether to overwrite the translation * @type {boolean} true-- The previous translation will cover the translation false-- Filter out the previously translated */
const TRANSLATE_COVER = false
/** * The source of the translation directory * @type {string} */
const TARGET_PATH='G:\\workspace\\StarBound\\FrackinUniverse-sChinese-Project\\translations\\texts\\objects\\mantizi'
The relevant configuration is described above , The first two items are translated by Baidu key and appid, It should be noted that TARGET_PATH This target source directory ,windows The file separator under is \, And fill in , To add escape characters , That is, two backslashes .
thus , The project configuration is completed , The next step is to translate instructions .
3、 ... and 、 Perform translation
What we need to do is src Under the folder exe.js file , So first cd Into the src Catalog , Run again node Instructions
PS G:\workspace\StarBound\starbound_auto_transalator_advanced> cd .\src\
PS G:\workspace\StarBound\starbound_auto_transalator_advanced\src> node .\exe.js
On the surface of the above TARGET_PATH For example , After this command is executed, a message appears
[G:\workspace\StarBound\FrackinUniverse-sChinese-Project\translations\texts\objects\mantizi\imperialbanner1\imperialbanner1.object.json
]
File opened successfully :3 Ready to read :
Translation results
The current file has been translated completely , Skip the file
------------------------------------------------------------------
Currently processing file No 2 File :
[G:\workspace\StarBound\FrackinUniverse-sChinese-Project\translations\texts\objects\mantizi\imperialbanner2\imperialbanner2.object.json
]
File opened successfully :4 Ready to read :
Find text to be translated :
{
'0': 'A beautifully woven banner.',
'1': 'A bright woven banner. I wonder what the jewel in the middle means.',
'2': 'A sun? Or some kind of creature?',
'3': 'A thick woven banner depicting the imperial crest.',
'4': 'Floran usually avoid this sssymbol.',
'5': 'I enjoy the golden accents woven into the fabric.',
'6': 'Is the Empire nearby?',
'7': 'Mantizi Imperial Banner',
'8': 'Servire Imperium.',
'9': 'This banner looks like it has a beetle woven on it.'
}
Request parameter composition result :
A beautifully woven banner.
A bright woven banner. I wonder what the jewel in the middle means.
A sun? Or some kind of creature?
A thick woven banner depicting the imperial crest.
Floran usually avoid this sssymbol.
I enjoy the golden accents woven into the fabric.
Is the Empire nearby?
Mantizi Imperial Banner
Servire Imperium.
This banner looks like it has a beetle woven on it.
Translation results
[
{
src: 'A beautifully woven banner.', dst: ' Weave exquisite flags .' },
{
src: 'A bright woven banner. I wonder what the jewel in the middle means.',
dst: ' Bright woven banners . I want to know what the jewelry in the middle means .'
},
{
src: 'A sun? Or some kind of creature?', dst: ' The sun ? Or some kind of creature ?' },
{
src: 'A thick woven banner depicting the imperial crest.',
dst: ' A thick woven banner depicting a crown .'
},
{
src: 'Floran usually avoid this sssymbol.', dst: ' Florian usually avoids using this symbol .' },
{
src: 'I enjoy the golden accents woven into the fabric.',
dst: ' I like the golden accent woven into the fabric .'
},
{
src: 'Is the Empire nearby?', dst: ' Is the Empire nearby ?' },
{
src: 'Mantizi Imperial Banner', dst: ' Mantiz Empire flag ' },
{
src: 'Servire Imperium.', dst: ' Imperial service .' },
{
src: 'This banner looks like it has a beetle woven on it.',
dst: ' This banner seems to be weaving a beetle .'
}
]
------------------------------------------------------------------
Recombination result
[
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Eng: 'A beautifully woven banner.', Chs: ' Weave exquisite flags .' }
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Eng: 'A bright woven banner. I wonder what the jewel in the middle means.',
Chs: ' Bright woven banners . I want to know what the jewelry in the middle means .'
}
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Eng: 'A sun? Or some kind of creature?', Chs: ' The sun ? Or some kind of creature ?' }
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Eng: 'A thick woven banner depicting the imperial crest.',
Chs: ' A thick woven banner depicting a crown .'
}
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Eng: 'Floran usually avoid this sssymbol.',
Chs: ' Florian usually avoids using this symbol .'
}
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Eng: 'I enjoy the golden accents woven into the fabric.',
Chs: ' I like the golden accent woven into the fabric .'
}
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Eng: 'Is the Empire nearby?', Chs: ' Is the Empire nearby ?' }
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Chs: 'Mantizi Empire banner ', Eng: 'Mantizi Imperial Banner' }
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Chs: ' Serve the Empire .', Eng: 'Servire Imperium.' }
},
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialbanner2/imperialbanner2.object': [Array]
},
Texts: {
Eng: 'This banner looks like it has a beetle woven on it.',
Chs: ' This banner seems to be weaving a beetle .'
}
}
]
From the information on the console, you can see the information of the current translation file , When the configuration does not overwrite the translation , Will automatically skip the translated files , Increase translation efficiency .
There will also be corresponding prompts after successful translation :
Currently processing file No 35 File :
[G:\workspace\StarBound\FrackinUniverse-sChinese-Project\translations\texts\objects\mantizi\shared_imperialvaselarge\shared_imperialvas
elarge.json]
File opened successfully :4 Ready to read :
Find text to be translated :
{
'0': 'A large decorative glazed vase.' }
Request parameter composition result :
A large decorative glazed vase.
Translation results
[ {
src: 'A large decorative glazed vase.', dst: ' A large decorative glass vase .' } ]
------------------------------------------------------------------
Recombination result
[
{
DeniedAlternatives: [],
Files: {
'objects/mantizi/imperialvaselarge1/imperialvaselarge1.object': [Array],
'objects/mantizi/imperialvaselarge2/imperialvaselarge2.object': [Array]
},
Texts: {
Eng: 'A large decorative glazed vase.', Chs: ' A large decorative glass vase .' }
}
]
*********** All documents have been translated **********
Four 、 Set up the term library
This step is not necessary , However, setting up a term base can increase the accuracy of translation , At present, I have collected some information about minerals 、 Liquid and NPC Terms related to names , The file in doc Below directory :
stay Baidu translation platform You can configure the
版权声明
本文为[Senzhiqianshou]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231405036828.html
边栏推荐
猜你喜欢
postman批量生产body信息(实现批量修改数据)
微信小程序进行蓝牙初始化、搜索附近蓝牙设备及连接指定蓝牙(一)
教育行业云迁移最佳实践:海云捷迅使用HyperMotion云迁移产品为北京某大学实施渐进式迁移,成功率100%
Nifi 快速安装及文件同步操作
帆软中单元格中隔行变色以及数量大于100字体变大变红设置
Some good articles on pthread multithreading
Detailed tutorial on the use of smoke sensor (mq-2) (based on raspberry pie 3B +)
更改plsql工具栏的图标大小
Kettle -- control parsing
星界边境Starbound创意工坊订阅的mod的存放路径
随机推荐
MYSQL 主从同步避坑版教程
PySide2
使用DialogFragment的一些感受及防踩坑经验(getActivity、getDialog为空,cancelable无效等)
帆软实现一个单选按钮,可以统一设置其他单选按钮的选择状态
leetcode--357. Count the number of different figures
HyperMotion云迁移完成阿里云专有云产品生态集成认证
基于ibeacons三点定位(微信小程序)
Understand the concepts of virtual base class, virtual function and pure virtual function (turn)
Win10 comes with groove music, which can't play cue and ape files. It's a curvilinear way to save the country. It creates its own aimpack plug-in package, and aimp installs DSP plug-in
帆软中根据分类进行汇总
关于NodeJS中JSON5的相关配置和使用
01-NIO基础之ByteBuffer和FileChannel
Promtail + Loki + Grafana 日志监控系统搭建
mysql 5.1升级到5.68
倒计时1天~2022云容灾产品线上发布会即将开始
帆软之单元格部分字体变颜色
logback-logger和root
多云数据流转?云上容灾?年前最后的价值内容分享
关于训练过程中损失函数出现断崖式增长的问题
Switch usage (wechat applet)