Android App Translator

An handy tool to translate your Android application

Posted by Massimiliano Fanciulli on December 15, 2016


Any Android application shall consider supporting most common languages in order to reach most of the user base. In order to do this the file strings.xml shall be translated to any language that we want to support. If not the default language is provided to user. Since it is impossible to speak all the languages in the work, the developer usually spend money for a professional translation or simply uses one of the online translation tools like Google Translate. Even though the first solution is the best option, it is usually not feasible, expecially for small developers.

The Android Application Translator comes handy by parsing the strings.xml file and translating each line to the language specified. To translate the strings, Google Translate API are being used. Even if not free (Google Translate APIs are not free of charge) the final cost is low enough to allow small developers translate their app to multiple languages.

To use Google App Translator follow these steps (from command line):

  • Download source code from Github

$> git clone https://github.com/fanciulli/AndroidAppTranslator.git

  • Move to the freshly created folder

  • Install Node.js dependencies

$> npm install

  • Edit file settings.json and put your Google Translate API key. Save the file.

  • Run the application as follows:

$> node app_translator.js -i STRINGS_XML_FILE -l LANGUAGES -o OUTPUT_FOLDER

Example: $> node app_translator.js -i /home/user/strings.xml -l it,fr,en -o /opt/

The application will run and create one file for each language. In the example above files strings_it.xml, strings_fr.xml and strings_en.xml will be created.


Share