Skip to main content

Translate your translation files

Project description

Logo

Test Python package codecov pre-commit.ci status PyPI PyPI - Python Version PyPI - Status

Installation

    pip install geranslator

Configuration

.geranslator-config.yaml

It's gonna be created for you. 😌

geranslator:
  lang_dir: lang
  lang_files_ext: json
  provider: google
  origin_lang: en
  target_langs: [fr, ar]
  • lang_dir: Where your translation files live.
  • lang_files_ext: Your translation files extension.
  • provider: Provider you want to translate your file.
  • origin_lang: The origin language you already have.
  • target_langs: Languages you want your file to get translated to.

supported extensions: json, yaml, yml, po

supported providers: google, deepl

Usage

CLI

geranslator

Supported options

option short description
--provider -p To specify provider.
--lang-dir -d To specify translation files directory.
--extension -e To specify translation files format.
--origin-lang -o To specify the origin language.
--target-langs -t To specify target languages.
geranslator --provider=deepl --origin-lang=en --target-langs=es,pt
geranslator -p deepl -o en -t es,pt

[!NOTE] Keep in mind that default values are on .geranslator-config.yaml

IDE

This will use the configuration as default

    from geranslator import Geranslator

    Geranslator().translate()

You can customize it using the following methods. 😃

    from geranslator import Geranslator

    geranslator = Geranslator()
    geranslator.set_provider('google')
    geranslator.set_lang_dir('translation')
    geranslator.set_origin_lang('en')
    geranslator.set_target_lang(['ar', 'fr'])
    geranslator.set_lang_files_extension('json')
    geranslator.translate()

You can chain them too 😮

    from geranslator import Geranslator

    Geranslator().set_provider('google').set_lang_dir('translation').set_origin_lang('en').set_target_lang(['ar', 'fr']).set_lang_files_extension('json').translate()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

geranslator-1.4.3-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file geranslator-1.4.3-py3-none-any.whl.

File metadata

  • Download URL: geranslator-1.4.3-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for geranslator-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4e79c3e86f7ed57f9b04a996556560a9192c2410edd902945927d3d807ad40b9
MD5 1c39038748ab73b7a456891b3eed9bb4
BLAKE2b-256 eed13857821be1f5ee4a246f2c10b9e735c3f03a2f539224318db1a058a8ade4

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