Giter Site home page Giter Site logo

i18nparse's Introduction

i18nparse

Localization of the Python argparse module

Current status

Only the French language translation is provided.

The binary wheel file contains litte endian mo translation files. Users of big endian systems should use the source distribution to generate the mo files on their own system.

Goals

The argparse module makes it easy to write user-friendly command-line interfaces. Specifically, it automatically generates help and usage messages and issues errors when users give the program invalid arguments. Unfortunately, even if the module is able to use gettext type localization strings, none is provided by the standard library.

This module provides some translations (at least a French one) and will be simply installable through pip

Installing

End user installation

With pip: pip install i18nparse.

Developper installation

If you want to contribute, you should get a copy of the full tree from GitHUB:

git clone https://github.com/s-ball/i18nparse.git [your_working_copy_folder]

Usage

The i18nparse module defines 2 functions:

def activate(lang = None)

which activates the usage of the translation for the required language. By default, the language for locale.getlocale() is used.

def deactivate()

which reverts to the original texts.

Example:

import argparse
import i18nparse

i18nparse.activate()     # Ok use current locale (if translation file exists)

parser = argparse.ArgumentParser('foo')
parser.print_help()      # displays the help message for the current locale

Assuming a fr_FR locale, this displays:

usage : foo [-h]

arguments optionnels:
  -h, --help  affiche ce message et termine le programme

Contributing

Contribution for new language translations or improvement of existing ones are welcome. See CONTRIBUTING for details

Versioning

This project uses a standard Major.Minor.Patch versioning pattern. Inside a major version, public API stability is expected (at least after 1.0.0 version will be published).

License

This project is licensed under the MIT License - see the LICENSE file for details

i18nparse's People

Contributors

nueh avatar s-ball avatar sg-ball avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.