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.
Metadata
Release files for strings-translate 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| strings-translate-1.0.3.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| strings_translate-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.5 kB
Release files / strings-translate-1.0.3.tar.gz
| Download URL | strings-translate-1.0.3.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
349c4a1d3946b07347574adf2230658c7a8488c1219f4b02e4749276da288ce3
|
|
BLAKE2b-256 checksum How to use checksums |
af8cdd4a207e9af29aa2b08bde8a63baeea259df81d8e6a30a401028e9580b84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / strings_translate-1.0.3-py3-none-any.whl
| Download URL | strings_translate-1.0.3-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d4e992cbc3d85e30aa0ea0c836a7346eef2b00d7f9f427a25d0dcd44ac0b109
|
|
BLAKE2b-256 checksum How to use checksums |
f9ab843e7ec78a0416a6e1f59d325194b4968ac310e9975e3fbf9fc6d607d6d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|