Skip to main content

This is a simple python library/CLI tool to translate .po files using various APIs.

Project description

poTranslation

Description

This is a simple python library/CLI tool to translate .po files using various APIs.

Installation

Install and update using pip:

pip install -U poTranslation

Usage

Create a .env file in your working directory or parent directory with the following content:

TRANSLATOR_SERVICE=YOUR_TRANSLATOR_SERVICE
API_KEY=YOUR_API_KEY
API_REGION=YOUR_API_REGION

NOTE: TRANSLATOR_SERVICE currently supports MS only. API_REGION is optional for some services.

Command Line Interface Example

potranslate --help
poTranslate ./messages.po -s en -d zh -f
Options:
  -s, --source-language TEXT  Source language for translation.  [default: en]
  -d, --dest-language TEXT    Destination language for translation.  [default: (load from .po file)]
  -l, --lang TEXT             Programming langrage of formatted string.  [default: python]
  -f, --file PATH             Path to the output file.  [default: {po_file_path}]
  -e, --env PATH              Path to the env file.  [default: (load from cwd and parent dir)]
  -F, --force                 Force translation of all entries.
  -v, --verbose               Enable verbose output.
  -q, --quiet                 Suppress output.
  -w, --write                 Write to the file.  [default: True]
  -h, --help                  Show this message and exit.

Roadmap

Challenge: Some services require an glossary to be created before translation for formatted strings with placeholders.

Distributed under the BSD 3-Clause License. See LICENSE for more information.

Links

Source Code: https://github.com/StevenGuo42/poTranslation
Issue Tracker: https://github.com/StevenGuo42/poTranslation/issues

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

poTranslation-0.0.1a2.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

poTranslation-0.0.1a2-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

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