A package for automatic translation of .strings files using the Google Translate API
Project description
strings-translate
A simplistic package for automatic translation of .strings files using the Google Translate API. As the Google Translate has come to a stage where, while not completely perfect, one can always count on it to provide sufficient translations in over 100 languages. So if you want to automatically localize your iOS, iPadOS or macOS app, you can simply use this package.
Features
- 🌍 Source language detection: The package automatically detects the language of the source
.stringsfile - 📖 Translation using Google Translate: The package can easily translate all of the individual strings using the Google Translate API
- 📝 Saving new .strings files: The results will be outputted into a new file, which you can directly use in your project
Usage
Installation
To get the package, simply use:
pip install strings-translate
Translation of .strings files
If you want to translate a pure .strings file, simply create your StringsTranslator and then use its translate_strings() method:
from stringstranslate import StringsTranslator
translator = StringsTranslator()
translator.translate_strings(file_name="Localizable.strings", target_lang="es", source_lang="en")
The target_lang and source_lang properties expect ISO codes for the relevant languages. The source language does not need to be entered, but then the detected language of the strings in the file will be used.
This will output a output/output_es.strings file with the translated strings.
Translation of storyboards
If you want to translate a storyboard, the approach is very similar. You only need to use the translate_storyboard() method:
from stringstranslate import StringsTranslator
translator = StringsTranslator()
translator.translate_storyboard(file_name="Main.strings", target_lang="es", source_lang="en")
Again, the source_lang property can be empty and this will output output/output_es.strings file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strings-translate-1.0.3.tar.gz.
File metadata
- Download URL: strings-translate-1.0.3.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
349c4a1d3946b07347574adf2230658c7a8488c1219f4b02e4749276da288ce3
|
|
| MD5 |
16d4b2ffccb31f1de60f6fc157999e2c
|
|
| BLAKE2b-256 |
af8cdd4a207e9af29aa2b08bde8a63baeea259df81d8e6a30a401028e9580b84
|
File details
Details for the file strings_translate-1.0.3-py3-none-any.whl.
File metadata
- Download URL: strings_translate-1.0.3-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d4e992cbc3d85e30aa0ea0c836a7346eef2b00d7f9f427a25d0dcd44ac0b109
|
|
| MD5 |
c413a5bb8fa16e3d8300f899fcbd4eb7
|
|
| BLAKE2b-256 |
f9ab843e7ec78a0416a6e1f59d325194b4968ac310e9975e3fbf9fc6d607d6d5
|