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.
Use the package manager pip to install the needed libraries.
pip install google-cloud-translateThis 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" 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-languagesTo run the translator:
python AndroidStringTranslator.py translateFileAnother example of usage: #1 (comment)