Skip to main content

A CLI tool for automating PO file translations

Project description

PO files translator from local codebases

A simple CLI tool that scans a codebase for translations and updates a given PO file with the most likely translations. It automatically extracts the language from the PO file's name (for example, "ar.po" yields the language code "ar").

Installation

pip3 install pofiletranslate

Usage

To run the tool, you can provide either the full path or the relative path to the .po file, depending on where you're located in the terminal. Example, Browse your translation folder (e.g., i18n), open the terminal, and run:

 pofiletranslate fr.po

For help, run:

pofiletranslate --help

Command-Line Arguments

  • po_file_path (required): Path to the PO file you want to process.
    Example: /full/path/to/ar.po

  • --depth (optional): Backtrack depth for computing the codebase directory. Defaults to 4.
    Example: --depth 3

  • --exclude (optional): Comma-separated list of directory names to exclude from the scan. Defaults to an empty string, meaning no directories are excluded.
    Example: --exclude "dir1,dir2"

    • This will exclude the directories dir1 and dir2 from the translation scan.

Example usage:

pofiletranslate /full/path/to/ar.po --depth 3 --exclude "dir1,dir2"

This example will process the ar.po file with a depth of 3 and will exclude the directories dir1 and dir2 from the scan.

What It Does

The tool scans the specified codebase for PO files matching the derived language (e.g., "fr") and updates your provided PO file with the most likely translation. If for example state == 'statut' is found with 70% confidence and state == 'état' is found with 30% confidence, the tool will select 'statut'.

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

pofiletranslate-0.5.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pofiletranslate-0.5.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pofiletranslate-0.5.0.tar.gz.

File metadata

  • Download URL: pofiletranslate-0.5.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for pofiletranslate-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ee82687b24ea843f6dcd8de49b6867a604bac6568b4a60c7f9126acf02e09b64
MD5 36cb6604236f35b0464a3d574d8bf062
BLAKE2b-256 be7eea453cb04414d0eadb4ef96de4df494da706cfe3e9d4ff5b0c969348406b

See more details on using hashes here.

File details

Details for the file pofiletranslate-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pofiletranslate-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fb92925d1bca1e21aa453da5a86ada9950ae162ebd54709e9985830f2dea69f
MD5 b810827e7deb51ff3923fefc7db761ba
BLAKE2b-256 f6d23790e5baab928dbe0b746c7817a3bc44f9a1beaf43aa8201701108598476

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page