Translator for Android string resource
How to bulk translate?
Prerequisites
- Must have python version 3
- Must have billing enabled in Google Cloud Platform (GCP)
- Install this python package (if not installed).
- bs4
- Install the google client translation library
pip install --upgrade google-cloud-translate
Steps:
- Goto GCP console (https://console.cloud.google.com/) then under IAM & Admin click Service accounts.
- Create service account and assign a role as project owner.
- Create key which will be downloaded into your computer.
- Clone and go to the project directory
- Put service account there and rename to
project-service-account.json
- Use this command
python translator-for-android.py <source-string-file> <languages list>
- Example
python translator-for-android.py strings.xml fr
orpython translator-for-android.py strings.xml fr,de,nl
- To translate to all available languages just provide source string in the command
- After above operation you will get new translated file(s) in current directory