Skip to content

A python script that uses the Google Cloud Translation API to translate the whole xml file.

Notifications You must be signed in to change notification settings

aljazst/Android-Strings.xml-Translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Translator script for Android Strings.xml

Android-Strings.xml-Translator is a Python script that uses the Google Cloud Translation API to translate a whole .xml file to the desired language.

Documentation

The ElementTree XML API

argsparse

Google Cloud Translation API

Installation

Use the package manager pip to install the needed libraries.

pip install google-cloud-translate

Setup

This script uses the Google Cloud API, so you will first of all need a google service account Google Cloud. Make a project and go to API & Services > Credentials in the menu. Under create credentials you will heve to make a service account and later add a key in json format in the service account details page.

After you have your json file containing the key you can add the file path to the script.

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"C:\Users\yourmom\Desktop\Python\AndroidTranslate\APIKey.json" 

Usage

Add the String.xml file to the same file as the script. You can run the script in the console.

To see all the supported language codes:

python AndroidStringTranslator.py list-languages

To run the translator:

python AndroidStringTranslator.py translateFile

Another example of usage: #1 (comment)

License

MIT

About

A python script that uses the Google Cloud Translation API to translate the whole xml file.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages