{"library":"python-gettext","title":"python-gettext","description":"python-gettext is a Python library and command-line tool designed to compile Gettext `.po` (Portable Object) files into `.mo` (Machine Object) files. These `.mo` files are then used by internationalization (i18n) systems for runtime message translation. The current version is 5.0, with releases typically tied to Python version compatibility or API refinements.","language":"python","status":"active","last_verified":"Mon May 18","install":{"commands":["pip install python-gettext"],"cli":{"name":"python-gettext","version":"sh: 1: python-gettext: not found"}},"imports":["from gettext_compiler import compile_mo_file"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom gettext_compiler import compile_mo_file\n\n# Create a dummy .po file for demonstration\npo_content = '''\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Test Project\\n\"\n\"Language-Team: \\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\nmsgid \"Hello, world!\"\nmsgstr \"Hola, mundo!\"\n'''\n\npo_file_path = \"example.po\"\nmo_file_path = \"example.mo\"\n\nwith open(po_file_path, \"w\", encoding=\"utf-8\") as f:\n    f.write(po_content)\n\n# Compile the .po file to a .mo file\ntry:\n    compile_mo_file(po_file_path, mo_file_path)\n    print(f\"Successfully compiled '{po_file_path}' to '{mo_file_path}'\")\nexcept Exception as e:\n    print(f\"Error compiling file: {e}\")\nfinally:\n    # Clean up the created files\n    if os.path.exists(po_file_path):\n        os.remove(po_file_path)\n    if os.path.exists(mo_file_path):\n        os.remove(mo_file_path)\n","lang":"python","description":"This quickstart demonstrates how to programmatically compile a `.po` file into a `.mo` file using `gettext_compiler.compile_mo_file`. It creates a simple dummy `.po` file, compiles it, and then cleans up the generated files.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-18","installed_version":"5.0","pypi_latest":"5.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.5,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"17.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.5,"import_time_s":null,"mem_mb":null,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.6,"import_time_s":null,"mem_mb":null,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.4,"import_time_s":null,"mem_mb":null,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.4,"import_time_s":null,"mem_mb":null,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"17.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"python-gettext","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.7,"import_time_s":null,"mem_mb":null,"disk_size":"18M"}]}}