📫 Connect with me
This Python script utilizes the Argos Translate model to translate language files for Android, iOS, and React applications (with Spring Boot support coming soon). The script automatically downloads and installs the required translation packages and organizes the translated files into designated folders with the appropriate naming conventions for each platform.
- Automatic Package Management: Updates the Argos Translate package index and installs the necessary packages to translate from Italian to English and from English to the specified target languages.
- Multi-Platform Support: Translates language files for:
- Android: XML files containing string resources.
- iOS:
.xcstringsfiles (JSON formatted). - React: JSON files containing string values.
- Output Organization: Saves the translated files in platform-specific directories with the correct file naming conventions.
- Python 3.x
- Argos Translate: Installable via pip.
- Other Dependencies: See
requirements.txt.
Make sure to install all the required dependencies before running the script.
translator-script/
├── main.py # Main script
├── service/ # Translation modules for each platform
│ ├── android_translate.py
│ ├── ios_translate.py
│ └── react_translate.py
└── out/ # Output directories for translated files
├── android/
├── ios/
└── react/
- Clone the repository:
git clone https://github.com/your-username/translator-script.git
- Install all required dependencies:
pip install -r requirements.txt
- python main.py --source <source_file> --out <out_folder> --from_language <source_language> --to_language <out_language>
python .\main.py --source .\strings.xml --out .\out --from_language en --to_language it,en,es
- it.json: The source file containing the Italian strings.
- it,en,es: A comma-separated list of languages for translation (including the source language).
- The script determines the platform based on the file extension:
- .xml for Android
- .xcstrings for iOS
- .json for React
- The script automatically removes the source language from the target languages to prevent redundant translations.
- Output file paths are currently hard-coded in the code. Modify these paths if needed to suit your project structure.
- Any translation errors will be printed to the console.