num2words 0.1.5 → 0.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -0
  3. data/Gemfile +0 -1
  4. data/README.md +57 -16
  5. data/bin/console +2 -14
  6. data/config/locales/ar.yml +176 -17
  7. data/config/locales/be.yml +182 -15
  8. data/config/locales/bg.yml +183 -16
  9. data/config/locales/bn.yml +185 -12
  10. data/config/locales/cs.yml +180 -13
  11. data/config/locales/da.yml +182 -15
  12. data/config/locales/de.yml +181 -14
  13. data/config/locales/el.yml +183 -21
  14. data/config/locales/en.yml +129 -12
  15. data/config/locales/es.yml +180 -13
  16. data/config/locales/et.yml +185 -13
  17. data/config/locales/fa.yml +179 -12
  18. data/config/locales/fi.yml +180 -8
  19. data/config/locales/fr.yml +180 -13
  20. data/config/locales/gu.yml +182 -10
  21. data/config/locales/he.yml +182 -20
  22. data/config/locales/hi.yml +182 -15
  23. data/config/locales/hr.yml +181 -14
  24. data/config/locales/hu.yml +180 -13
  25. data/config/locales/id.yml +179 -12
  26. data/config/locales/it.yml +181 -14
  27. data/config/locales/ja.yml +188 -21
  28. data/config/locales/ru.yml +135 -9
  29. data/exe/num2words-console +7 -0
  30. data/lib/num2words/config.rb +62 -0
  31. data/lib/num2words/console.rb +16 -0
  32. data/lib/num2words/converter.rb +94 -47
  33. data/lib/num2words/locales/ar.rb +10 -2
  34. data/lib/num2words/locales/be.rb +10 -2
  35. data/lib/num2words/locales/bg.rb +10 -2
  36. data/lib/num2words/locales/bn.rb +10 -2
  37. data/lib/num2words/locales/cs.rb +10 -2
  38. data/lib/num2words/locales/da.rb +10 -2
  39. data/lib/num2words/locales/de.rb +10 -2
  40. data/lib/num2words/locales/el.rb +10 -2
  41. data/lib/num2words/locales/en.rb +0 -3
  42. data/lib/num2words/locales/es.rb +10 -2
  43. data/lib/num2words/locales/et.rb +10 -2
  44. data/lib/num2words/locales/fa.rb +10 -2
  45. data/lib/num2words/locales/fi.rb +10 -2
  46. data/lib/num2words/locales/fr.rb +10 -2
  47. data/lib/num2words/locales/gu.rb +10 -2
  48. data/lib/num2words/locales/he.rb +10 -2
  49. data/lib/num2words/locales/hi.rb +10 -2
  50. data/lib/num2words/locales/hr.rb +10 -2
  51. data/lib/num2words/locales/hu.rb +10 -2
  52. data/lib/num2words/locales/id.rb +10 -2
  53. data/lib/num2words/locales/it.rb +10 -2
  54. data/lib/num2words/locales/ja.rb +10 -2
  55. data/lib/num2words/locales/ru.rb +0 -3
  56. data/lib/num2words/version.rb +1 -1
  57. data/lib/num2words.rb +1 -0
  58. data/num2words.gemspec +1 -1
  59. metadata +9 -5
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :el)
11
11
  SCALES = I18n.t("num2words.scales", locale: :el)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.EUR.name", locale: :el)
14
- MINOR_UNIT = I18n.t("num2words.currencies.EUR.fractional.name", locale: :el)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :el)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :el)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :el)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :el)
18
+ TIME = I18n.t("num2words.time", locale: :el)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :el)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :el)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :el)
15
23
  end
16
24
 
17
25
  register :el, EL
@@ -10,9 +10,6 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :en)
11
11
  SCALES = I18n.t("num2words.scales", locale: :en)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.USD.name", locale: :en)
14
- MINOR_UNIT = I18n.t("num2words.currencies.USD.fractional.name", locale: :en)
15
-
16
13
  FRACTIONS = I18n.t("num2words.fractions", locale: :en)
17
14
  GRAMMAR = I18n.t("num2words.grammar", locale: :en)
18
15
 
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :es)
11
11
  SCALES = I18n.t("num2words.scales", locale: :es)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.EUR.name", locale: :es)
14
- MINOR_UNIT = I18n.t("num2words.currencies.EUR.fractional.name", locale: :es)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :es)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :es)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :es)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :es)
18
+ TIME = I18n.t("num2words.time", locale: :es)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :es)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :es)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :es)
15
23
  end
16
24
 
17
25
  register :es, ES
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :et)
11
11
  SCALES = I18n.t("num2words.scales", locale: :et)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.EUR.name", locale: :et)
14
- MINOR_UNIT = I18n.t("num2words.currencies.EUR.fractional.name", locale: :et)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :et)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :et)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :et)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :et)
18
+ TIME = I18n.t("num2words.time", locale: :et)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :et)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :et)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :et)
15
23
  end
16
24
 
17
25
  register :et, ET
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :fa)
11
11
  SCALES = I18n.t("num2words.scales", locale: :fa)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.IRR.name", locale: :fa)
14
- MINOR_UNIT = I18n.t("num2words.currencies.IRR.fractional.name", locale: :fa)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :fa)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :fa)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :fa)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :fa)
18
+ TIME = I18n.t("num2words.time", locale: :fa)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :fa)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :fa)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :fa)
15
23
  end
16
24
 
17
25
  register :fa, FA
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :fi)
11
11
  SCALES = I18n.t("num2words.scales", locale: :fi)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.EUR.name", locale: :fi)
14
- MINOR_UNIT = I18n.t("num2words.currencies.EUR.fractional.name", locale: :fi)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :fi)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :fi)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :fi)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :fi)
18
+ TIME = I18n.t("num2words.time", locale: :fi)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :fi)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :fi)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :fi)
15
23
  end
16
24
 
17
25
  register :fi, FI
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :fr)
11
11
  SCALES = I18n.t("num2words.scales", locale: :fr)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.EUR.name", locale: :fr)
14
- MINOR_UNIT = I18n.t("num2words.currencies.EUR.fractional.name", locale: :fr)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :fr)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :fr)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :fr)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :fr)
18
+ TIME = I18n.t("num2words.time", locale: :fr)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :fr)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :fr)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :fr)
15
23
  end
16
24
 
17
25
  register :fr, FR
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :gu)
11
11
  SCALES = I18n.t("num2words.scales", locale: :gu)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.INR.name", locale: :gu)
14
- MINOR_UNIT = I18n.t("num2words.currencies.INR.fractional.name", locale: :gu)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :gu)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :gu)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :gu)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :gu)
18
+ TIME = I18n.t("num2words.time", locale: :gu)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :gu)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :gu)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :gu)
15
23
  end
16
24
 
17
25
  register :gu, GU
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :he)
11
11
  SCALES = I18n.t("num2words.scales", locale: :he)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.ILS.name", locale: :he)
14
- MINOR_UNIT = I18n.t("num2words.currencies.ILS.fractional.name", locale: :he)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :he)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :he)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :he)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :he)
18
+ TIME = I18n.t("num2words.time", locale: :he)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :he)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :he)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :he)
15
23
  end
16
24
 
17
25
  register :he, HE
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :hi)
11
11
  SCALES = I18n.t("num2words.scales", locale: :hi)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.INR.name", locale: :hi)
14
- MINOR_UNIT = I18n.t("num2words.currencies.INR.fractional.name", locale: :hi)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :hi)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :hi)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :hi)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :hi)
18
+ TIME = I18n.t("num2words.time", locale: :hi)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :hi)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :hi)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :hi)
15
23
  end
16
24
 
17
25
  register :hi, HI
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :hr)
11
11
  SCALES = I18n.t("num2words.scales", locale: :hr)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.EUR.name", locale: :hr)
14
- MINOR_UNIT = I18n.t("num2words.currencies.EUR.fractional.name", locale: :hr)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :hr)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :hr)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :hr)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :hr)
18
+ TIME = I18n.t("num2words.time", locale: :hr)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :hr)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :hr)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :hr)
15
23
  end
16
24
 
17
25
  register :hr, HR
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :hu)
11
11
  SCALES = I18n.t("num2words.scales", locale: :hu)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.HUF.name", locale: :hu)
14
- MINOR_UNIT = I18n.t("num2words.currencies.HUF.fractional.name", locale: :hu)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :hu)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :hu)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :hu)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :hu)
18
+ TIME = I18n.t("num2words.time", locale: :hu)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :hu)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :hu)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :hu)
15
23
  end
16
24
 
17
25
  register :hu, HU
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :id)
11
11
  SCALES = I18n.t("num2words.scales", locale: :id)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.IDR.name", locale: :id)
14
- MINOR_UNIT = I18n.t("num2words.currencies.IDR.fractional.name", locale: :id)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :id)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :id)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :id)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :id)
18
+ TIME = I18n.t("num2words.time", locale: :id)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :id)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :id)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :id)
15
23
  end
16
24
 
17
25
  register :id, ID
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :it)
11
11
  SCALES = I18n.t("num2words.scales", locale: :it)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.EUR.name", locale: :it)
14
- MINOR_UNIT = I18n.t("num2words.currencies.EUR.fractional.name", locale: :it)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :it)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :it)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :it)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :it)
18
+ TIME = I18n.t("num2words.time", locale: :it)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :it)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :it)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :it)
15
23
  end
16
24
 
17
25
  register :it, IT
@@ -10,8 +10,16 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :ja)
11
11
  SCALES = I18n.t("num2words.scales", locale: :ja)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.JPY.name", locale: :ja)
14
- MINOR_UNIT = I18n.t("num2words.currencies.JPY.fractional.name", locale: :ja)
13
+ FRACTIONS = I18n.t("num2words.fractions", locale: :ja)
14
+ GRAMMAR = I18n.t("num2words.grammar", locale: :ja)
15
+
16
+ DATE = I18n.t("num2words.date", locale: :ja)
17
+ DATE_TEMPLATE = I18n.t("num2words.date.template", locale: :ja)
18
+ TIME = I18n.t("num2words.time", locale: :ja)
19
+ TIME_TEMPLATE = I18n.t("num2words.time.template", locale: :ja)
20
+ DATETIME_TEMPLATE = I18n.t("num2words.datetime.template", locale: :ja)
21
+
22
+ ORDINALS = I18n.t("num2words.numbers.ordinals", locale: :ja)
15
23
  end
16
24
 
17
25
  register :ja, JA
@@ -10,9 +10,6 @@ module Num2words
10
10
  HUNDREDS = I18n.t("num2words.hundreds", locale: :ru)
11
11
  SCALES = I18n.t("num2words.scales", locale: :ru)
12
12
 
13
- MAJOR_UNIT = I18n.t("num2words.currencies.RUB.name", locale: :ru)
14
- MINOR_UNIT = I18n.t("num2words.currencies.RUB.fractional.name", locale: :ru)
15
-
16
13
  FRACTIONS = I18n.t("num2words.fractions", locale: :ru)
17
14
  GRAMMAR = I18n.t("num2words.grammar", locale: :ru)
18
15
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Num2words
4
- VERSION = "0.1.5"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/num2words.rb CHANGED
@@ -5,6 +5,7 @@ require_relative "num2words/version"
5
5
  require_relative "num2words/converter"
6
6
  require_relative "num2words/core_ext"
7
7
  require_relative "num2words/locales"
8
+ require_relative "num2words/config"
8
9
 
9
10
  module Num2words
10
11
  def self.to_words(number, *args, **opts)
data/num2words.gemspec CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_runtime_dependency "i18n", ">= 1.8"
28
+ spec.add_runtime_dependency "i18n", "~> 1.8"
29
29
  end
metadata CHANGED
@@ -1,34 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: num2words
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Fedotov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-22 00:00:00.000000000 Z
11
+ date: 2026-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.8'
27
27
  description: Converts integers and amounts to Russian words with proper gender and
28
28
  plural forms.
29
29
  email:
30
30
  - progruson@gmail.com
31
- executables: []
31
+ executables:
32
+ - num2words-console
32
33
  extensions: []
33
34
  extra_rdoc_files: []
34
35
  files:
@@ -90,7 +91,10 @@ files:
90
91
  - config/locales/ur.yml
91
92
  - config/locales/vi.yml
92
93
  - config/locales/zh.yml
94
+ - exe/num2words-console
93
95
  - lib/num2words.rb
96
+ - lib/num2words/config.rb
97
+ - lib/num2words/console.rb
94
98
  - lib/num2words/converter.rb
95
99
  - lib/num2words/core_ext.rb
96
100
  - lib/num2words/i18n.rb