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 for the API you want to use:
TRANSLATOR_SERVICE=YOUR_TRANSLATOR_SERVICE
MS_API_KEY=YOUR_MS_API_KEY
MS_API_REGION=YOUR_MS_API_REGION
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
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
- Multiple translation services support
Challenge: Some services require an glossary to be created before translation for formatted strings with placeholders.
License
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
PyPI: https://pypi.org/project/poTranslation/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for poTranslation-0.0.2a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 361f40e388f8115f860497a43a6bf2a6920a030a9f3567e38337608e866d4708 |
|
MD5 | 3a4527eddafd923f8a4036143eac5c07 |
|
BLAKE2b-256 | 87dd4e75d382a938ec44bdf25d7b8ef838952522379945f0e4da874d595b3182 |