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

Uploaded Source

Built Distribution

strings_translate-1.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: strings-translate-1.0.1.tar.gz
  • Upload date:
  • Size: 2.9 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.1.tar.gz
Algorithm Hash digest
SHA256 7e2e67be9fe4b3203136ce18c1347acb4407d504fe765242595d5683c06ee12f
MD5 497a16cf0d2c1cc4f8b61cc222c8cfe1
BLAKE2b-256 c1f3f76477426813adbdcb852b114781e85aeb0be8433de0ad5c44909bdcba9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strings_translate-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b304a5b8bb06fb41c024176134fe1fd4ad63830c0ea8ebdc24492470f077838
MD5 6d69d6d80f19a0a919209c966c1ca3f6
BLAKE2b-256 7a2bc731c518033e3c67a58ed8b5046d71dda8e40c3fbc59dce9cef4cbd66f88

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