Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodriguezg1991 authored Aug 4, 2022
2 parents ea27285 + 2a0148b commit b3e717c
Show file tree
Hide file tree
Showing 37 changed files with 7,683 additions and 220 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions coveralls
pip install -r requirements-test.txt
- name: Test with tox
run: |
tox
- name: Upload coverage data to coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true

coveralls:
name: Indicate completion to coveralls.io
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

28 changes: 28 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
Changelog
=========

Version 0.5.11 -- 2022/08/03
----------------------------

* Add KZT and UAH currencies to lang RU (#264)
* Add es_NI currency (#276)
* Update .gitignore to add .eggs/ directory (#280)
* Fix Hebrew support (#289)
* Update test_tr.py to increase coverage (#298)
* Add ordinal 12,345 to ES test suite to increase coverage (#287)
* Add simple tests for lang_DK.py (#286)
* Add testcase for lang_EN.py (#288)
* Add more tests to base.py (#283)
* Fixed misspelling of 21 (cardinal and ordinal number) in IT language (#270)
* Romanian issues 259 (#260)
* Adding Language Support for Telugu / Bug Fix in Kannada (#263)
* Add support of Kazakh language (KZ) (#306)
* Update README.rst (#307)
* Added support for Hungarian language (#310)
* [UPD] Readme file (#363)
* [ADD] num2words: add traslation to spanish of several currencies (#356)
* added swedish language including test cases (#352)
* Remove dupplicated line in lang_PT_BR (#355)
* Fix ordinal_num output for Dutch (NL) (#369)
* Polishordinals (#367)
* [tr] return Turkish 0 ordinal and cardinal (#347)
* Improve Ukrainian support and minor fixes in CZ, KZ, LT, LV, PL, RU, SR languages (#400)
* feat: ci: replace travis by github workflows (#448)
* [ES] Added missing accents ("dieciséis", "dólar", "dólares", "veintiún"), improved currency gender handling, fixed pound cent names (#443)

Version 0.5.10 -- 2019/05/12
----------------------------
Expand Down
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
num2words - Convert numbers to words in multiple languages
==========================================================
num2words library - Convert numbers to words in multiple languages
==================================================================

.. image:: https://img.shields.io/pypi/v/num2words.svg
:target: https://pypi.python.org/pypi/num2words
Expand Down Expand Up @@ -51,7 +51,7 @@ Command line::
$ num2words 24,120.10 -l es
veinticuatro mil ciento veinte punto uno
$num2words 2.14 -l es --to currency
dos euros con catorce centimos
dos euros con catorce céntimos

In code there's only one function to use::

Expand Down Expand Up @@ -107,6 +107,7 @@ Besides the numerical argument, there are two main optional arguments.
* ``pt_BR`` (Portuguese - Brazilian)
* ``sl`` (Slovene)
* ``sr`` (Serbian)
* ``sv`` (Swedish)
* ``ro`` (Romanian)
* ``ru`` (Russian)
* ``te`` (Telugu)
Expand Down
4 changes: 2 additions & 2 deletions bin/num2words
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Examples:
veinticuatro mil ciento veinte punto uno
$num2words 2.14 -l es --to currency
dos euros con catorce centimos
dos euros con catorce céntimos
"""

from __future__ import print_function, unicode_literals
Expand All @@ -55,7 +55,7 @@ import sys
from docopt import docopt
import num2words

__version__ = "0.5.10"
__version__ = "0.5.11"
__license__ = "LGPL"


Expand Down
6 changes: 3 additions & 3 deletions num2words/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
lang_FR_BE, lang_FR_CH, lang_FR_DZ, lang_HE, lang_HU, lang_ID,
lang_IT, lang_JA, lang_KN, lang_KO, lang_KZ, lang_LT, lang_LV,
lang_NL, lang_NO, lang_PL, lang_PT, lang_PT_BR, lang_RO,
lang_RU, lang_SL, lang_SR, lang_TE, lang_TH, lang_TR, lang_UK,
lang_VI)
lang_RU, lang_SL, lang_SR, lang_SV, lang_TE, lang_TH, lang_TR,
lang_UK, lang_VI)

CONVERTER_CLASSES = {
'ar': lang_AR.Num2Word_AR(),
Expand Down Expand Up @@ -52,6 +52,7 @@
'ru': lang_RU.Num2Word_RU(),
'sl': lang_SL.Num2Word_SL(),
'sr': lang_SR.Num2Word_SR(),
'sv': lang_SV.Num2Word_SV(),
'no': lang_NO.Num2Word_NO(),
'dk': lang_DK.Num2Word_DK(),
'pt': lang_PT.Num2Word_PT(),
Expand All @@ -67,7 +68,6 @@
'hu': lang_HU.Num2Word_HU()
}


CONVERTES_TYPES = ['cardinal', 'ordinal', 'ordinal_num', 'year', 'currency']


Expand Down
6 changes: 5 additions & 1 deletion num2words/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ def pluralize(self, n, forms):
"""
raise NotImplementedError

def _money_verbose(self, number, currency):
return self.to_cardinal(number)

def _cents_verbose(self, number, currency):
return self.to_cardinal(number)

Expand Down Expand Up @@ -290,12 +293,13 @@ def to_currency(self, val, currency='EUR', cents=True, separator=',',
cr1 = prefix_currency(self.CURRENCY_ADJECTIVES[currency], cr1)

minus_str = "%s " % self.negword if is_negative else ""
money_str = self._money_verbose(left, currency)
cents_str = self._cents_verbose(right, currency) \
if cents else self._cents_terse(right, currency)

return u'%s%s %s%s %s %s' % (
minus_str,
self.to_cardinal(left),
money_str,
self.pluralize(left, cr1),
separator,
cents_str,
Expand Down
5 changes: 4 additions & 1 deletion num2words/lang_CZ.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ def to_cardinal(self, number):
n = str(number).replace(',', '.')
if '.' in n:
left, right = n.split('.')
leading_zero_count = len(right) - len(right.lstrip('0'))
decimal_part = ((ZERO[0] + ' ') * leading_zero_count +
self._int2word(int(right)))
return u'%s %s %s' % (
self._int2word(int(left)),
self.pointword,
self._int2word(int(right))
decimal_part
)
else:
return self._int2word(int(n))
Expand Down
Loading

0 comments on commit b3e717c

Please sign in to comment.