Skip to main content

An extension of fabricatio, which brings up the capability to generate locolization based on po file.

Project description

fabricatio-locale

MIT License Python Versions PyPI Version PyPI Downloads PyPI Downloads Bindings: PyO3 Build Tool: uv

Localization extension for Fabricatio. Reads, translates, and writes gettext .po files using LLM-powered translation.


Installation

pip install fabricatio[locale]
# or
uv pip install fabricatio[locale]

Overview

fabricatio-locale automates .po file localization by combining Rust-backed PO file I/O with Fabricatio's translation pipeline. It parses standard gettext .po files, translates message strings to a target language via fabricatio-translate, and writes the localized file back — preserving message IDs, metadata, and file structure.

API

Rust-backed (PyO3)

Symbol Description
Msg(id, txt) Immutable message object: id is the msgid, txt is the translated msgstr.
read_pofile(path) Parses a .po file and returns list[Msg].
update_pofile(path, messages) Writes a sequence of Msg back to a .po file.

These are available as from fabricatio_locale.rust import Msg, read_pofile, update_pofile.

Capability

Class Description
Localize Extends Translate. Provides async localize(msgs: list[Msg], **kwargs) -> list[Msg] — translates message texts while preserving IDs.

Action

Class Description
LocalizePoFile An executable action combining Localize with PO file I/O. Fields: pofile (source path), target_lang (language code), output_path (defaults to overwriting input). Calling execute() reads, localizes, and writes the file.

Configuration

from fabricatio_locale.config import locale_config
# LocaleConfig is a frozen dataclass loaded from Fabricatio's configuration system.

Usage

from fabricatio_locale.rust import Msg, read_pofile, update_pofile

# Read a PO file
messages = read_pofile("locales/en.po")
for msg in messages:
    print(f"msgid={msg.id} msgstr={msg.txt}")

# Modify and write back
updated = [Msg(id=m.id, txt="translated text") for m in messages]
update_pofile("locales/en.po", updated)
from fabricatio_locale.capabilities.localize import Localize

# Localize messages programmatically
class MyLocalizer(Localize):
    pass

localizer = MyLocalizer()
result = await localizer.localize(
    [Msg(id="hello", txt="Hello")],
    target_language="fr"
)
# result[0].txt -> "Bonjour"
from fabricatio_locale.actions.localize import LocalizePoFile

# End-to-end PO file localization
action = LocalizePoFile(
    pofile="locales/en.po",
    target_lang="es",
    output_path="locales/es.po"
)
output = await action.execute()
# output: Path("locales/es.po")

Dependencies

  • fabricatio-core — core interfaces (Action, configuration)
  • fabricatio-translate — LLM translation pipeline (the Translate capability)
  • polib (Rust) — PO file parsing and writing

License

MIT — see LICENSE

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 Distributions

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

fabricatio_locale-0.1.8-cp314-cp314-win_amd64.whl (438.5 kB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio_locale-0.1.8-cp314-cp314-manylinux_2_34_x86_64.whl (553.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

fabricatio_locale-0.1.8-cp314-cp314-manylinux_2_34_aarch64.whl (513.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

fabricatio_locale-0.1.8-cp314-cp314-macosx_11_0_arm64.whl (501.7 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

fabricatio_locale-0.1.8-cp313-cp313-win_amd64.whl (439.0 kB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio_locale-0.1.8-cp313-cp313-manylinux_2_34_x86_64.whl (553.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

fabricatio_locale-0.1.8-cp313-cp313-manylinux_2_34_aarch64.whl (512.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

fabricatio_locale-0.1.8-cp313-cp313-macosx_11_0_arm64.whl (500.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fabricatio_locale-0.1.8-cp312-cp312-win_amd64.whl (438.5 kB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio_locale-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl (553.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fabricatio_locale-0.1.8-cp312-cp312-manylinux_2_34_aarch64.whl (513.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio_locale-0.1.8-cp312-cp312-macosx_11_0_arm64.whl (501.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file fabricatio_locale-0.1.8-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 438.5 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 1d049e150c0f8cd5f7a57bf63d89c8d00147a62ae140096a3b4031c36688c693
MD5 03d3ba2c441f613b839b7634c4e63902
BLAKE2b-256 75ad8944ea041510db0e2ed63494ac06b46d370e4c7aaba63d150766a83f7f86

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp314-cp314-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 553.2 kB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3999bccc6d592200ce5aca488d2074ec057091487ebb4d2d3c542c8556a6a95a
MD5 43f11eadbf276284cf4a61df0caf9e1a
BLAKE2b-256 07bd1d75fa5e715b111a005ff41a5e269ebdd7204d120609dd0713dbe4ce2404

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp314-cp314-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 513.4 kB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 c65a03c823e3edda2b572895dbacab36ce5135e4bbf302ec832343024476ccd8
MD5 59ac9473991728a4d61c11d922ab1df8
BLAKE2b-256 2a480e41cc023de70ef37cb8a3c95c45e863e69eadcd11bb7a603b91f0ae1dfe

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 501.7 kB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 397082d3ec6bf1aaa86856ecc0ee422c306c78d509a5884e72a988469b2fa1f1
MD5 59607a4413bfea7e159c4754e68fb1ae
BLAKE2b-256 463686778f11f72e169e88275b547736476e00ea0be7b7b46123944bddfd6260

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 439.0 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1bfe6b872ad57f820d40ee16d5508a72be83d7753f85daf7db4fb5c9a66d3642
MD5 36a4f8d370d5c21473e9d5908cdbeb81
BLAKE2b-256 e5556a0016e581c05fd828776c8869b81437f758eae316cf510017780d77ccc3

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp313-cp313-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 553.1 kB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 fd0366a9985483300ea2bb0fcb333195d86e41aade02cdc8459d97ca6bf94657
MD5 cc0d509a5ec9744baae566a1d0299e59
BLAKE2b-256 498e63de0f602d941f8fae9243a9ece16f35c69db90fae09f68bdf29b50b241a

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp313-cp313-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 512.8 kB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 b9d1476739489b0408c03bfed82c4c2b9777ab134f5fe4d299be19f4fe469c7a
MD5 628040a2bc54802f5dbe66bc6f61378e
BLAKE2b-256 6da1b42d1b2ebfa01f1fb363d3d546c445c2b39eab2560b3ffc05b91a1ccc71f

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 500.9 kB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfc802b92328f93b219feb13a56394390432b850fb6f6612684560eedf4ddefe
MD5 67e9d2f3d32943e6576c6a9e0150631a
BLAKE2b-256 2efd6e512bd1ddc9ab7171b304814e7a1b409d31f7e75b16de61d47f5f731e33

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 438.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d5b3c9523554a758ad38c17d2276e6b64bce93f5de4e923c2cdd044060c82beb
MD5 28f55c441278114d4cf5363e69a56cdd
BLAKE2b-256 07a1eca04047dd95fd51bf413097ff6d2bee7c165d133067a7e2724abfba2487

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 553.3 kB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2a42a57e1903da84d49861e307f0cd834d20ac8df27606061162f0989e112523
MD5 85027af8357265da161eee2fe7d8a45c
BLAKE2b-256 186b3a0df8caf219bf5598ded862b0848f8fe7b33c6c65cff5648dd481293da2

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp312-cp312-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 513.5 kB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 3381928384e91e9d8d904c2eae2131f95389a5db7829e626617cd35c08be92b3
MD5 bcf838fafc476f047ad697abb4cfec58
BLAKE2b-256 d57a91d5516595c66cb5f5e6d690ad4a83233d93d9cd6d813d42129374e36466

See more details on using hashes here.

File details

Details for the file fabricatio_locale-0.1.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_locale-0.1.8-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 501.0 kB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_locale-0.1.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be738054e3c913d70be49e6b3ed65bfe964177814e536a063383cbcc368989a6
MD5 99cd2e2b7ff3daa6adec00cca4796506
BLAKE2b-256 ecee86ef805307b44f54b5b8fc12da1c0237bfd11c50b8c34cda783895ac4713

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