unbabelizer


Nameunbabelizer JSON
Version 1.2.4 PyPI version JSON
download
home_pageNone
SummaryA CLI tool to translate gettext .po files.
upload_time2025-10-06 04:38:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords translation google translate po files
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- markdownlint-disable MD041 -->

[![release](https://github.com/sarumaj/unbabelizer/actions/workflows/release.yml/badge.svg)](https://github.com/sarumaj/unbabelizer/actions/workflows/release.yml)
[![GitHub Release](https://img.shields.io/github/v/release/sarumaj/unbabelizer?logo=github)](https://github.com/sarumaj/unbabelizer/releases/latest)
[![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/sarumaj/unbabelizer)](https://github.com/sarumaj/unbabelizer/blob/main/pyproject.toml)

---

<!-- markdownlint-enable MD041 -->

# unbabelizer

`unbabelizer` is an interactive CLI and TUI (Text User Interface) tool for
managing gettext `.po` translation files.
It streamlines the localization workflow for Python projects by automating
extraction, translation, review, and compilation of translation files.

Read 👉 [Medium Blog Article](https://medium.com/stackademic/from-the-chaos-of-babel-to-app-translation-bliss-5afba78fc774) 👈 to learn more.

## Purpose

The main goal of `unbabelizer` is to simplify and automate the process of
internationalizing Python applications.
It provides a guided interface for developers and translators to:

- Extract translatable strings from source code using `babel`.
- Automatically translate `.po` files using translation services.
- Review and edit translations interactively.
- Compile `.po` files into binary `.mo` files for deployment.
- Manage multiple languages and domains with ease.
- Integrate seamlessly with Babel and polib for robust gettext support.

Supported translation services:

- Google Translate
- Microsoft Translator
- Yandex Translator
- ChatGPT Translation Service
- MyMemory Translator
- Deepl Translator

## Demo

[![ascii cast](https://asciinema.org/a/JWMSteKuWEp2UBCQJGCbrBdxr.svg)](https://asciinema.org/a/JWMSteKuWEp2UBCQJGCbrBdxr)

The app is itself available in German language. Simply run

```shell
LANG=de unbabelizer
```

to execute the app in German language.

## Features

- **Interactive TUI:** Edit and review translations in a modern terminal UI
  powered by [Textual](https://github.com/Textualize/textual).
- **Automated Extraction:** Find and extract translatable strings from your
  codebase using Babel.
- **Batch Translation:** Translate `.po` files automatically via Google Translate,
  with support for multiple target languages.
- **Review Workflow:** Step through translations, edit entries, and mark reviewed
  items.
- **Compilation:** Compile `.po` files to `.mo` for production use.
- **Configurable:** Control all aspects via `pyproject.toml` or CLI arguments.
- **Exclusion Patterns:** Skip files or directories using glob patterns.
- **Custom Mapping:** Provide custom Babel mapping for source file types.
- **Logging:** Detailed logging for troubleshooting and auditing translation changes.

## Installation

You can install the package via pip:

```shell
pip install unbabelizer
```

## Usage

Execute in a directory with a `pyproject.toml` config file:

```shell
unbabelizer
```

The configuration section in `pyproject.toml` might look as follows:

```toml
[tool.unbabelizer]
# List of destination languages (e.g., German)
dest_lang = ["de"]

# Paths to search for source files
input_paths = ["src"]

# Directory for locale files
locale_dir = "src/unbabelizer/locales"

# Source language code
src_lang = "en"

# Domain for the .po files (default: "messages")
domain = "messages"

# Patterns to exclude from searching (optional)
exclude_patterns = ["tests/*", "docs/*"]

# Content of the Babel mapping file (optional)
mapping_file_content = """
[python: **.py]
encoding = utf-8
"""

# Line width for .po files (optional, default: 120)
line_width = 120

# Translation service specific settings
api_key = "<my-api-key>"
api_key_type = "<free or paid>"
model = "gpt-3.5-turbo"
http_proxy = "http://<my-proxy>"
https_proxy = "https://<my-proxy>"
```

You can also override these settings using CLI arguments:

```shell
unbabelizer \
  --dest-lang de \
  --input-paths src \
  --locale-dir src/unbabelizer/locales \
  --src-lang en \
  --domain messages \
  --exclude-patterns tests/* docs/* \
  --mapping-file "~/mapping_file.txt" \
  --line-width 120
```

- `--dest-lang`: Destination language(s) (repeat or use multiple values)
- `--input-paths`: Source file paths (repeat or use multiple values)
- `--locale-dir`: Locale directory
- `--src-lang`: Source language code
- `--domain`: .po file domain
- `--exclude-patterns`: Patterns to exclude (optional)
- `--mapping-file`: Babel mapping file (optional)
- `--line-width`: Line width for .po files (optional)

Run `unbabelizer --help` to see all available options.

Settings from the CLI override those in `pyproject.toml`.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

## License

This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "unbabelizer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "translation, google translate, po files",
    "author": null,
    "author_email": "Dawid Ciepiela <71898979+sarumaj@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/ed/b8/10ad34f46c156a6ecd5483f7c01cbacd6b87c922b6b5b86638de8f52b9c1/unbabelizer-1.2.4.tar.gz",
    "platform": null,
    "description": "<!-- markdownlint-disable MD041 -->\n\n[![release](https://github.com/sarumaj/unbabelizer/actions/workflows/release.yml/badge.svg)](https://github.com/sarumaj/unbabelizer/actions/workflows/release.yml)\n[![GitHub Release](https://img.shields.io/github/v/release/sarumaj/unbabelizer?logo=github)](https://github.com/sarumaj/unbabelizer/releases/latest)\n[![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/sarumaj/unbabelizer)](https://github.com/sarumaj/unbabelizer/blob/main/pyproject.toml)\n\n---\n\n<!-- markdownlint-enable MD041 -->\n\n# unbabelizer\n\n`unbabelizer` is an interactive CLI and TUI (Text User Interface) tool for\nmanaging gettext `.po` translation files.\nIt streamlines the localization workflow for Python projects by automating\nextraction, translation, review, and compilation of translation files.\n\nRead \ud83d\udc49 [Medium Blog Article](https://medium.com/stackademic/from-the-chaos-of-babel-to-app-translation-bliss-5afba78fc774) \ud83d\udc48 to learn more.\n\n## Purpose\n\nThe main goal of `unbabelizer` is to simplify and automate the process of\ninternationalizing Python applications.\nIt provides a guided interface for developers and translators to:\n\n- Extract translatable strings from source code using `babel`.\n- Automatically translate `.po` files using translation services.\n- Review and edit translations interactively.\n- Compile `.po` files into binary `.mo` files for deployment.\n- Manage multiple languages and domains with ease.\n- Integrate seamlessly with Babel and polib for robust gettext support.\n\nSupported translation services:\n\n- Google Translate\n- Microsoft Translator\n- Yandex Translator\n- ChatGPT Translation Service\n- MyMemory Translator\n- Deepl Translator\n\n## Demo\n\n[![ascii cast](https://asciinema.org/a/JWMSteKuWEp2UBCQJGCbrBdxr.svg)](https://asciinema.org/a/JWMSteKuWEp2UBCQJGCbrBdxr)\n\nThe app is itself available in German language. Simply run\n\n```shell\nLANG=de unbabelizer\n```\n\nto execute the app in German language.\n\n## Features\n\n- **Interactive TUI:** Edit and review translations in a modern terminal UI\n  powered by [Textual](https://github.com/Textualize/textual).\n- **Automated Extraction:** Find and extract translatable strings from your\n  codebase using Babel.\n- **Batch Translation:** Translate `.po` files automatically via Google Translate,\n  with support for multiple target languages.\n- **Review Workflow:** Step through translations, edit entries, and mark reviewed\n  items.\n- **Compilation:** Compile `.po` files to `.mo` for production use.\n- **Configurable:** Control all aspects via `pyproject.toml` or CLI arguments.\n- **Exclusion Patterns:** Skip files or directories using glob patterns.\n- **Custom Mapping:** Provide custom Babel mapping for source file types.\n- **Logging:** Detailed logging for troubleshooting and auditing translation changes.\n\n## Installation\n\nYou can install the package via pip:\n\n```shell\npip install unbabelizer\n```\n\n## Usage\n\nExecute in a directory with a `pyproject.toml` config file:\n\n```shell\nunbabelizer\n```\n\nThe configuration section in `pyproject.toml` might look as follows:\n\n```toml\n[tool.unbabelizer]\n# List of destination languages (e.g., German)\ndest_lang = [\"de\"]\n\n# Paths to search for source files\ninput_paths = [\"src\"]\n\n# Directory for locale files\nlocale_dir = \"src/unbabelizer/locales\"\n\n# Source language code\nsrc_lang = \"en\"\n\n# Domain for the .po files (default: \"messages\")\ndomain = \"messages\"\n\n# Patterns to exclude from searching (optional)\nexclude_patterns = [\"tests/*\", \"docs/*\"]\n\n# Content of the Babel mapping file (optional)\nmapping_file_content = \"\"\"\n[python: **.py]\nencoding = utf-8\n\"\"\"\n\n# Line width for .po files (optional, default: 120)\nline_width = 120\n\n# Translation service specific settings\napi_key = \"<my-api-key>\"\napi_key_type = \"<free or paid>\"\nmodel = \"gpt-3.5-turbo\"\nhttp_proxy = \"http://<my-proxy>\"\nhttps_proxy = \"https://<my-proxy>\"\n```\n\nYou can also override these settings using CLI arguments:\n\n```shell\nunbabelizer \\\n  --dest-lang de \\\n  --input-paths src \\\n  --locale-dir src/unbabelizer/locales \\\n  --src-lang en \\\n  --domain messages \\\n  --exclude-patterns tests/* docs/* \\\n  --mapping-file \"~/mapping_file.txt\" \\\n  --line-width 120\n```\n\n- `--dest-lang`: Destination language(s) (repeat or use multiple values)\n- `--input-paths`: Source file paths (repeat or use multiple values)\n- `--locale-dir`: Locale directory\n- `--src-lang`: Source language code\n- `--domain`: .po file domain\n- `--exclude-patterns`: Patterns to exclude (optional)\n- `--mapping-file`: Babel mapping file (optional)\n- `--line-width`: Line width for .po files (optional)\n\nRun `unbabelizer --help` to see all available options.\n\nSettings from the CLI override those in `pyproject.toml`.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A CLI tool to translate gettext .po files.",
    "version": "1.2.4",
    "project_urls": null,
    "split_keywords": [
        "translation",
        " google translate",
        " po files"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cd89b877be9d0a45b0068fc721c4c6892497b3ef081300519bbcb99ced726cfa",
                "md5": "1f044956dc1b1317e1a831ff3d3eee90",
                "sha256": "af8712e976a3441f994539d824acad46e7706a88c0a9c0b46535cee6aa0a5038"
            },
            "downloads": -1,
            "filename": "unbabelizer-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1f044956dc1b1317e1a831ff3d3eee90",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 66738,
            "upload_time": "2025-10-06T04:38:23",
            "upload_time_iso_8601": "2025-10-06T04:38:23.134221Z",
            "url": "https://files.pythonhosted.org/packages/cd/89/b877be9d0a45b0068fc721c4c6892497b3ef081300519bbcb99ced726cfa/unbabelizer-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "edb810ad34f46c156a6ecd5483f7c01cbacd6b87c922b6b5b86638de8f52b9c1",
                "md5": "3e3bb768ce177e0dbebb7054f1ef8451",
                "sha256": "d0d8980b9c78fa40edec23f770b4b1499aaa843c7e93e84d8243d9658695a10d"
            },
            "downloads": -1,
            "filename": "unbabelizer-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "3e3bb768ce177e0dbebb7054f1ef8451",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 53821,
            "upload_time": "2025-10-06T04:38:24",
            "upload_time_iso_8601": "2025-10-06T04:38:24.263620Z",
            "url": "https://files.pythonhosted.org/packages/ed/b8/10ad34f46c156a6ecd5483f7c01cbacd6b87c922b6b5b86638de8f52b9c1/unbabelizer-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-06 04:38:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "unbabelizer"
}
        
Elapsed time: 1.13056s