Skip to main content

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 .strings file
  • 📖 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

strings-translate-1.0.3.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

strings_translate-1.0.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

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

Hashes for strings-translate-1.0.3.tar.gz
Algorithm Hash digest
SHA256 349c4a1d3946b07347574adf2230658c7a8488c1219f4b02e4749276da288ce3
MD5 16d4b2ffccb31f1de60f6fc157999e2c
BLAKE2b-256 af8cdd4a207e9af29aa2b08bde8a63baeea259df81d8e6a30a401028e9580b84

See more details on using hashes here.

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

Hashes for strings_translate-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6d4e992cbc3d85e30aa0ea0c836a7346eef2b00d7f9f427a25d0dcd44ac0b109
MD5 c413a5bb8fa16e3d8300f899fcbd4eb7
BLAKE2b-256 f9ab843e7ec78a0416a6e1f59d325194b4968ac310e9975e3fbf9fc6d607d6d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page