Easiest way to translate Android strings.xml file [closed]

隐身守侯 提交于 2019-12-18 11:54:01

问题


I'm using Google translate to translate strings.xml files to other languages from English. But translating more than 1000 lines one by one takes too much time. Is there an easy way or code to do this?

How do you translate your apps to other languages?


回答1:


Check out my Python scripts at Github. It works here behind a web page. You feed

strings.xml

plus IN and OUT language codes, Google Translate does the rest. Works best if you use simple unambiguous English. Kudos to Khayam Gondal, on whose work I build.




回答2:


I use translation editor, its not automatic but still very convenient way and it is built into Android Studio. Also take a look on this answer, that guy created a tool that making the translation automatically.




回答3:


Since CTRL+A not working now in the android studio. There is one way to convert the android strings file to CSV and then translate it with the help of google translator and then again convert back to XML.

https://skydevelopers.net/blog/2-best-ways-to-translate-the-android-strings-file/

here is a blog in detail




回答4:


Use this Python script. You can also translate into multiple languages at once.

EDIT: The above library has a limit. Since it uses unofficial googletrans library it doesn't work sometimes.

I have created another library here which uses quota of your GCP. It is faster and reliable. You can bulk translate, and has option to translate to all available language at once. https://github.com/bikcrum/Android-String-Translator-GCP




回答5:


I created a tool on my website for this.

Go to http://mathgeniusguide.com/codegenerator.html.
In the dropdown menu, select "Parse Strings File".
In the field that says "Strings File", paste your strings file.
Click "Parse" to parse a list of strings from your file.
Copy and paste the list that appears into Google Translate.
Copy and paste your Google Translate result in the "Translated Strings List" field.
Click "Generate Code".

Your translated strings file will appear. You'll still have to check for inaccurate translations, and for strings with %1$s values.




回答6:


I recently published an app for this purpose. It translates a strings.xml file into other languages quickly and easily, and after translation it is possible to edit and view all translatable strings. Translations are provided by Google Translate and in case of errors or bad formatting, which usually happens when translating strings with HTML markup, you can easily correct based on the original string.

Check out the app in the Play Store for more details.



来源:https://stackoverflow.com/questions/44477221/easiest-way-to-translate-android-strings-xml-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!