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.2.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file strings-translate-1.0.2.tar.gz.

File metadata

  • Download URL: strings-translate-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8987fa80bc0ae1de0d5e2dabd20a91add24f5c52be7009a8da137298b1661834
MD5 eb17c69988aff513b24136b830f66d3b
BLAKE2b-256 74798129420e7dfa0be6538a7953252467d932b15da64335f61d85d32ca4014f

See more details on using hashes here.

File details

Details for the file strings_translate-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: strings_translate-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a471edb2f6c1cc43f28ef526ffb4251ceb300840841e206bac3c510baca8241
MD5 09b62eb1b3f9e17fa687b9d66dd100a6
BLAKE2b-256 08cb666697734ff6e977d37e38cf1766ff722217658f8df63aeda3488b6cce7b

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