fabricatio-locale
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
All options below are read through the fabricatio configuration chain (see the
Configuration Guide). Set them under the
[ext.locale] table in fabricatio.toml, equivalently under
[tool.fabricatio.ext.locale] in pyproject.toml, or via
FABRICATIO_EXT__LOCALE__<FIELD_UPPER> environment variables.
[ext.locale]
The schema currently defines no options and is reserved for future use.
Access at runtime: from fabricatio_locale.config import locale_config.
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 (theTranslatecapability)polib(Rust) — PO file parsing and writing
License
MIT — see LICENSE
Metadata
Release files for fabricatio-locale 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 5.7 MB
Release files / fabricatio_locale-0.1.9-cp314-cp314-win_amd64.whl
| Download URL | fabricatio_locale-0.1.9-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 409.4 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
11ece4f52ef2b4843bf41dc6c4b6556a50def5479af9cba46933e8d808fa2b10
|
|
BLAKE2b-256 checksum How to use checksums |
63759b5ebdcf2ae0b06ef956c529c3817a3e7a2ac4a7dc487f6e7f0110acc563
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp314-cp314-manylinux_2_34_x86_64.whl
| Download URL | fabricatio_locale-0.1.9-cp314-cp314-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 530.4 kB |
| Tags | CPython 3.14 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
f229effb1c218b558cfc898deb45128e7605ecb992667ff89ec8b463c6102da6
|
|
BLAKE2b-256 checksum How to use checksums |
fbf030ec725b87b718aadf1ce9cce88c095381afa6df40abb4868743a0959fd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp314-cp314-manylinux_2_34_aarch64.whl
| Download URL | fabricatio_locale-0.1.9-cp314-cp314-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 489.3 kB |
| Tags | CPython 3.14 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
458658fa325d3f0b395b492b33ee6c80fc62cadf58f86214b6511b384b8d63f2
|
|
BLAKE2b-256 checksum How to use checksums |
87745ab257479992de679b11d55c6b2fa555e07374a8cdfa612c3094b8f6be75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | fabricatio_locale-0.1.9-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 470.3 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c7ec85ef446fde1ec85b194a4296fee14fa8171aa5865972e178dd8869a48433
|
|
BLAKE2b-256 checksum How to use checksums |
0da1c9ad947151621d6e62799beac5107bb510cd4f5e82e50454128b8c9e9880
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp313-cp313-win_amd64.whl
| Download URL | fabricatio_locale-0.1.9-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 410.0 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9bec76d75bbab5a38098bd69c4299927be04481a20bef95e2d8b1165f1e8d1fe
|
|
BLAKE2b-256 checksum How to use checksums |
d72134a42cda31006054819a26f14ba940b64b618281096d643651232c5e9dc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp313-cp313-manylinux_2_34_x86_64.whl
| Download URL | fabricatio_locale-0.1.9-cp313-cp313-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 530.5 kB |
| Tags | CPython 3.13 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
40fe872340362869a0256354136b63746d4d0aa98160b4190dc5438e08563f5d
|
|
BLAKE2b-256 checksum How to use checksums |
76316eec9048d4fd3aba737e49cab029b08eb51cecf07b6048e17981349997ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp313-cp313-manylinux_2_34_aarch64.whl
| Download URL | fabricatio_locale-0.1.9-cp313-cp313-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 489.4 kB |
| Tags | CPython 3.13 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
e7ceac089c3d3f646d916287b5ebcd0028ccaaba9ae050f879b1af2960ed6d9d
|
|
BLAKE2b-256 checksum How to use checksums |
1b3fe99c51a76a4585a755e1f4bbf958a276abc76cd82e3d23112e3f83e33f6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | fabricatio_locale-0.1.9-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 469.7 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1fcc84ffa6860f0731c89530134c15b55bc0659fab22cd4704a3d4650ff15e40
|
|
BLAKE2b-256 checksum How to use checksums |
6f2e90f338b9f802b2e68e65da67b6bf0ea81a18407def6d50f1b802af150ccf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp312-cp312-win_amd64.whl
| Download URL | fabricatio_locale-0.1.9-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 410.1 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
74f8a0d1d669c903df175fc5f958df266f614a4bf630d8b158e8b005303a5d4c
|
|
BLAKE2b-256 checksum How to use checksums |
b669b3b4de5bff035476ffcd694f2941ca74ec14e44f0066ad666a2e66d61515
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | fabricatio_locale-0.1.9-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 530.8 kB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
d4426b536a305869536c5658bdb19fec74d7bf783b8162596783cc4b833ca3ce
|
|
BLAKE2b-256 checksum How to use checksums |
d67ae40f5987fdd987d7e96722ce3b4900362939179330a4ecce7ebf9ed166a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp312-cp312-manylinux_2_34_aarch64.whl
| Download URL | fabricatio_locale-0.1.9-cp312-cp312-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 489.7 kB |
| Tags | CPython 3.12 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
dd5e905429bbf3b3e82ece93a8edcc45352c3a362a3b99f875664f5927a7018a
|
|
BLAKE2b-256 checksum How to use checksums |
346bfc317f9e8a28c69e452fd5b2c71391fedc18e60aa1ccb40c0d0ab90d7c6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / fabricatio_locale-0.1.9-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | fabricatio_locale-0.1.9-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 469.6 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
16e4e2d74a5d0b34dcf9fc9cf5cb998503553517369b7f8cbce169168ee0e7b6
|
|
BLAKE2b-256 checksum How to use checksums |
2e8fdc9a54b628cde82c73cc1562677cb4709a25726a0e83e83c1afb803d7e8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|