numbers_and_words 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +255 -164
- data/README.md +64 -44
- data/lib/numbers_and_words/cli.rb +3 -2
- data/lib/numbers_and_words/compatibility.rb +17 -18
- data/lib/numbers_and_words/config.rb +1 -1
- data/lib/numbers_and_words/fallback.rb +1 -1
- data/lib/numbers_and_words/helper_classes/array_extensions/helpers.rb +0 -59
- data/lib/numbers_and_words/helper_classes/figures_array.rb +0 -4
- data/lib/numbers_and_words/i18n/extends.rb +34 -0
- data/lib/numbers_and_words/i18n/initialization.rb +5 -1
- data/lib/numbers_and_words/i18n/invalidation.rb +38 -0
- data/lib/numbers_and_words/i18n/locales/numbers.af.yml +93 -0
- data/lib/numbers_and_words/i18n/locales/numbers.ar.yml +293 -11
- data/lib/numbers_and_words/i18n/locales/numbers.az.yml +87 -14
- data/lib/numbers_and_words/i18n/locales/numbers.be.yml +175 -0
- data/lib/numbers_and_words/i18n/locales/numbers.bg.yml +180 -65
- data/lib/numbers_and_words/i18n/locales/numbers.bn.yml +23 -1
- data/lib/numbers_and_words/i18n/locales/numbers.bs.yml +136 -0
- data/lib/numbers_and_words/i18n/locales/numbers.ca.yml +107 -0
- data/lib/numbers_and_words/i18n/locales/numbers.cs.yml +146 -18
- data/lib/numbers_and_words/i18n/locales/numbers.cy.yml +950 -0
- data/lib/numbers_and_words/i18n/locales/numbers.da.yml +118 -58
- data/lib/numbers_and_words/i18n/locales/numbers.de.yml +107 -0
- data/lib/numbers_and_words/i18n/locales/numbers.el.yml +156 -6
- data/lib/numbers_and_words/i18n/locales/numbers.en-GB.yml +10 -73
- data/lib/numbers_and_words/i18n/locales/numbers.en.yml +119 -3
- data/lib/numbers_and_words/i18n/locales/numbers.eo.yml +76 -0
- data/lib/numbers_and_words/i18n/locales/numbers.es.yml +180 -5
- data/lib/numbers_and_words/i18n/locales/numbers.et.yml +131 -13
- data/lib/numbers_and_words/i18n/locales/numbers.fa.yml +74 -0
- data/lib/numbers_and_words/i18n/locales/numbers.fi.yml +79 -3
- data/lib/numbers_and_words/i18n/locales/numbers.fil.yml +69 -0
- data/lib/numbers_and_words/i18n/locales/numbers.fr-CH.yml +16 -107
- data/lib/numbers_and_words/i18n/locales/numbers.fr.yml +141 -4
- data/lib/numbers_and_words/i18n/locales/numbers.ga.yml +374 -0
- data/lib/numbers_and_words/i18n/locales/numbers.he.yml +119 -3
- data/lib/numbers_and_words/i18n/locales/numbers.hi.yml +37 -6
- data/lib/numbers_and_words/i18n/locales/numbers.hr.yml +137 -0
- data/lib/numbers_and_words/i18n/locales/numbers.hu.yml +92 -2
- data/lib/numbers_and_words/i18n/locales/numbers.hy.yml +97 -6
- data/lib/numbers_and_words/i18n/locales/numbers.id.yml +45 -1
- data/lib/numbers_and_words/i18n/locales/numbers.is.yml +172 -0
- data/lib/numbers_and_words/i18n/locales/numbers.it.yml +232 -6
- data/lib/numbers_and_words/i18n/locales/numbers.ja.yml +81 -0
- data/lib/numbers_and_words/i18n/locales/numbers.ka.yml +120 -7
- data/lib/numbers_and_words/i18n/locales/numbers.kk.yml +90 -20
- data/lib/numbers_and_words/i18n/locales/numbers.km.yml +32 -0
- data/lib/numbers_and_words/i18n/locales/numbers.ko.yml +48 -0
- data/lib/numbers_and_words/i18n/locales/numbers.lo.yml +40 -0
- data/lib/numbers_and_words/i18n/locales/numbers.lt.yml +108 -50
- data/lib/numbers_and_words/i18n/locales/numbers.lv.yml +108 -49
- data/lib/numbers_and_words/i18n/locales/numbers.mk.yml +196 -0
- data/lib/numbers_and_words/i18n/locales/numbers.ms.yml +45 -1
- data/lib/numbers_and_words/i18n/locales/numbers.mt.yml +107 -0
- data/lib/numbers_and_words/i18n/locales/numbers.my.yml +45 -0
- data/lib/numbers_and_words/i18n/locales/numbers.nb.yml +153 -45
- data/lib/numbers_and_words/i18n/locales/numbers.nl.yml +164 -11
- data/lib/numbers_and_words/i18n/locales/numbers.pl.yml +269 -17
- data/lib/numbers_and_words/i18n/locales/numbers.pt-BR.yml +117 -13
- data/lib/numbers_and_words/i18n/locales/numbers.pt.yml +89 -5
- data/lib/numbers_and_words/i18n/locales/numbers.ro.yml +201 -29
- data/lib/numbers_and_words/i18n/locales/numbers.ru.yml +217 -291
- data/lib/numbers_and_words/i18n/locales/numbers.sk.yml +139 -11
- data/lib/numbers_and_words/i18n/locales/numbers.sl.yml +144 -0
- data/lib/numbers_and_words/i18n/locales/numbers.sq.yml +99 -0
- data/lib/numbers_and_words/i18n/locales/numbers.sr.yml +136 -0
- data/lib/numbers_and_words/i18n/locales/numbers.sv.yml +93 -28
- data/lib/numbers_and_words/i18n/locales/numbers.sw.yml +54 -0
- data/lib/numbers_and_words/i18n/locales/numbers.ta.yml +88 -0
- data/lib/numbers_and_words/i18n/locales/numbers.th.yml +29 -1
- data/lib/numbers_and_words/i18n/locales/numbers.tr.yml +89 -13
- data/lib/numbers_and_words/i18n/locales/numbers.uk.yml +220 -293
- data/lib/numbers_and_words/i18n/locales/numbers.ur.yml +39 -6
- data/lib/numbers_and_words/i18n/locales/numbers.vi.yml +53 -1
- data/lib/numbers_and_words/i18n/locales/numbers.zh.yml +30 -1
- data/lib/numbers_and_words/i18n/plural_rule.rb +62 -0
- data/lib/numbers_and_words/i18n/pluralization.rb +21 -5
- data/lib/numbers_and_words/i18n/plurals.rb +5 -0
- data/lib/numbers_and_words/i18n.rb +69 -3
- data/lib/numbers_and_words/options_validation.rb +33 -5
- data/lib/numbers_and_words/rules/keys.rb +58 -0
- data/lib/numbers_and_words/rules.rb +180 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/families/base.rb +18 -3
- data/lib/numbers_and_words/strategies/array_joiner/languages.rb +4 -34
- data/lib/numbers_and_words/strategies/figures_converter/decorators/az/fractional.rb +1 -23
- data/lib/numbers_and_words/strategies/figures_converter/decorators/base.rb +20 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/counted_fraction.rb +19 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/integral.rb +0 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/decimal_point.rb +5 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/{nb/fractional.rb → digits.rb} +4 -3
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/fractional.rb +0 -22
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fraction_noun.rb +31 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/fractional.rb +1 -23
- data/lib/numbers_and_words/strategies/figures_converter/decorators/it/fractional.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/decorators/kk/fractional.rb +22 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/{zh/fractional.rb → myriad.rb} +2 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/nl/fractional.rb +0 -22
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pl/fractional.rb +1 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/point_or_fraction.rb +22 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/{ro/fractional.rb → point_words.rb} +2 -7
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/integral.rb +0 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators.rb +54 -39
- data/lib/numbers_and_words/strategies/figures_converter/languages/ar.rb +5 -97
- data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +1 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +5 -64
- data/lib/numbers_and_words/strategies/figures_converter/languages/en.rb +12 -43
- data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +6 -95
- data/lib/numbers_and_words/strategies/figures_converter/languages/he.rb +14 -91
- data/lib/numbers_and_words/strategies/figures_converter/languages/ja.rb +11 -14
- data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +7 -40
- data/lib/numbers_and_words/strategies/figures_converter/languages/ko.rb +7 -15
- data/lib/numbers_and_words/strategies/figures_converter/languages/myriad.rb +9 -32
- data/lib/numbers_and_words/strategies/figures_converter/languages/nb.rb +4 -92
- data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +5 -64
- data/lib/numbers_and_words/strategies/figures_converter/languages/ordinals.rb +4 -108
- data/lib/numbers_and_words/strategies/figures_converter/languages/rule_sets/declarations.rb +82 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/rule_sets.rb +127 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/vi.rb +8 -85
- data/lib/numbers_and_words/strategies/figures_converter/languages/zh.rb +16 -32
- data/lib/numbers_and_words/strategies/figures_converter/languages.rb +8 -37
- data/lib/numbers_and_words/strategies/figures_converter/options/option.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/pl/gender.rb +1 -3
- data/lib/numbers_and_words/strategies/figures_converter/options.rb +30 -58
- data/lib/numbers_and_words/translations/base.rb +9 -1
- data/lib/numbers_and_words/translations/cs.rb +1 -35
- data/lib/numbers_and_words/translations/de.rb +1 -14
- data/lib/numbers_and_words/translations/el.rb +2 -25
- data/lib/numbers_and_words/translations/families/base.rb +19 -28
- data/lib/numbers_and_words/translations/he.rb +1 -22
- data/lib/numbers_and_words/translations/ja.rb +7 -38
- data/lib/numbers_and_words/translations/mk.rb +13 -0
- data/lib/numbers_and_words/translations/pt-BR.rb +3 -49
- data/lib/numbers_and_words/translations/pt.rb +1 -20
- data/lib/numbers_and_words/translations/ro.rb +2 -30
- data/lib/numbers_and_words/translations/sk.rb +0 -4
- data/lib/numbers_and_words/translations.rb +4 -37
- data/lib/numbers_and_words/unit/amount.rb +4 -4
- data/lib/numbers_and_words/unit/before_noun.rb +1 -1
- data/lib/numbers_and_words/unit/order.rb +14 -14
- data/lib/numbers_and_words/unit/scale_preposition.rb +6 -5
- data/lib/numbers_and_words/unit.rb +35 -25
- data/lib/numbers_and_words/version.rb +1 -1
- data/lib/numbers_and_words/wrappers/float.rb +4 -1
- data/lib/numbers_and_words/wrappers/sign.rb +2 -2
- data/lib/numbers_and_words.rb +1 -0
- metadata +40 -397
- data/lib/numbers_and_words/i18n/plurals/ar.rb +0 -26
- data/lib/numbers_and_words/i18n/plurals/cs.rb +0 -38
- data/lib/numbers_and_words/i18n/plurals/lt.rb +0 -30
- data/lib/numbers_and_words/i18n/plurals/lv.rb +0 -17
- data/lib/numbers_and_words/i18n/plurals/pl.rb +0 -18
- data/lib/numbers_and_words/i18n/plurals/plurals.rb +0 -11
- data/lib/numbers_and_words/i18n/plurals/ro.rb +0 -21
- data/lib/numbers_and_words/i18n/plurals/ru.rb +0 -38
- data/lib/numbers_and_words/i18n/plurals/sk.rb +0 -21
- data/lib/numbers_and_words/i18n/plurals/uk.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/az.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/bg.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/bn.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/cs.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/de.rb +0 -16
- data/lib/numbers_and_words/strategies/array_joiner/languages/decimal_point.rb +0 -23
- data/lib/numbers_and_words/strategies/array_joiner/languages/el.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/en-GB.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/en.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/es.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/families/indian.rb +0 -19
- data/lib/numbers_and_words/strategies/array_joiner/languages/fi.rb +0 -16
- data/lib/numbers_and_words/strategies/array_joiner/languages/fr-CH.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/fr.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/he.rb +0 -16
- data/lib/numbers_and_words/strategies/array_joiner/languages/hi.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/hu.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/id.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/it.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/ko.rb +0 -17
- data/lib/numbers_and_words/strategies/array_joiner/languages/ms.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/nb.rb +0 -16
- data/lib/numbers_and_words/strategies/array_joiner/languages/nl.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/pl.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/pt-BR.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/pt.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/ro.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/ru.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/sk.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/th.rb +0 -21
- data/lib/numbers_and_words/strategies/array_joiner/languages/uk.rb +0 -12
- data/lib/numbers_and_words/strategies/array_joiner/languages/ur.rb +0 -13
- data/lib/numbers_and_words/strategies/array_joiner/languages/vi.rb +0 -16
- data/lib/numbers_and_words/strategies/array_joiner/languages/zh.rb +0 -21
- data/lib/numbers_and_words/strategies/figures_converter/decorators/az/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/az/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/az.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/bg/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/bg/fractional.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/decorators/bg/integral.rb +0 -22
- data/lib/numbers_and_words/strategies/figures_converter/decorators/bg.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/bn/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/bn/fractional.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/bn/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/bn.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/fractional.rb +0 -40
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/de/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/de/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/de.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/el/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/el/fractional.rb +0 -27
- data/lib/numbers_and_words/strategies/figures_converter/decorators/el/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/el.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/fractional.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/fractional.rb +0 -40
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fi/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fi/fractional.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fi/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fi.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/fractional.rb +0 -43
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr-CH/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr-CH/fractional.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr-CH/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr-CH.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/he/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/he/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/he.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hi/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hi/fractional.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hi/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hi.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/id/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/id/fractional.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/decorators/id/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/id.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/indian.rb +0 -21
- data/lib/numbers_and_words/strategies/figures_converter/decorators/it/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/it/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/it.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ja/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ja/fractional.rb +0 -18
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ja/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ja.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ko/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ko/fractional.rb +0 -18
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ko/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ko.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ms/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ms/fractional.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ms/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ms.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/nb/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/nb/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/nb.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/nl/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/nl.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pl/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pl.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt/fractional.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/fractional.rb +0 -43
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ro/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ro/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ro.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/fractional.rb +0 -40
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/sk/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/sk/fractional.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/decorators/sk/integral.rb +0 -22
- data/lib/numbers_and_words/strategies/figures_converter/decorators/sk.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/th/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/th/fractional.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/decorators/th/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/th.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/uk/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/uk/fractional.rb +0 -40
- data/lib/numbers_and_words/strategies/figures_converter/decorators/uk/integral.rb +0 -30
- data/lib/numbers_and_words/strategies/figures_converter/decorators/uk.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ur/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ur/fractional.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ur/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ur.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/decorators/zh/base.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/zh/integral.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/decorators/zh.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/languages/az.rb +0 -41
- data/lib/numbers_and_words/strategies/figures_converter/languages/bg.rb +0 -130
- data/lib/numbers_and_words/strategies/figures_converter/languages/bn.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/languages/cases.rb +0 -64
- data/lib/numbers_and_words/strategies/figures_converter/languages/da.rb +0 -84
- data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +0 -103
- data/lib/numbers_and_words/strategies/figures_converter/languages/el.rb +0 -108
- data/lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/languages/et.rb +0 -57
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb +0 -79
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +0 -38
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb +0 -34
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/indian.rb +0 -75
- data/lib/numbers_and_words/strategies/figures_converter/languages/fi.rb +0 -113
- data/lib/numbers_and_words/strategies/figures_converter/languages/fr-CH.rb +0 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +0 -97
- data/lib/numbers_and_words/strategies/figures_converter/languages/hi.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +0 -93
- data/lib/numbers_and_words/strategies/figures_converter/languages/hy.rb +0 -35
- data/lib/numbers_and_words/strategies/figures_converter/languages/id.rb +0 -79
- data/lib/numbers_and_words/strategies/figures_converter/languages/it.rb +0 -144
- data/lib/numbers_and_words/strategies/figures_converter/languages/kk.rb +0 -27
- data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +0 -45
- data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +0 -39
- data/lib/numbers_and_words/strategies/figures_converter/languages/ms.rb +0 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/pl.rb +0 -39
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +0 -122
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt.rb +0 -130
- data/lib/numbers_and_words/strategies/figures_converter/languages/ro.rb +0 -117
- data/lib/numbers_and_words/strategies/figures_converter/languages/ru.rb +0 -29
- data/lib/numbers_and_words/strategies/figures_converter/languages/sk.rb +0 -144
- data/lib/numbers_and_words/strategies/figures_converter/languages/sv.rb +0 -67
- data/lib/numbers_and_words/strategies/figures_converter/languages/th.rb +0 -55
- data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +0 -36
- data/lib/numbers_and_words/strategies/figures_converter/languages/uk.rb +0 -29
- data/lib/numbers_and_words/strategies/figures_converter/languages/ur.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/options/ar/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ar.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/az/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/az/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/az.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/base/animate.rb +0 -30
- data/lib/numbers_and_words/strategies/figures_converter/options/base/fraction.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb +0 -30
- data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +0 -28
- data/lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb +0 -30
- data/lib/numbers_and_words/strategies/figures_converter/options/base.rb +0 -7
- data/lib/numbers_and_words/strategies/figures_converter/options/bg/gender.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/options/bg/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/bg/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/bg.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/bn/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/bn/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/bn.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/cs.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/da/gender.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/da/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/da.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/de/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/de/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/de.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/el/gender.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/options/el/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/el/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/el.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/en/fraction.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/en/hundreds_with_union.rb +0 -39
- data/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +0 -54
- data/lib/numbers_and_words/strategies/figures_converter/options/en/pronounced.rb +0 -70
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_hyphen.rb +0 -30
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/fraction.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/pronounced.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_hyphen.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb +0 -8
- data/lib/numbers_and_words/strategies/figures_converter/options/en.rb +0 -8
- data/lib/numbers_and_words/strategies/figures_converter/options/es/apocopated.rb +0 -30
- data/lib/numbers_and_words/strategies/figures_converter/options/es/gender.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/es/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/es/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/es.rb +0 -6
- data/lib/numbers_and_words/strategies/figures_converter/options/et/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/et.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/fi/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/fi/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/fi.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/fr/fraction.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/fr/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/fr/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/fr/spelling.rb +0 -25
- data/lib/numbers_and_words/strategies/figures_converter/options/fr-CH/fraction.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/fr-CH/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/fr-CH/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/fr-CH/spelling.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/fr-CH.rb +0 -6
- data/lib/numbers_and_words/strategies/figures_converter/options/fr.rb +0 -6
- data/lib/numbers_and_words/strategies/figures_converter/options/he/gender.rb +0 -20
- data/lib/numbers_and_words/strategies/figures_converter/options/he/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/he/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/he.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/hi/gender.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/options/hi/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/hi/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/hi.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/hu/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/hu.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/hy/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/hy.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/id/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/id/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/id.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/it/fraction.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/it/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/it/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/it.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/ja/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ja/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ja/script.rb +0 -25
- data/lib/numbers_and_words/strategies/figures_converter/options/ja.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/ka/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ka.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/kk/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/kk.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/ko/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ko/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ko.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/lt/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/lt.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/lv/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/lv.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/ms/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ms/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ms.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/nb/gender.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/options/nb/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/nb/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/nb.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/nl/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/nl/pronounced.rb +0 -26
- data/lib/numbers_and_words/strategies/figures_converter/options/nl/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/nl/tens_of_hundreds.rb +0 -30
- data/lib/numbers_and_words/strategies/figures_converter/options/nl.rb +0 -6
- data/lib/numbers_and_words/strategies/figures_converter/options/pl/ordinal.rb +0 -21
- data/lib/numbers_and_words/strategies/figures_converter/options/pl/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/pl.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/pt/fraction.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/pt/gender.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/pt/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/pt/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/fraction.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/gender.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR.rb +0 -6
- data/lib/numbers_and_words/strategies/figures_converter/options/pt.rb +0 -6
- data/lib/numbers_and_words/strategies/figures_converter/options/ro/gender.rb +0 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ro/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ro/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ro.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/animate.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/case.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/gender.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ru.rb +0 -7
- data/lib/numbers_and_words/strategies/figures_converter/options/sk/gender.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/options/sk/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/sk/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/sk.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/sv/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/sv.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/th/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/th/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/th.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/tr/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/tr.rb +0 -3
- data/lib/numbers_and_words/strategies/figures_converter/options/uk/animate.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/uk/case.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/options/uk/gender.rb +0 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/uk/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/uk/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/uk.rb +0 -7
- data/lib/numbers_and_words/strategies/figures_converter/options/ur/gender.rb +0 -16
- data/lib/numbers_and_words/strategies/figures_converter/options/ur/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ur/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/ur.rb +0 -5
- data/lib/numbers_and_words/strategies/figures_converter/options/vi/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/vi/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/vi.rb +0 -4
- data/lib/numbers_and_words/strategies/figures_converter/options/zh/ordinal.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/zh/remove_zero.rb +0 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/zh.rb +0 -4
- data/lib/numbers_and_words/translations/ar.rb +0 -32
- data/lib/numbers_and_words/translations/az.rb +0 -17
- data/lib/numbers_and_words/translations/bn.rb +0 -9
- data/lib/numbers_and_words/translations/da.rb +0 -37
- data/lib/numbers_and_words/translations/en-GB.rb +0 -10
- data/lib/numbers_and_words/translations/en.rb +0 -10
- data/lib/numbers_and_words/translations/es.rb +0 -38
- data/lib/numbers_and_words/translations/et.rb +0 -15
- data/lib/numbers_and_words/translations/families/cyrillic.rb +0 -27
- data/lib/numbers_and_words/translations/families/indian.rb +0 -28
- data/lib/numbers_and_words/translations/families/latin.rb +0 -23
- data/lib/numbers_and_words/translations/fi.rb +0 -12
- data/lib/numbers_and_words/translations/fr-CH.rb +0 -28
- data/lib/numbers_and_words/translations/fr.rb +0 -45
- data/lib/numbers_and_words/translations/hi.rb +0 -9
- data/lib/numbers_and_words/translations/hu.rb +0 -28
- data/lib/numbers_and_words/translations/hy.rb +0 -21
- data/lib/numbers_and_words/translations/id.rb +0 -23
- data/lib/numbers_and_words/translations/it.rb +0 -29
- data/lib/numbers_and_words/translations/ka.rb +0 -65
- data/lib/numbers_and_words/translations/kk.rb +0 -14
- data/lib/numbers_and_words/translations/ko.rb +0 -23
- data/lib/numbers_and_words/translations/lt.rb +0 -13
- data/lib/numbers_and_words/translations/lv.rb +0 -13
- data/lib/numbers_and_words/translations/ms.rb +0 -9
- data/lib/numbers_and_words/translations/nb.rb +0 -12
- data/lib/numbers_and_words/translations/nl.rb +0 -37
- data/lib/numbers_and_words/translations/ru.rb +0 -10
- data/lib/numbers_and_words/translations/sv.rb +0 -23
- data/lib/numbers_and_words/translations/th.rb +0 -23
- data/lib/numbers_and_words/translations/tr.rb +0 -17
- data/lib/numbers_and_words/translations/uk.rb +0 -10
- data/lib/numbers_and_words/translations/ur.rb +0 -9
- data/lib/numbers_and_words/translations/vi.rb +0 -25
- data/lib/numbers_and_words/translations/zh.rb +0 -19
data/README.md
CHANGED
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# numbers_and_words
|
|
4
4
|
|
|
5
|
-
[](https://badge.fury.io/rb/numbers_and_words)
|
|
6
|
-
[](https://github.com/kslazarev/numbers_and_words/actions/workflows/test.yml)
|
|
7
|
-
[](https://github.com/kslazarev/numbers_and_words/actions/workflows/lint.yml)
|
|
8
|
-
[](https://github.com/kslazarev/numbers_and_words/actions/workflows/package.yml)
|
|
9
|
-
[](https://coveralls.io/github/kslazarev/numbers_and_words?branch=master)
|
|
5
|
+
[](https://badge.fury.io/rb/numbers_and_words) [](https://github.com/kslazarev/numbers_and_words/actions/workflows/test.yml) [](https://github.com/kslazarev/numbers_and_words/actions/workflows/lint.yml) [](https://github.com/kslazarev/numbers_and_words/actions/workflows/package.yml) [](https://coveralls.io/github/kslazarev/numbers_and_words?branch=master)
|
|
10
6
|
|
|
11
7
|
Spell out numbers in several languages using the I18n gem.
|
|
12
8
|
|
|
@@ -24,7 +20,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
|
|
|
24
20
|
|
|
25
21
|
## Installation / Установка / Installation
|
|
26
22
|
|
|
27
|
-
```
|
|
23
|
+
```sh
|
|
28
24
|
gem install numbers_and_words
|
|
29
25
|
```
|
|
30
26
|
|
|
@@ -63,14 +59,14 @@ I18n.with_locale(:en) { 21.77.to_words }
|
|
|
63
59
|
# => "twenty-one and seventy-seven hundredths"
|
|
64
60
|
```
|
|
65
61
|
|
|
66
|
-
Floats
|
|
62
|
+
Floats in scientific notation, such as `0.00001` (`1.0e-05`), are read from their exact decimal value.
|
|
67
63
|
|
|
68
64
|
```ruby
|
|
69
65
|
I18n.with_locale(:en) { 0.00001.to_words }
|
|
70
66
|
# => "zero and one hundred-thousandth"
|
|
71
67
|
```
|
|
72
68
|
|
|
73
|
-
Negative numbers start with the
|
|
69
|
+
Negative numbers start with the word for minus. They have no ordinal: `ordinal: true` raises `NumbersAndWords::UnsupportedNumberError`, an `ArgumentError`. Numbers past a language's largest scale word raise `RangeError`. Each language page gives its limit.
|
|
74
70
|
|
|
75
71
|
```ruby
|
|
76
72
|
I18n.with_locale(:en) { -42.to_words }
|
|
@@ -82,9 +78,9 @@ I18n.with_locale(:fr) { -1.5.to_words }
|
|
|
82
78
|
|
|
83
79
|
### Command Line
|
|
84
80
|
|
|
85
|
-
The `to_words` command spells
|
|
81
|
+
The `to_words` command spells each argument, or each number on standard input, one per line.
|
|
86
82
|
|
|
87
|
-
```
|
|
83
|
+
```sh
|
|
88
84
|
$ to_words 42 1.5
|
|
89
85
|
forty-two
|
|
90
86
|
one and five tenths
|
|
@@ -99,27 +95,36 @@ $ to_words --locale es --gender female 21
|
|
|
99
95
|
veintiuna
|
|
100
96
|
```
|
|
101
97
|
|
|
102
|
-
Choose the language with `-l`/`--locale` (default `en`). Every
|
|
98
|
+
Choose the language with `-l`/`--locale` (default `en`). Every option has a flag, such as `--ordinal` (and `--no-ordinal`), `--gender VALUE` or `--precision N`. The `to_words --help` command lists the flags and the languages that support each. Errors go to standard error, with exit status 1.
|
|
103
99
|
|
|
104
|
-
## Supported Languages / Языки / Langues
|
|
100
|
+
## Supported Languages / Языки / Langues supportées
|
|
105
101
|
|
|
106
|
-
Each language page has examples, says whether
|
|
102
|
+
Each language page has examples, says whether it reads decimals, and documents its options. [Features](docs/features.md) compares the languages.
|
|
107
103
|
|
|
108
104
|
| Language | Name | Code |
|
|
109
105
|
| --- | --- | --- |
|
|
106
|
+
| [Afrikaans](docs/languages/af.md)* | Afrikaans | `af` |
|
|
107
|
+
| [Albanian](docs/languages/sq.md)* | Shqip | `sq` |
|
|
110
108
|
| [Arabic](docs/languages/ar.md)* | العربية | `ar` |
|
|
111
109
|
| [Armenian](docs/languages/hy.md) | Հայերեն | `hy` |
|
|
112
110
|
| [Azerbaijani](docs/languages/az.md)* | Azərbaycan dili | `az` |
|
|
111
|
+
| [Belarusian](docs/languages/be.md)* | Беларуская | `be` |
|
|
113
112
|
| [Bengali](docs/languages/bn.md)* | বাংলা | `bn` |
|
|
114
113
|
| [Brazilian Portuguese](docs/languages/pt-BR.md) | Português brasileiro | `pt-BR` |
|
|
115
114
|
| [British English](docs/languages/en-GB.md) | English (British) | `en-GB` |
|
|
115
|
+
| [Bosnian](docs/languages/bs.md)* | Bosanski | `bs` |
|
|
116
116
|
| [Bulgarian](docs/languages/bg.md)* | Български | `bg` |
|
|
117
|
+
| [Catalan](docs/languages/ca.md)* | Català | `ca` |
|
|
118
|
+
| [Burmese](docs/languages/my.md)* | မြန်မာဘာသာ | `my` |
|
|
117
119
|
| [Chinese](docs/languages/zh.md)* | 中文 | `zh` |
|
|
120
|
+
| [Croatian](docs/languages/hr.md)* | Hrvatski | `hr` |
|
|
118
121
|
| [Czech](docs/languages/cs.md) | Čeština | `cs` |
|
|
119
122
|
| [Danish](docs/languages/da.md) | Dansk | `da` |
|
|
120
123
|
| [Dutch](docs/languages/nl.md) | Nederlands | `nl` |
|
|
121
124
|
| [English](docs/languages/en.md) | English | `en` |
|
|
125
|
+
| [Esperanto](docs/languages/eo.md)* | Esperanto | `eo` |
|
|
122
126
|
| [Estonian](docs/languages/et.md) | Eesti | `et` |
|
|
127
|
+
| [Filipino](docs/languages/fil.md)* | Filipino | `fil` |
|
|
123
128
|
| [Finnish](docs/languages/fi.md)* | Suomi | `fi` |
|
|
124
129
|
| [French](docs/languages/fr.md) | Français | `fr` |
|
|
125
130
|
| [Georgian](docs/languages/ka.md) | ქართული | `ka` |
|
|
@@ -128,40 +133,52 @@ Each language page has examples, says whether decimals are supported, and docume
|
|
|
128
133
|
| [Hebrew](docs/languages/he.md)* | עברית | `he` |
|
|
129
134
|
| [Hindi](docs/languages/hi.md)* | हिन्दी | `hi` |
|
|
130
135
|
| [Hungarian](docs/languages/hu.md) | Magyar | `hu` |
|
|
136
|
+
| [Icelandic](docs/languages/is.md)* | Íslenska | `is` |
|
|
131
137
|
| [Indonesian](docs/languages/id.md) | Bahasa Indonesia | `id` |
|
|
138
|
+
| [Irish](docs/languages/ga.md)* | Gaeilge | `ga` |
|
|
132
139
|
| [Italian](docs/languages/it.md) | Italiano | `it` |
|
|
133
140
|
| [Japanese](docs/languages/ja.md)* | 日本語 | `ja` |
|
|
134
141
|
| [Kazakh](docs/languages/kk.md) | Қазақша | `kk` |
|
|
142
|
+
| [Khmer](docs/languages/km.md)* | ភាសាខ្មែរ | `km` |
|
|
135
143
|
| [Korean](docs/languages/ko.md)* | 한국어 | `ko` |
|
|
144
|
+
| [Lao](docs/languages/lo.md)* | ພາສາລາວ | `lo` |
|
|
136
145
|
| [Latvian](docs/languages/lv.md) | Latviešu | `lv` |
|
|
137
146
|
| [Lithuanian](docs/languages/lt.md) | Lietuvių | `lt` |
|
|
147
|
+
| [Macedonian](docs/languages/mk.md)* | Македонски | `mk` |
|
|
138
148
|
| [Malay](docs/languages/ms.md)* | Bahasa Melayu | `ms` |
|
|
149
|
+
| [Maltese](docs/languages/mt.md)* | Malti | `mt` |
|
|
139
150
|
| [Norwegian Bokmål](docs/languages/nb.md)* | Norsk bokmål | `nb` |
|
|
151
|
+
| [Persian](docs/languages/fa.md)* | فارسی | `fa` |
|
|
140
152
|
| [Polish](docs/languages/pl.md)* | Polski | `pl` |
|
|
141
153
|
| [Portuguese](docs/languages/pt.md) | Português | `pt` |
|
|
142
154
|
| [Romanian](docs/languages/ro.md)* | Română | `ro` |
|
|
143
155
|
| [Russian](docs/languages/ru.md) | Русский | `ru` |
|
|
156
|
+
| [Serbian](docs/languages/sr.md)* | Српски | `sr` |
|
|
144
157
|
| [Slovak](docs/languages/sk.md)* | Slovenčina | `sk` |
|
|
158
|
+
| [Slovenian](docs/languages/sl.md)* | Slovenščina | `sl` |
|
|
145
159
|
| [Spanish](docs/languages/es.md) | Español | `es` |
|
|
160
|
+
| [Swahili](docs/languages/sw.md)* | Kiswahili | `sw` |
|
|
146
161
|
| [Swedish](docs/languages/sv.md)* | Svenska | `sv` |
|
|
147
162
|
| [Swiss French](docs/languages/fr-CH.md) | Français (Suisse) | `fr-CH` |
|
|
163
|
+
| [Tamil](docs/languages/ta.md)* | தமிழ் | `ta` |
|
|
148
164
|
| [Thai](docs/languages/th.md)* | ภาษาไทย | `th` |
|
|
149
165
|
| [Turkish](docs/languages/tr.md) | Türkçe | `tr` |
|
|
150
166
|
| [Ukrainian](docs/languages/uk.md) | Українська | `uk` |
|
|
151
167
|
| [Urdu](docs/languages/ur.md)* | اردو | `ur` |
|
|
152
168
|
| [Vietnamese](docs/languages/vi.md) | Tiếng Việt | `vi` |
|
|
169
|
+
| [Welsh](docs/languages/cy.md)* | Cymraeg | `cy` |
|
|
153
170
|
|
|
154
|
-
\*
|
|
171
|
+
\* An asterisk marks an experimental language, which has known gaps or no native-speaker review yet, as its page explains. To help, see [#255](https://github.com/kslazarev/numbers_and_words/issues/255).
|
|
155
172
|
|
|
156
173
|
Regional locales use their language: `en-AU`, `en-CA`, `en-IN` and `en-US` use `en`; `fr-CA` uses `fr`; `de-AT` and `de-CH` use `de`; `it-CH` uses `it`; `nb-NO`, `no` and `no-NO` use `nb`; `zh-CN` and `zh-SG` use `zh`.
|
|
157
174
|
|
|
158
175
|
## Options / Опции / Options
|
|
159
176
|
|
|
160
|
-
|
|
177
|
+
Pass options to `to_words`. The options below work in every language. Language options, such as `gender`, `ordinal` or `remove_zero`, are on each language page.
|
|
161
178
|
|
|
162
179
|
### Precision
|
|
163
180
|
|
|
164
|
-
`precision` pads the fractional part of a float with zeros.
|
|
181
|
+
The `precision` option pads the fractional part of a float with zeros.
|
|
165
182
|
|
|
166
183
|
```ruby
|
|
167
184
|
I18n.with_locale(:ru) { 0.1.to_words(precision: 3) }
|
|
@@ -173,16 +190,16 @@ I18n.with_locale(:es) { 0.2.to_words(precision: 2) }
|
|
|
173
190
|
|
|
174
191
|
### Micro Separator
|
|
175
192
|
|
|
176
|
-
`micro_separator` replaces the word between the integral and fractional parts of a float.
|
|
193
|
+
The `micro_separator` option replaces the word between the integral and fractional parts of a float.
|
|
177
194
|
|
|
178
195
|
```ruby
|
|
179
|
-
I18n.with_locale(:en) { 21.77.to_words(micro_separator:
|
|
196
|
+
I18n.with_locale(:en) { 21.77.to_words(micro_separator: 'plus') }
|
|
180
197
|
# => "twenty-one plus seventy-seven hundredths"
|
|
181
198
|
```
|
|
182
199
|
|
|
183
200
|
### Fallback
|
|
184
201
|
|
|
185
|
-
|
|
202
|
+
A locale with no bundled rules, or one the configuration disables, raises `NumbersAndWords::UnsupportedLanguageError`. Set `fallback` to a bundled locale to convert in that locale instead, or to `true` to return the digits.
|
|
186
203
|
|
|
187
204
|
```ruby
|
|
188
205
|
I18n.with_locale(:am) { 42.to_words(fallback: :fr) }
|
|
@@ -192,11 +209,11 @@ I18n.with_locale(:am) { 42.to_words(fallback: true) }
|
|
|
192
209
|
# => "42"
|
|
193
210
|
```
|
|
194
211
|
|
|
195
|
-
Other options are validated for the fallback locale.
|
|
212
|
+
Other options are validated for the fallback locale. A locale missing from `I18n.available_locales` never reaches the gem: `I18n.with_locale` raises `I18n::InvalidLocale` first. To set a fallback for every call, see [Configuration](#configuration--конфигурация).
|
|
196
213
|
|
|
197
214
|
### Unit
|
|
198
215
|
|
|
199
|
-
`unit` follows a number with a unit word, such as a currency, in the form the number
|
|
216
|
+
The `unit` option follows a number with a unit word, such as a currency, in the form the number calls for. The gem ships no units: `unit: :ruble` looks up `units.ruble` in your application's translations, and `"money.ruble"` looks up `units.money.ruble`. A unit has one form per plural category of the language, such as `one`, `few`, `many` and `other` in Russian and Ukrainian, or `one` and `other` in English. A unit that never changes is one string. An optional `gender` sets the number's gender in languages with a `gender` option. A `gender` passed to `to_words` overrides it.
|
|
200
217
|
|
|
201
218
|
```yaml
|
|
202
219
|
en:
|
|
@@ -249,7 +266,7 @@ I18n.with_locale(:zh) { 21.to_words(unit: :yuan) }
|
|
|
249
266
|
# => "二十一元"
|
|
250
267
|
```
|
|
251
268
|
|
|
252
|
-
The unit follows the number after a space, or
|
|
269
|
+
The unit follows the number after a space, or with no space in Chinese, Japanese and Thai. Hebrew and Arabic put one after its unit, and Arabic says two with the dual form alone, as their pages describe. Before a unit, a number takes the form it has before a noun, listed under `numbers.before_unit` in the locale file. Examples are German "ein Euro" and "eine Mark", Swedish "en krona", Italian "un euro", Romanian "un leu" and "o liră", Hungarian "két forint" and Spanish "un euro" (see `apocopated` on its page). The unit's `gender` picks between these forms. With `ordinal: true` the unit is singular, since an ordinal names one item: the twenty-first dollar. Decimals keep their cardinal form.
|
|
253
270
|
|
|
254
271
|
```ruby
|
|
255
272
|
I18n.with_locale(:en) { 21.to_words(unit: :dollar, ordinal: true) }
|
|
@@ -259,16 +276,16 @@ I18n.with_locale(:ru) { 22.to_words(unit: :kopeck, ordinal: true) }
|
|
|
259
276
|
# => "двадцать вторая копейка"
|
|
260
277
|
```
|
|
261
278
|
|
|
262
|
-
A unit without a translation, or
|
|
279
|
+
A unit without a translation, or missing both the form a number needs and the `other` form, raises `NumbersAndWords::UnsupportedOptionError`, such as `The unit :euro has no translation in :ru, expected at units.euro.`. Unit forms are nominative, so `unit` with another `case` raises too.
|
|
263
280
|
|
|
264
|
-
In Spanish, French, Italian and Portuguese, a whole number that ends in a scale word of a million or more takes
|
|
281
|
+
In Spanish, French, Italian and Portuguese, a whole number that ends in a scale word of a million or more takes `de` (Italian `di`) before the unit. One that ends in another word, such as `mil`, doesn't. French shortens `de` to `d'` before a vowel. A unit sets `elision: true` for a mute h (`d'hectares`), or `elision: false` for another exception. Romanian puts `de` in the unit forms, as it does for any number from 20.
|
|
265
282
|
|
|
266
283
|
```ruby
|
|
267
284
|
I18n.with_locale(:fr) { 2_000_000.to_words(unit: :euro) }
|
|
268
285
|
# => "deux millions d'euros"
|
|
269
286
|
```
|
|
270
287
|
|
|
271
|
-
After a decimal, the unit takes its `other` form, which is the genitive singular in Russian and Czech
|
|
288
|
+
After a decimal, the unit takes its `other` form, which is the genitive singular in Russian and Czech. French and Portuguese use the singular below 2, and Romanian uses the `few` form. A float with no fractional part reads as a whole number.
|
|
272
289
|
|
|
273
290
|
```ruby
|
|
274
291
|
I18n.with_locale(:en) { 1.5.to_words(unit: :dollar) }
|
|
@@ -281,7 +298,7 @@ I18n.with_locale(:fr) { 1.5.to_words(unit: :euro) }
|
|
|
281
298
|
# => "un virgule cinq euro"
|
|
282
299
|
```
|
|
283
300
|
|
|
284
|
-
`subunit` spells an amount in two units, such as dollars and cents
|
|
301
|
+
The `subunit` option spells an amount in two units, such as dollars and cents. The decimal places, rounded half to even, become the subunit. The `precision` option sets how many places make one subunit, 2 by default. A zero subunit is left out unless `zero_subunit: true`. A zero unit is left out with `remove_zero: true`, where the language supports it. The two parts are joined with the language's word (`and` in English, `et` in French), attached to the subunit in Hebrew and Arabic (`ו`, `و`), or else with a space.
|
|
285
302
|
|
|
286
303
|
```ruby
|
|
287
304
|
I18n.with_locale(:en) { 21.5.to_words(unit: :dollar, subunit: :cent) }
|
|
@@ -300,65 +317,68 @@ I18n.with_locale(:en) { 0.5.to_words(unit: :dollar, subunit: :cent, remove_zero:
|
|
|
300
317
|
# => "fifty cents"
|
|
301
318
|
```
|
|
302
319
|
|
|
303
|
-
`subunit` without `unit`,
|
|
320
|
+
Passing `subunit` without `unit`, `subunit` with `ordinal: true`, or `zero_subunit` without `subunit` raises `NumbersAndWords::UnsupportedOptionError`.
|
|
304
321
|
|
|
305
322
|
### Unsupported Options
|
|
306
323
|
|
|
307
|
-
Every language accepts `precision`, `micro_separator`, `fallback`, `unit`, `subunit` and `zero_subunit`, plus the options on its
|
|
324
|
+
Every language accepts `precision`, `micro_separator`, `fallback`, `unit`, `subunit` and `zero_subunit`, plus the options on its page. Any other option or value is ignored with a warning that lists the supported ones. Version 2.0 will raise `NumbersAndWords::UnsupportedOptionError`, an `ArgumentError`, instead. Set [`strict_options`](#configuration--конфигурация) to `true` to raise now.
|
|
308
325
|
|
|
309
326
|
Vietnamese has no grammatical gender, so `21.to_words(gender: :female)` in `vi` returns "hai mươi mốt" and warns once:
|
|
310
327
|
|
|
311
|
-
```
|
|
312
|
-
numbers_and_words:
|
|
328
|
+
```text
|
|
329
|
+
numbers_and_words: The option :gender is not supported in :vi; supported: :micro_separator, :ordinal, :precision, :remove_zero, :subunit, :unit, :zero_subunit. It is ignored; set NumbersAndWords.config.strict_options = true to raise, the default in 2.0.
|
|
313
330
|
```
|
|
314
331
|
|
|
315
332
|
### Deprecations
|
|
316
333
|
|
|
317
|
-
|
|
334
|
+
Three defaults change in 2.0: `fraction: true` in English, French, Italian and Portuguese, `spelling: :traditional` in French, and `hundreds_with_union: false` in British English. Pass the option to choose. The locale codes `se`, `ua` and `kz` are deprecated; use `sv`, `uk` and `kk`. Each deprecation warns once per process. Warnings about defaults are Ruby deprecation warnings, shown only with `Warning[:deprecated] = true` or `ruby -W:deprecated`. See [UPGRADING](UPGRADING.md).
|
|
318
335
|
|
|
319
336
|
## Configuration / Конфигурация
|
|
320
337
|
|
|
321
|
-
All bundled locales
|
|
338
|
+
All bundled locales load by default. To load only some, configure the gem after requiring it:
|
|
322
339
|
|
|
323
340
|
```ruby
|
|
324
341
|
NumbersAndWords.configure do |config|
|
|
325
|
-
config.locales = [
|
|
342
|
+
config.locales = %i[en ru]
|
|
326
343
|
end
|
|
327
344
|
```
|
|
328
345
|
|
|
329
346
|
Or set it directly:
|
|
330
347
|
|
|
331
348
|
```ruby
|
|
332
|
-
NumbersAndWords.config.locales = [
|
|
349
|
+
NumbersAndWords.config.locales = %i[en ru]
|
|
333
350
|
```
|
|
334
351
|
|
|
335
|
-
Regional locales such as `"en-US"`
|
|
352
|
+
Regional locales such as `"en-US"` become their bundled locale. Setting `nil` restores all bundled locales and `[]` loads none. An unsupported locale raises `ArgumentError` and changes nothing. An assignment takes effect at once. A `configure` block takes effect when it completes, and not at all if it raises.
|
|
336
353
|
|
|
337
|
-
`fallback`
|
|
354
|
+
The `fallback` setting chooses the default [fallback](#fallback); the `fallback` option of `to_words` overrides it.
|
|
338
355
|
|
|
339
356
|
```ruby
|
|
340
357
|
NumbersAndWords.config.fallback = :en
|
|
341
358
|
```
|
|
342
359
|
|
|
343
|
-
`strict_options`
|
|
360
|
+
The `strict_options` setting is `false` by default: an unsupported option or value is ignored with a warning. Set it to `true` to raise `NumbersAndWords::UnsupportedOptionError`, as 2.0 will by default.
|
|
344
361
|
|
|
345
362
|
```ruby
|
|
346
363
|
NumbersAndWords.config.strict_options = true
|
|
347
364
|
```
|
|
348
365
|
|
|
366
|
+
Configuration only changes this gem's locale files in `I18n.load_path` and its plural rules. It keeps application translations and an assigned `I18n.available_locales`. Converting in a disabled locale raises `NumbersAndWords::UnsupportedLanguageError` (`Language not configured`) unless a fallback is set.
|
|
367
|
+
|
|
368
|
+
Require the gem before looking up translations, as Rails does, and configure it during initialization. Configuring reloads the I18n backend, as assigning `I18n.load_path` does, so store runtime-only translations afterwards. Configuring again doesn't duplicate load paths. The gem never changes `I18n.locale` or `I18n.default_locale`, so don't disable their locales.
|
|
349
369
|
|
|
350
|
-
|
|
370
|
+
## Requirements / Требования / Configuration requise
|
|
351
371
|
|
|
352
|
-
|
|
372
|
+
* The gem requires Ruby 3.1 or later, including JRuby.
|
|
373
|
+
* The gem requires I18n and is tested with 1.6 and later.
|
|
353
374
|
|
|
354
|
-
##
|
|
375
|
+
## Users / Пользователи / Utilisateurs
|
|
355
376
|
|
|
356
|
-
|
|
357
|
-
* I18n, tested with 1.6 and later.
|
|
377
|
+
See [Users](docs/users.md) for applications and gems that use numbers_and_words.
|
|
358
378
|
|
|
359
379
|
## Upgrading / Обновление / Mise à jour
|
|
360
380
|
|
|
361
|
-
See [UPGRADING](UPGRADING.md) for changes in behavior
|
|
381
|
+
See [UPGRADING](UPGRADING.md) for changes in behavior and what 2.0 will change.
|
|
362
382
|
|
|
363
383
|
## Contributing / Участие / Contribuer
|
|
364
384
|
|
|
@@ -366,4 +386,4 @@ See [CONTRIBUTING](CONTRIBUTING.md), [AGENTS](AGENTS.md), [CHANGELOG](CHANGELOG.
|
|
|
366
386
|
|
|
367
387
|
## License / Лицензия / Licence
|
|
368
388
|
|
|
369
|
-
MIT License, see [LICENSE](LICENSE.txt).
|
|
389
|
+
The gem is released under the MIT License, see [LICENSE](LICENSE.txt).
|
|
@@ -26,6 +26,7 @@ module NumbersAndWords
|
|
|
26
26
|
tens_of_hundreds: 'Read thousands as tens of hundreds',
|
|
27
27
|
subunit: 'Spell the decimal places as a second unit, e.g. cents, under units.VALUE',
|
|
28
28
|
unit: 'Append a unit translated by the application under units.VALUE',
|
|
29
|
+
vigesimal: 'Count in twenties, e.g. Welsh "un ar hugain"',
|
|
29
30
|
zero_subunit: 'Spell a zero subunit, e.g. "zero cents"'
|
|
30
31
|
}.freeze
|
|
31
32
|
|
|
@@ -88,7 +89,7 @@ module NumbersAndWords
|
|
|
88
89
|
|
|
89
90
|
def read_numbers(arguments)
|
|
90
91
|
numbers = arguments.empty? ? @stdin.read.split : arguments
|
|
91
|
-
raise Error, '
|
|
92
|
+
raise Error, 'No numbers given.' if numbers.empty?
|
|
92
93
|
|
|
93
94
|
numbers.map { |number| parse_number(number) }
|
|
94
95
|
end
|
|
@@ -121,7 +122,7 @@ module NumbersAndWords
|
|
|
121
122
|
return Integer(text, 10) if /\A[+-]?\d+\z/.match?(text)
|
|
122
123
|
return Float(text) if /\A[+-]?\d+\.\d+\z/.match?(text)
|
|
123
124
|
|
|
124
|
-
raise Error, "
|
|
125
|
+
raise Error, "Not a number: #{text.inspect}."
|
|
125
126
|
end
|
|
126
127
|
end
|
|
127
128
|
end
|
|
@@ -3,19 +3,6 @@
|
|
|
3
3
|
module NumbersAndWords
|
|
4
4
|
# Keeps the 1.0 behavior that 2.0 will change, and warns once about each difference.
|
|
5
5
|
module Compatibility
|
|
6
|
-
# Defaults that change in 2.0, by language: option => [1.x default, 2.0 default].
|
|
7
|
-
DECIMALS = { fraction: [true, false] }.freeze
|
|
8
|
-
FRENCH = { fraction: [true, false], spelling: %i[traditional reformed] }.freeze
|
|
9
|
-
DEFAULTS = {
|
|
10
|
-
en: DECIMALS,
|
|
11
|
-
'en-GB': { hundreds_with_union: [false, true] }.freeze,
|
|
12
|
-
fr: FRENCH,
|
|
13
|
-
'fr-CH': FRENCH,
|
|
14
|
-
it: DECIMALS,
|
|
15
|
-
pt: DECIMALS,
|
|
16
|
-
'pt-BR': DECIMALS
|
|
17
|
-
}.freeze
|
|
18
|
-
|
|
19
6
|
# Locale codes that 2.0 will reject: se is Northern Sami, and ua and kz are country codes.
|
|
20
7
|
LOCALES = { se: :sv, ua: :uk, kz: :kk }.freeze
|
|
21
8
|
|
|
@@ -37,12 +24,24 @@ module NumbersAndWords
|
|
|
37
24
|
def defaults(options, number)
|
|
38
25
|
return options unless Compatibility.apply_defaults
|
|
39
26
|
|
|
40
|
-
|
|
27
|
+
legacy_defaults(I18n.local_language).each_with_object(options.dup) do |(name, (legacy, upcoming)), result|
|
|
41
28
|
next if set?(options, name) || skip?(name, number, options)
|
|
42
29
|
|
|
43
30
|
result[name] = legacy
|
|
44
|
-
deprecated "
|
|
45
|
-
"pass #{name}: to choose"
|
|
31
|
+
deprecated "The default #{name}: #{legacy.inspect} for #{I18n.local_language.inspect} changes to #{name}: #{upcoming.inspect} in 2.0; " \
|
|
32
|
+
"pass #{name}: to choose."
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# The defaults of a language that change in 2.0, as option => [1.x default, 2.0 default], from the options
|
|
37
|
+
# under numbers.supported_options with a legacy_default, such as fraction: {default: false, legacy_default: true}.
|
|
38
|
+
def legacy_defaults(language)
|
|
39
|
+
I18n.cached(:legacy_defaults, language) do
|
|
40
|
+
OptionsValidation.declared_options(language).each_with_object({}) do |(name, declared), defaults|
|
|
41
|
+
next unless declared.is_a?(::Hash) && declared.key?(:legacy_default)
|
|
42
|
+
|
|
43
|
+
defaults[name] = [declared[:legacy_default], declared[:default]].map { |value| value.is_a?(::String) ? value.to_sym : value }
|
|
44
|
+
end.freeze
|
|
46
45
|
end
|
|
47
46
|
end
|
|
48
47
|
|
|
@@ -51,7 +50,7 @@ module NumbersAndWords
|
|
|
51
50
|
language = LOCALES[code]
|
|
52
51
|
return unless language
|
|
53
52
|
|
|
54
|
-
warn_once "locale #{code.inspect} is deprecated and raises NumbersAndWords::UnsupportedLanguageError in 2.0; use #{language.inspect}"
|
|
53
|
+
warn_once "The locale #{code.inspect} is deprecated and raises NumbersAndWords::UnsupportedLanguageError in 2.0; use #{language.inspect}."
|
|
55
54
|
language
|
|
56
55
|
end
|
|
57
56
|
|
|
@@ -60,7 +59,7 @@ module NumbersAndWords
|
|
|
60
59
|
def unsupported_option(message)
|
|
61
60
|
raise UnsupportedOptionError, message if NumbersAndWords.config.strict_options
|
|
62
61
|
|
|
63
|
-
warn_once "#{message}
|
|
62
|
+
warn_once "#{message} It is ignored; set NumbersAndWords.config.strict_options = true to raise, the default in 2.0."
|
|
64
63
|
end
|
|
65
64
|
|
|
66
65
|
def set?(options, name)
|
|
@@ -31,7 +31,7 @@ module NumbersAndWords
|
|
|
31
31
|
# What to_words does with an option or value the current language does not support: false (the default
|
|
32
32
|
# until 2.0) ignores it with a warning, and true raises NumbersAndWords::UnsupportedOptionError.
|
|
33
33
|
def strict_options=(strict)
|
|
34
|
-
raise ArgumentError, "strict_options must be true or false, not #{strict.inspect}" unless [true, false].include?(strict)
|
|
34
|
+
raise ArgumentError, "The strict_options setting must be true or false, not #{strict.inspect}." unless [true, false].include?(strict)
|
|
35
35
|
|
|
36
36
|
@strict_options = strict
|
|
37
37
|
end
|
|
@@ -40,7 +40,7 @@ module NumbersAndWords
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def unsupported(fallback)
|
|
43
|
-
"
|
|
43
|
+
"The fallback #{fallback.inspect} is not supported; supported: true, false, nil or a bundled locale."
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -5,7 +5,6 @@ module NumbersAndWords
|
|
|
5
5
|
module Helpers
|
|
6
6
|
MICRO_CAPACITY_SHIFT = 2
|
|
7
7
|
FIGURES_IN_CAPACITY = 3
|
|
8
|
-
THOUSAND_CAPACITY = 1
|
|
9
8
|
ONES_SHIFT = 1
|
|
10
9
|
|
|
11
10
|
def capacity_length
|
|
@@ -17,55 +16,6 @@ module NumbersAndWords
|
|
|
17
16
|
count.zero? ? nil : count
|
|
18
17
|
end
|
|
19
18
|
|
|
20
|
-
def figures_array_in_capacity(capacity)
|
|
21
|
-
self[capacity * FIGURES_IN_CAPACITY, FIGURES_IN_CAPACITY]
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def number_in_capacity(capacity)
|
|
25
|
-
figures_array_in_capacity(capacity).reverse.join.to_i
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def number_under_capacity(capacity)
|
|
29
|
-
figures_array_under_capacity(capacity).reverse.join.to_i
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def opaque?(capacity)
|
|
33
|
-
figures_under = figures_array_under_capacity(capacity)
|
|
34
|
-
figures_under.count(0) == figures_under.length
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def figures_array_under_capacity(capacity)
|
|
38
|
-
self[0..((capacity * FIGURES_IN_CAPACITY) - ONES_SHIFT)]
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def ones
|
|
42
|
-
self[0].to_i if self[0].to_i.positive?
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def only_ones
|
|
46
|
-
ones if !tens && !hundreds
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def teens
|
|
50
|
-
tens_with_ones if tens == 1
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def tens
|
|
54
|
-
self[1].to_i if self[1].to_i.positive?
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def tens_with_ones
|
|
58
|
-
[ones, tens] if ones && tens
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def hundreds
|
|
62
|
-
self[2].to_i if self[2].to_i.positive?
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def round_hundred?
|
|
66
|
-
ones.nil? && tens.nil?
|
|
67
|
-
end
|
|
68
|
-
|
|
69
19
|
def sub_capacity
|
|
70
20
|
capacity_length % FIGURES_IN_CAPACITY
|
|
71
21
|
end
|
|
@@ -81,15 +31,6 @@ module NumbersAndWords
|
|
|
81
31
|
def fraction_sub_capacity
|
|
82
32
|
sub_capacity unless capacity_count.nil?
|
|
83
33
|
end
|
|
84
|
-
|
|
85
|
-
def ordinal_index
|
|
86
|
-
index(&:positive?)
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def ordinal_capacity
|
|
90
|
-
count = ordinal_index / FIGURES_IN_CAPACITY
|
|
91
|
-
count.zero? ? nil : count
|
|
92
|
-
end
|
|
93
34
|
end
|
|
94
35
|
end
|
|
95
36
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NumbersAndWords
|
|
4
|
+
module I18n
|
|
5
|
+
# A locale whose numbers name another with extends: (British English extends English) takes that locale's
|
|
6
|
+
# numbers with its own on top when I18n's Simple backend loads translations; a key set to ~ drops the other's.
|
|
7
|
+
module Extends
|
|
8
|
+
def load_translations(...)
|
|
9
|
+
super.tap { Extends.apply(translations) }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Merges again on every load: the locale's own keys, including those set to ~, always win.
|
|
13
|
+
def self.apply(translations)
|
|
14
|
+
translations.each_value do |data|
|
|
15
|
+
parent = data.is_a?(Hash) && data[:numbers].is_a?(Hash) && data[:numbers][:extends]
|
|
16
|
+
next unless parent
|
|
17
|
+
|
|
18
|
+
data[:numbers] = merge(translations.dig(parent.to_sym, :numbers) || {}, data[:numbers])
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.merge(base, own)
|
|
23
|
+
base.merge(own) { |_key, from, to| from.is_a?(Hash) && to.is_a?(Hash) ? merge(from, to) : to }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# The locale a bundled file extends, or nil.
|
|
27
|
+
def self.parent(file)
|
|
28
|
+
File.foreach(file).lazy.map { |line| line[/\A extends: (\S+)/, 1] }.find(&:itself)&.to_sym
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
I18n::Backend::Simple.prepend(NumbersAndWords::I18n::Extends)
|
|
@@ -21,7 +21,11 @@ module NumbersAndWords
|
|
|
21
21
|
# The gem's locale files for the given languages, or all of them for nil, with the codes used for them before 1.1.0.
|
|
22
22
|
def locale_files(locales)
|
|
23
23
|
files = I18n.locale_files
|
|
24
|
-
|
|
24
|
+
return files + legacy_files(locales) if locales.nil?
|
|
25
|
+
|
|
26
|
+
selected = files.select { |file| locales.include?(I18n.language_of(file)) }
|
|
27
|
+
parents = selected.filter_map { |file| Extends.parent(file) }
|
|
28
|
+
(files.select { |file| parents.include?(I18n.language_of(file)) } | selected) + legacy_files(locales)
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
# Registers se, ua and kz with I18n while their language is loaded; see Compatibility::LOCALES.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'concurrent/map'
|
|
4
|
+
|
|
5
|
+
module NumbersAndWords
|
|
6
|
+
module I18n
|
|
7
|
+
# Keeps the caches of NumbersAndWords::I18n.cached on I18n's Simple backend, and drops them with the compiled rule
|
|
8
|
+
# sets and the supported options when the backend reloads or stores translations, which may change
|
|
9
|
+
# numbers.rules, numbers.supported_options or the words in place.
|
|
10
|
+
module Invalidation
|
|
11
|
+
def store_translations(...)
|
|
12
|
+
super.tap { clear_numbers_and_words }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def reload!(...)
|
|
16
|
+
super.tap { clear_numbers_and_words }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# A cache of NumbersAndWords::I18n.cached, by name.
|
|
20
|
+
def numbers_and_words_cache(name)
|
|
21
|
+
caches = (@numbers_and_words_caches ||= Concurrent::Map.new)
|
|
22
|
+
caches[name] || caches.compute_if_absent(name) { Concurrent::Map.new }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def clear_numbers_and_words
|
|
26
|
+
@numbers_and_words_caches = nil
|
|
27
|
+
Invalidation.clear
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.clear
|
|
31
|
+
Rules.clear
|
|
32
|
+
OptionsValidation.clear
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
I18n::Backend::Simple.prepend(NumbersAndWords::I18n::Invalidation)
|