Skip to main content

Internationalization for argparse help

Project description

argparse-help-i18n

English | Русский | Español | Français | Italiano | 中文 | العربية


English

argparse-help-i18n is a lightweight Python package that adds internationalization (i18n) support to argparse help messages.

It provides a HelpI18nMixin class that automatically translates --help / -h and --version / -v option descriptions using locale-plus and GNU Gettext.

Features

  • Automatic translation of help and version option descriptions
  • Uses system locale settings (locale.setlocale(locale.LC_ALL, ''))
  • Built on locale-plus for reliable locale handling
  • Easy to integrate with existing argparse code

Installation

pip install argparse-help-i18n

Usage

from argparse_help_i18n import HelpI18nMixin

parser = HelpI18nMixin(description="My app description")
parser.add_argument("--input", help="Input file")
parser.parse_args()

Translation Files

Place .mo files in argparse_help_i18n/locale/{lang}/LC_MESSAGES/argparse- help.mo

Development

uv sync --group dev
devscript generate  # Extract strings
devscript compile   # Compile translations

License

MIT


Русский

argparse-help-i18n — это лёгкий пакет Python, добавляющий интернационализацию (i18n) в справочные сообщения argparse.

Он предоставляет класс HelpI18nMixin, который автоматически переводит описания опций --help / -h и --version / -v с помощью locale-plus и GNU Gettext.

Возможности

  • Автоматический перевод описаний опций помощи и версии
  • Использует системные настройки локали (locale.setlocale(locale.LC_ALL, ''))
  • Построен на locale-plus для надёжной обработки локали
  • Лёгкая интеграция с существующим кодом argparse

Установка

pip install argparse-help-i18n

Использование

from argparse_help_i18n import HelpI18nMixin

parser = HelpI18nMixin(description="Описание моего приложения")
parser.add_argument("--input", help="Входной файл")
parser.parse_args()

Файлы переводов

Разместите файлы .mo в argparse_help_i18n/locale/{lang}/LC_MESSAGES/argparse-help.mo

Разработка

uv sync --group dev
devscript generate  # Извлечение строк
devscript compile   # Компиляция переводов

Лицензия

MIT


Español

argparse-help-i18n es un paquete ligero de Python que añade internacionalización (i18n) a los mensajes de ayuda de argparse.

Proporciona una clase HelpI18nMixin que traduce automáticamente las descripciones de las opciones --help / -h y --version / -v usando locale-plus y GNU Gettext.

Características

  • Traducción automática de las descripciones de ayuda y versión
  • Utiliza la configuración regional del sistema (locale.setlocale(locale.LC_ALL, ''))
  • Basado en locale-plus para un manejo fiable de la configuración regional
  • Fácil integración con código argparse existente

Instalación

pip install argparse-help-i18n

Uso

from argparse_help_i18n import HelpI18nMixin

parser = HelpI18nMixin(description="Descripción de mi aplicación")
parser.add_argument("--input", help="Archivo de entrada")
parser.parse_args()

Archivos de traducción

Coloque los archivos .mo en argparse_help_i18n/locale/{lang}/LC_MESSAGES/argparse-help.mo

Desarrollo

uv sync --group dev
devscript generate  # Extraer cadenas
devscript compile   # Compilar traducciones

Licencia

MIT


Français

argparse-help-i18n est un package Python léger qui ajoute la prise en charge de l'internationalisation (i18n) aux messages d'aide d'argparse.

Il fournit une classe HelpI18nMixin qui traduit automatiquement les descriptions des options --help / -h et --version / -v en utilisant locale-plus et GNU Gettext.

Fonctionnalités

  • Traduction automatique des descriptions d'aide et de version
  • Utilise les paramètres régionaux du système (locale.setlocale(locale.LC_ALL, ''))
  • Basé sur locale-plus pour une gestion fiable des locales
  • Intégration facile avec le code argparse existant

Installation

pip install argparse-help-i18n

Utilisation

from argparse_help_i18n import HelpI18nMixin

parser = HelpI18nMixin(description="Description de mon application")
parser.add_argument("--input", help="Fichier d'entrée")
parser.parse_args()

Fichiers de traduction

Placez les fichiers .mo dans argparse_help_i18n/locale/{lang}/LC_MESSAGES/argparse-help.mo

Développement

uv sync --group dev
devscript generate  # Extraire les chaînes
devscript compile   # Compiler les traductions

Licence

MIT


Italiano

argparse-help-i18n è un pacchetto Python leggero che aggiunge il supporto all'internazionalizzazione (i18n) per i messaggi di aiuto di argparse.

Fornisce una classe HelpI18nMixin che traduce automaticamente le descrizioni delle opzioni --help / -h e --version / -v utilizzando locale-plus e GNU Gettext.

Caratteristiche

  • Traduzione automatica delle descrizioni delle opzioni di aiuto e versione
  • Utilizza le impostazioni locali di sistema (locale.setlocale(locale.LC_ALL, ''))
  • Basato su locale-plus per una gestione affidabile delle impostazioni locali
  • Facile integrazione con codice argparse esistente

Installazione

pip install argparse-help-i18n

Utilizzo

from argparse_help_i18n import HelpI18nMixin

parser = HelpI18nMixin(description="Descrizione della mia applicazione")
parser.add_argument("--input", help="File di input")
parser.parse_args()

File di traduzione

Posiziona i file .mo in argparse_help_i18n/locale/{lang}/LC_MESSAGES/argparse-help.mo

Sviluppo

uv sync --group dev
devscript generate  # Estrai stringhe
devscript compile   # Compila traduzioni

Licenza

MIT


中文

argparse-help-i18n 是一个轻量级的 Python 包,为 argparse 的帮助消息添加国际化(i18n)支持。

它提供了一个 HelpI18nMixin 类,使用 locale-plus 和 GNU Gettext 自动翻译 --help / -h--version / -v 选项的描述。

特性

  • 自动翻译帮助和版本选项的描述
  • 使用系统区域设置(locale.setlocale(locale.LC_ALL, '')
  • 基于 locale-plus 实现可靠的区域处理
  • 易于集成到现有的 argparse 代码中

安装

pip install argparse-help-i18n

使用

from argparse_help_i18n import HelpI18nMixin

parser = HelpI18nMixin(description="我的应用程序描述")
parser.add_argument("--input", help="输入文件")
parser.parse_args()

翻译文件

.mo 文件放置在 argparse_help_i18n/locale/{lang}/LC_MESSAGES/argparse-help.mo

开发

uv sync --group dev
devscript generate  # 提取字符串
devscript compile   # 编译翻译

许可证

MIT


العربية

argparse-help-i18n هي حزمة Python خفيفة الوزن تضيف دعم التدويل (i18n) لرسائل المساعدة في argparse.

توفر class HelpI18nMixin والذي يترجم تلقائيًا أوصاف الخيارين --help / -h و --version / -v باستخدام locale-plus و GNU Gettext.

الميزات

  • ترجمة تلقائية لأوصاف خيارات المساعدة والإصدار
  • يستخدم إعدادات اللغة الإقليمية للنظام (locale.setlocale(locale.LC_ALL, ''))
  • مبني على locale-plus للتعامل الموثوق مع اللغة الإقليمية
  • سهل الدمج مع كود argparse الحالي

التثبيت

pip install argparse-help-i18n

الاستخدام

from argparse_help_i18n import HelpI18nMixin

parser = HelpI18nMixin(description="وصف تطبيقي")
parser.add_argument("--input", help="ملف الإدخال")
parser.parse_args()

ملفات الترجمة

ضع ملفات .mo في المسار argparse_help_i18n/locale/{lang}/LC_MESSAGES/argparse-help.mo

التطوير

uv sync --group dev
devscript generate  # استخراج النصوص
devscript compile   # ترجمة الملفات

الترخيص

MIT

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

argparse_help_i18n-0.2.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

argparse_help_i18n-0.2.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file argparse_help_i18n-0.2.1.tar.gz.

File metadata

  • Download URL: argparse_help_i18n-0.2.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for argparse_help_i18n-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1cec95bbe667a9e8706014d357e223a698072abdccf2f683a98db83abab7c5e0
MD5 430ca87efdbcf19286e504b27e403836
BLAKE2b-256 0112477611c1e039300ada7eb9c4df3f0a34afc1fbd5469c64d1422de7e4f1fb

See more details on using hashes here.

File details

Details for the file argparse_help_i18n-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for argparse_help_i18n-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f44780fbef61ccf57d299840c81754e7d2b007ecdf5b6e93c88db96fcbf4155a
MD5 969702acf85cbce82da37ad961921a6e
BLAKE2b-256 6e08b9f0a2e1d03222d6b98f7d5fe6a88e745afc5353d4872baf585158a642f8

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