# po2lmo
A Python tool for converting GNU gettext PO files to Lua Machine Objects (LMO) binary format.
## Overview
po2lmo is a Python implementation of the original C version po2lmo tool, maintaining the same binary format compatibility. It converts GNU gettext PO files to LMO format, which is used by various Lua applications.
## Features
- Fully compatible with the original C version's binary format
- Supports Python 3.7+
- Provides both command-line tool and Python API
- Handles escape sequences and multi-line strings
- Duplicate key detection and error handling
- Debug output support
## Installation
Install using pip:
```bash
pip install po2lmo
```
## Usage
### Command Line Tool
After installation, you can use the `po2lmo` command:
```bash
po2lmo input.po output.lmo
```
Enable debug output:
```bash
po2lmo --debug input.po output.lmo
```
### Python API
You can also use it in Python code:
```python
from po2lmo import parse_po_file, write_lmo_file
# Parse PO file
entries = parse_po_file('input.po')
# Write LMO file
write_lmo_file(entries, 'output.lmo')
```
## Development
### Install from Source
```bash
git clone https://github.com/stevenjoezhang/po2lmo.py.git
cd po2lmo
pip install -e .
```
### Run Tests
```bash
python -m pytest tests/
```
## License
MIT License
## Contributing
Issues and Pull Requests are welcome!
## Original Version
Original C version:
Copyright (C) 2009-2012 Jo-Philipp Wich <xm@subsignal.org>
Raw data
{
"_id": null,
"home_page": "https://github.com/stevenjoezhang/po2lmo.py",
"name": "po2lmo",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "Shuqiao Zhang <stevenjoezhang@gmail.com>",
"keywords": "gettext, po, lmo, lua, internationalization, localization, i18n, l10n",
"author": "Shuqiao Zhang",
"author_email": "Shuqiao Zhang <stevenjoezhang@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/6b/2a/c06c9c6c9bdf64ef076a6e3d1dc718852b961b3ab6601c4fb2af138c6e44/po2lmo-1.0.0.tar.gz",
"platform": null,
"description": "# po2lmo\n\nA Python tool for converting GNU gettext PO files to Lua Machine Objects (LMO) binary format.\n\n## Overview\n\npo2lmo is a Python implementation of the original C version po2lmo tool, maintaining the same binary format compatibility. It converts GNU gettext PO files to LMO format, which is used by various Lua applications.\n\n## Features\n\n- Fully compatible with the original C version's binary format\n- Supports Python 3.7+\n- Provides both command-line tool and Python API\n- Handles escape sequences and multi-line strings\n- Duplicate key detection and error handling\n- Debug output support\n\n## Installation\n\nInstall using pip:\n\n```bash\npip install po2lmo\n```\n\n## Usage\n\n### Command Line Tool\n\nAfter installation, you can use the `po2lmo` command:\n\n```bash\npo2lmo input.po output.lmo\n```\n\nEnable debug output:\n\n```bash\npo2lmo --debug input.po output.lmo\n```\n\n### Python API\n\nYou can also use it in Python code:\n\n```python\nfrom po2lmo import parse_po_file, write_lmo_file\n\n# Parse PO file\nentries = parse_po_file('input.po')\n\n# Write LMO file\nwrite_lmo_file(entries, 'output.lmo')\n```\n\n## Development\n\n### Install from Source\n\n```bash\ngit clone https://github.com/stevenjoezhang/po2lmo.py.git\ncd po2lmo\npip install -e .\n```\n\n### Run Tests\n\n```bash\npython -m pytest tests/\n```\n\n## License\n\nMIT License\n\n## Contributing\n\nIssues and Pull Requests are welcome!\n\n## Original Version\n\nOriginal C version:\nCopyright (C) 2009-2012 Jo-Philipp Wich <xm@subsignal.org>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert GNU gettext PO files to Lua Machine Objects (LMO) binary format",
"version": "1.0.0",
"project_urls": {
"Changelog": "https://github.com/stevenjoezhang/po2lmo.py/blob/main/CHANGELOG.md",
"Homepage": "https://github.com/stevenjoezhang/po2lmo.py",
"Issues": "https://github.com/stevenjoezhang/po2lmo.py/issues",
"Repository": "https://github.com/stevenjoezhang/po2lmo.py"
},
"split_keywords": [
"gettext",
" po",
" lmo",
" lua",
" internationalization",
" localization",
" i18n",
" l10n"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d95e813b8aa30445ecffeeba355276d962064abbdf89cbd3db46aa15cec70bb4",
"md5": "60a27d34d87c917aca4c1a891897c487",
"sha256": "80e4d7c8cf397892f4815b31ad2907917c0bb3063134d1e984e0c723352924c0"
},
"downloads": -1,
"filename": "po2lmo-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "60a27d34d87c917aca4c1a891897c487",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7613,
"upload_time": "2025-07-26T16:01:00",
"upload_time_iso_8601": "2025-07-26T16:01:00.699805Z",
"url": "https://files.pythonhosted.org/packages/d9/5e/813b8aa30445ecffeeba355276d962064abbdf89cbd3db46aa15cec70bb4/po2lmo-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6b2ac06c9c6c9bdf64ef076a6e3d1dc718852b961b3ab6601c4fb2af138c6e44",
"md5": "d6f6a7349f85df87a95ba7d19c727dd7",
"sha256": "7363afc8798991cd588a655eabfd4c1eff8557794043259e888e106a38c7cf6d"
},
"downloads": -1,
"filename": "po2lmo-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "d6f6a7349f85df87a95ba7d19c727dd7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7956,
"upload_time": "2025-07-26T16:01:02",
"upload_time_iso_8601": "2025-07-26T16:01:02.309957Z",
"url": "https://files.pythonhosted.org/packages/6b/2a/c06c9c6c9bdf64ef076a6e3d1dc718852b961b3ab6601c4fb2af138c6e44/po2lmo-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-26 16:01:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "stevenjoezhang",
"github_project": "po2lmo.py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "po2lmo"
}