Msgfmt build hook, replacing all po with mo in build
Project description
hatch-msgfmt
A hatch msgfmt plugin, simply replacing all po files with mo files, using msgfmt in PATH
.
At a future point, a pure-python version could be implemented, by implementing a pure-Python version of msgfmt. [The standard cpython msgfmt.py](https:// github.com/python/cpython/blob/main/Tools/i18n/msgfmt.py) could be a starting point for this, but it's not as capable as GNU Gettext, and doesn't support plural forms. Even with a fresh implementation, handling the file encoding from the header is challenging, especially for variable-length encodings like EUC-JP, which could feasibly cause particular problems.
Better to just use the system one for now. If somebody wants to submit a pure-
python implementation that functions, I'll gladly integrate it as a separate
msgfmtpy
plugin in the same repository.
Config parameters
-
locales
: The location of the source.po
files. -
destination
: The location of the destination.mo
files. They will be put into this location in the same structure as the source tree relative to thelocales
path. -
pathsub_regex
(optional): An input regex to match against source files for name changes. -
pathsub_replace
(required ifpathsub_regex
is present): An replacement pattern to use for name changes.
Copyright
This plugin is Copyright 2023 Absolute Performance, Inc. with contributions by Adrián Chaves.
MIT licensed.
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
File details
Details for the file hatch-msgfmt-1.1.6.tar.gz
.
File metadata
- Download URL: hatch-msgfmt-1.1.6.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 120ddeb7014adb776a7b1f35b2ce9e8b76da8a146804187ced933110231ed878 |
|
MD5 | 54b6534224a652fa653696c67872d7f7 |
|
BLAKE2b-256 | 6b9bc6019e612449a0c8da5b896d942894a8dafdad32587e46487842925432d9 |
File details
Details for the file hatch_msgfmt-1.1.6-py3-none-any.whl
.
File metadata
- Download URL: hatch_msgfmt-1.1.6-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a0e29a0fb6aa64433e672ebd0280c946e990d4363d00576f26fabfa0c0756d1 |
|
MD5 | 63636d1beea79934c2c953a7ba35bc04 |
|
BLAKE2b-256 | d7f928b9c39ffe0c7db2caba9318af3c134a9b5308e6ff86aeb658431257038e |