Skip to main content

Convert GNU gettext PO files to Lua Machine Objects (LMO) binary format

Project description

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:

pip install po2lmo

Usage

Command Line Tool

After installation, you can use the po2lmo command:

po2lmo input.po output.lmo

Enable debug output:

po2lmo --debug input.po output.lmo

Python API

You can also use it in Python code:

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

git clone https://github.com/stevenjoezhang/po2lmo.py.git
cd po2lmo
pip install -e .

Run Tests

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

po2lmo-1.0.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

po2lmo-1.0.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file po2lmo-1.0.0.tar.gz.

File metadata

  • Download URL: po2lmo-1.0.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for po2lmo-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7363afc8798991cd588a655eabfd4c1eff8557794043259e888e106a38c7cf6d
MD5 d6f6a7349f85df87a95ba7d19c727dd7
BLAKE2b-256 6b2ac06c9c6c9bdf64ef076a6e3d1dc718852b961b3ab6601c4fb2af138c6e44

See more details on using hashes here.

File details

Details for the file po2lmo-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: po2lmo-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for po2lmo-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80e4d7c8cf397892f4815b31ad2907917c0bb3063134d1e984e0c723352924c0
MD5 60a27d34d87c917aca4c1a891897c487
BLAKE2b-256 d95e813b8aa30445ecffeeba355276d962064abbdf89cbd3db46aa15cec70bb4

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