中文说明文档 README_CN.md
This is a plugin based translator for typed text translation,
such as Android strings.xml or iOS Localizable.strings.
Now it officially supports Android and iOS strings resources document
translation plugins, and officially supports Google, Baidu and Youdao
translation platform plugins. You can simply use it.
For more details you can see the wiki.
You can simply use like this:
~/sh run.shthen the file will be translated to your specified path.
- First download release zip file here LATEST RELEASE.
- Install JRE or JDK to run this tools. You can download here JDK DOWNLOAD.
- Configure
translate_config.inifile in the RELEASE zip file root path.translatePlatformchoose the translate platform, official supportgoogle,baiduandyoudao.- Translate platform may need you register developer account to access translate api,
this
appId,appKeyandapiUrlthree param you can get it form translate platform api doc.othersis a list of param, now it doesn't use, it will pass to your plugin, if you need some params in config you can set it here. - baidu need
appId,appKeyandapiUrl, you should replace it with your own key. - google just need
appKeyandapiUrl. - youdao just like baidu.
apiUrlthis param may not change, it just support you a way to change if need.textTypeset the source typed text type, official support android and ios strings doc.sourceLanguagesource languagedestinationLanguagedestination language, the value you can find insupport_language.txt. It can be a single value, or a list value, or special "all" value.sourceFilePathtranslate file path, plugin will scan the path to translate. it should in your tools root path, it is a RELATIVE path.
- Copy the file you want to translate in the tools path.
- run the script
run.batorrun.sh, it depends on your system.
[platform key]
# baidu translate api info, you should replace it with your own.
# the doc is here: http://api.fanyi.baidu.com/api/trans/product/apidoc
;appId = 123412341
;appKey = asdfasqre14as11423412
;apiUrl = https://api.fanyi.baidu.com/api/trans/vip/translate
;others =
# google translate api info, you should replace it with your own.
# doc is here: https://cloud.google.com/translate/v2/quickstart
appId =
appKey = asdkfhkjhewqrWEQRBAWER124512
apiUrl = https://translation.googleapis.com/language/translate/v2
others =
# youdao translate api info, you should replace it with your own.
# the doc is here: http://ai.youdao.com/docs/doc-trans-api.s#p02
; appId = 1234542212341
; appKey = asdftrrsaqwerfgasTQE1234RTEWQtw
; apiUrl = http://openapi.youdao.com/api
; others =
[platform]
# now support google, baidu, youdao translate platform api.
# the value you can choose are "google", "baidu", "youdao"
translatePlatform = google
[text type]
# now support android .xml string res and ios .strings string res translate.
# the value you can choose are "android" or "ios"
textType = android
[translator]
# the source language you provided.
sourceLanguage = zh-CN
# if you want translate all language you should use "all" to replace this value.
# use "all" means you want translate the platform support all languages;
# or you should use language code to tell the translate you want to translate.
#
# the platform support language contains in the root of the project support_laguage.txt
# you can check this file to get the platform support language
# eg1: destinationLanguage = en
# eg2: destinationLanguage = en,zh-TW
# eg3: destinationLanguage = all
destinationLanguage = en
# the translate file must in the same path or sub dir of the translator.jar.
# this value assign the folder name, if you don't want use sub dir,
# just use "/" to replace the value
sourceFilePath = values- baidu translate doc: http://api.fanyi.baidu.com/api/trans/product/apidoc
- google translate doc: https://cloud.google.com/translate/v2/quickstart
- yoduao translate doc: http://ai.youdao.com/docs/doc-trans-api.s#p01
- baidu http://api.fanyi.baidu.com/api/trans/product/apidoc
- google https://cloud.google.com/translate/docs/languages
- youdao http://ai.youdao.com/docs/doc-trans-api.s#p05
If you want to generate release package, just run the script in the project root path:
on windows:
./gradlew.bat releaseon linux:
~/sh gradlew releaseThen, the release package will generate into /release/release- folder.
Here is a plugin demo project, it will help you to create plugins plugin course.