How to use the num2words.lang_ES.Num2Word_ES function in num2words

To help you get started, we’ve selected a few num2words examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github savoirfairelinux / num2words / num2words / lang_ES.py View on Github external
def to_currency(self, val, currency='EUR', cents=True, separator=' con',
                    adjective=False):
        result = super(Num2Word_ES, self).to_currency(
            val, currency=currency, cents=cents, separator=separator,
            adjective=adjective)
        # Handle exception, in spanish is "un euro" and not "uno euro"
        return result.replace("uno", "un")
github savoirfairelinux / num2words / num2words / lang_ES_VE.py View on Github external
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA

from __future__ import print_function, unicode_literals

from .lang_ES import Num2Word_ES


class Num2Word_ES_VE(Num2Word_ES):

    def to_currency(self, val, longval=True, old=False):
        hightxt = "bolívar/es" if old else "bolívar/es fuerte/s"
        result = self.to_splitnum(
            val, hightxt=hightxt, lowtxt="centavo/s",
            divisor=1, jointxt="y", longval=longval
        )
        # Handle exception, in spanish is "un euro" and not "uno euro"
        return result.replace("uno", "un")
github savoirfairelinux / num2words / num2words / __init__.py View on Github external
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)

CONVERTER_CLASSES = {
    'ar': lang_AR.Num2Word_AR(),
    'cz': lang_CZ.Num2Word_CZ(),
    'en': lang_EN.Num2Word_EN(),
    'en_IN': lang_EN_IN.Num2Word_EN_IN(),
    'fr': lang_FR.Num2Word_FR(),
    'fr_CH': lang_FR_CH.Num2Word_FR_CH(),
    'fr_BE': lang_FR_BE.Num2Word_FR_BE(),
    'fr_DZ': lang_FR_DZ.Num2Word_FR_DZ(),
    'de': lang_DE.Num2Word_DE(),
    'fi': lang_FI.Num2Word_FI(),
    'es': lang_ES.Num2Word_ES(),
    'es_CO': lang_ES_CO.Num2Word_ES_CO(),
    'es_NI': lang_ES_NI.Num2Word_ES_NI(),
    'es_VE': lang_ES_VE.Num2Word_ES_VE(),
    'id': lang_ID.Num2Word_ID(),
    'ja': lang_JA.Num2Word_JA(),
    'kn': lang_KN.Num2Word_KN(),
    'ko': lang_KO.Num2Word_KO(),
    'kz': lang_KZ.Num2Word_KZ(),
    'lt': lang_LT.Num2Word_LT(),
    'lv': lang_LV.Num2Word_LV(),
    'pl': lang_PL.Num2Word_PL(),
    'ro': lang_RO.Num2Word_RO(),
    'ru': lang_RU.Num2Word_RU(),
    'sl': lang_SL.Num2Word_SL(),
    'sr': lang_SR.Num2Word_SR(),
    'no': lang_NO.Num2Word_NO(),
github savoirfairelinux / num2words / num2words / lang_ES_CO.py View on Github external
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA

from __future__ import print_function, unicode_literals

from .lang_ES import Num2Word_ES


class Num2Word_ES_CO(Num2Word_ES):

    def to_currency(self, val, longval=True, old=False):
        result = self.to_splitnum(val, hightxt="peso/s", lowtxt="centavo/s",
                                  divisor=1, jointxt="y", longval=longval)
        # Handle exception, in spanish is "un euro" and not "uno euro"
        return result.replace("uno", "un")