lang_EU.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from .base import Num2Word_Base
  4. GENERIC_DOLLARS = ('dollar', 'dollars')
  5. GENERIC_CENTS = ('cent', 'cents')
  6. class Num2Word_EU(Num2Word_Base):
  7. CURRENCY_FORMS = {
  8. 'AUD': (GENERIC_DOLLARS, GENERIC_CENTS),
  9. 'CAD': (GENERIC_DOLLARS, GENERIC_CENTS),
  10. # repalced by EUR
  11. 'EEK': (('kroon', 'kroons'), ('sent', 'senti')),
  12. 'EUR': (('euro', 'euro'), GENERIC_CENTS),
  13. 'GBP': (('pound sterling', 'pounds sterling'), ('penny', 'pence')),
  14. # replaced by EUR
  15. 'LTL': (('litas', 'litas'), GENERIC_CENTS),
  16. # replaced by EUR
  17. 'LVL': (('lat', 'lats'), ('santim', 'santims')),
  18. 'USD': (GENERIC_DOLLARS, GENERIC_CENTS),
  19. 'RUB': (('rouble', 'roubles'), ('kopek', 'kopeks')),
  20. 'SEK': (('krona', 'kronor'), ('öre', 'öre')),
  21. 'NOK': (('krone', 'kroner'), ('øre', 'øre')),
  22. 'PLN': (('zloty', 'zlotys', 'zlotu'), ('grosz', 'groszy')),
  23. 'MXN': (('peso', 'pesos'), GENERIC_CENTS),
  24. 'RON': (('leu', 'lei', 'de lei'), ('ban', 'bani', 'de bani')),
  25. 'INR': (('rupee', 'rupees'), ('paisa', 'paise')),
  26. 'HUF': (('forint', 'forint'), ('fillér', 'fillér'))
  27. }
  28. CURRENCY_ADJECTIVES = {
  29. 'AUD': 'Australian',
  30. 'CAD': 'Canadian',
  31. 'EEK': 'Estonian',
  32. 'USD': 'US',
  33. 'RUB': 'Russian',
  34. 'NOK': 'Norwegian',
  35. 'MXN': 'Mexican',
  36. 'RON': 'Romanian',
  37. 'INR': 'Indian',
  38. 'HUF': 'Hungarian'
  39. }
  40. GIGA_SUFFIX = "illiard"
  41. MEGA_SUFFIX = "illion"
  42. def set_high_numwords(self, high):
  43. cap = 3 + 6 * len(high)
  44. for word, n in zip(high, range(cap, 3, -6)):
  45. if self.GIGA_SUFFIX:
  46. self.cards[10 ** n] = word + self.GIGA_SUFFIX
  47. if self.MEGA_SUFFIX:
  48. self.cards[10 ** (n - 3)] = word + self.MEGA_SUFFIX
  49. def gen_high_numwords(self, units, tens, lows):
  50. out = [u + t for t in tens for u in units]
  51. out.reverse()
  52. return out + lows
  53. def pluralize(self, n, forms):
  54. form = 0 if n == 1 else 1
  55. return forms[form]
  56. def setup(self):
  57. lows = ["non", "oct", "sept", "sext", "quint", "quadr", "tr", "b", "m"]
  58. units = ["", "un", "duo", "tre", "quattuor", "quin", "sex", "sept",
  59. "octo", "novem"]
  60. tens = ["dec", "vigint", "trigint", "quadragint", "quinquagint",
  61. "sexagint", "septuagint", "octogint", "nonagint"]
  62. self.high_numwords = ["cent"] + self.gen_high_numwords(units, tens,
  63. lows)