mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
Merge pull request #88 from piranna/master
Added reference to `fr_DZ` locale on readme & clean-up
This commit is contained in:
51
README.rst
51
README.rst
@@ -4,10 +4,11 @@ num2words - Convert numbers to words in multiple languages
|
|||||||
.. image:: https://travis-ci.org/savoirfairelinux/num2words.svg?branch=master
|
.. image:: https://travis-ci.org/savoirfairelinux/num2words.svg?branch=master
|
||||||
:target: https://travis-ci.org/savoirfairelinux/num2words
|
:target: https://travis-ci.org/savoirfairelinux/num2words
|
||||||
|
|
||||||
``num2words`` is a library that converts numbers like ``42`` to words like ``forty-two``. It
|
``num2words`` is a library that converts numbers like ``42`` to words like
|
||||||
supports multiple languages (see the list below for full list of languages) and can even generate
|
``forty-two``. It supports multiple languages (English, Arabic, Danish, French,
|
||||||
ordinal numbers like ``forty-second`` (although this last feature is a bit buggy for some
|
German, Hebrew, Italian, Latvian, Norwegian, Polish, Portuguese, Russian,
|
||||||
languages at the moment).
|
Spanish and Lithuanian) and can even generate ordinal numbers like
|
||||||
|
``forty-second`` (altough this last feature is a bit buggy at the moment).
|
||||||
|
|
||||||
The project is hosted on https://github.com/savoirfairelinux/num2words
|
The project is hosted on https://github.com/savoirfairelinux/num2words
|
||||||
|
|
||||||
@@ -41,30 +42,32 @@ There's only one function to use::
|
|||||||
|
|
||||||
Besides the numerical argument, there's two optional arguments.
|
Besides the numerical argument, there's two optional arguments.
|
||||||
|
|
||||||
**ordinal:** A boolean flag indicating to return an ordinal number instead of a cardinal one.
|
**ordinal:** A boolean flag indicating to return an ordinal number instead of a
|
||||||
|
cardinal one.
|
||||||
|
|
||||||
**lang:** The language in which to convert the number. Supported values are:
|
**lang:** The language in which to convert the number. Supported values are:
|
||||||
|
|
||||||
* ``en`` (English, default)
|
|
||||||
* ``ar`` (Arabic)
|
* ``ar`` (Arabic)
|
||||||
* ``fr`` (French)
|
|
||||||
* ``de`` (German)
|
* ``de`` (German)
|
||||||
* ``es`` (Spanish)
|
* ``dk`` (Danish)
|
||||||
* ``lt`` (Lithuanian)
|
* ``en`` (English, default)
|
||||||
* ``lv`` (Latvian)
|
|
||||||
* ``en_GB`` (British English)
|
* ``en_GB`` (British English)
|
||||||
* ``en_IN`` (Indian English)
|
* ``en_IN`` (Indian English)
|
||||||
* ``no`` (Norwegian)
|
* ``es`` (Spanish)
|
||||||
* ``pl`` (Polish)
|
* ``fr`` (French)
|
||||||
* ``ru`` (Russian)
|
* ``fr_CH`` (Swiss French)
|
||||||
* ``dk`` (Danish)
|
* ``fr_DZ`` (Argelia French)
|
||||||
* ``pt_BR`` (Brazilian Portuguese)
|
|
||||||
* ``he`` (Hebrew)
|
* ``he`` (Hebrew)
|
||||||
* ``it`` (Italian)
|
* ``it`` (Italian)
|
||||||
* ``tr`` (Turkish)
|
* ``lt`` (Lithuanian)
|
||||||
|
* ``lv`` (Latvian)
|
||||||
|
* ``no`` (Norwegian)
|
||||||
|
* ``pl`` (Polish)
|
||||||
|
* ``pt_BR`` (Brazilian Portuguese)
|
||||||
|
* ``ru`` (Russian)
|
||||||
|
|
||||||
You can supply values like ``fr_FR``, the code will be
|
You can supply values like ``fr_FR``, the code will be correctly interpreted. If
|
||||||
correctly interpreted. If you supply an unsupported language, ``NotImplementedError`` is raised.
|
you supply an unsupported language, ``NotImplementedError`` is raised.
|
||||||
Therefore, if you want to call ``num2words`` with a fallback, you can do::
|
Therefore, if you want to call ``num2words`` with a fallback, you can do::
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -75,12 +78,12 @@ Therefore, if you want to call ``num2words`` with a fallback, you can do::
|
|||||||
History
|
History
|
||||||
-------
|
-------
|
||||||
|
|
||||||
``num2words`` is based on an old library, ``pynum2word`` created by Taro Ogawa in 2003.
|
``num2words`` is based on an old library, ``pynum2word`` created by Taro Ogawa
|
||||||
Unfortunately, the library stopped being maintained and the author can't be reached. There was
|
in 2003. Unfortunately, the library stopped being maintained and the author
|
||||||
another developer, Marius Grigaitis, who in 2011 added Lithuanian support, but didn't take over
|
can't be reached. There was another developer, Marius Grigaitis, who in 2011
|
||||||
maintenance of the project.
|
added Lithuanian support, but didn't take over maintenance of the project.
|
||||||
|
|
||||||
I am thus basing myself on Marius Grigaitis' improvements and re-publishing ``pynum2word`` as
|
I am thus basing myself on Marius Grigaitis' improvements and re-publishing
|
||||||
``num2words``.
|
``pynum2word`` as ``num2words``.
|
||||||
|
|
||||||
Virgil Dupras, Savoir-faire Linux
|
Virgil Dupras, Savoir-faire Linux
|
||||||
|
|||||||
Reference in New Issue
Block a user