num2words 0.1.0 → 0.1.2
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/.gitignore +3 -0
- data/Gemfile +1 -0
- data/README.md +104 -81
- data/bin/console +1 -1
- data/config/locales/ar.yml +36 -0
- data/config/locales/be.yml +31 -0
- data/config/locales/bg.yml +31 -0
- data/config/locales/bn.yml +26 -0
- data/config/locales/cs.yml +31 -0
- data/config/locales/da.yml +31 -0
- data/config/locales/de.yml +31 -0
- data/config/locales/el.yml +36 -0
- data/config/locales/en.yml +26 -0
- data/config/locales/es.yml +31 -0
- data/config/locales/et.yml +26 -0
- data/config/locales/fa.yml +31 -0
- data/config/locales/fi.yml +26 -0
- data/config/locales/fr.yml +31 -0
- data/config/locales/gu.yml +26 -0
- data/config/locales/he.yml +36 -0
- data/config/locales/hi.yml +31 -0
- data/config/locales/hr.yml +31 -0
- data/config/locales/hu.yml +31 -0
- data/config/locales/id.yml +31 -0
- data/config/locales/it.yml +31 -0
- data/config/locales/ja.yml +31 -0
- data/config/locales/kn.yml +26 -0
- data/config/locales/ko.yml +31 -0
- data/config/locales/kz.yml +36 -0
- data/config/locales/lt.yml +26 -0
- data/config/locales/lv.yml +26 -0
- data/config/locales/ml.yml +26 -0
- data/config/locales/mr.yml +26 -0
- data/config/locales/ms.yml +26 -0
- data/config/locales/nb.yml +36 -0
- data/config/locales/nl.yml +31 -0
- data/config/locales/pa.yml +26 -0
- data/config/locales/pl.yml +31 -0
- data/config/locales/pt.yml +31 -0
- data/config/locales/ro.yml +31 -0
- data/config/locales/ru.yml +21 -0
- data/config/locales/sk.yml +26 -0
- data/config/locales/sl.yml +26 -0
- data/config/locales/sr.yml +31 -0
- data/config/locales/sv.yml +33 -0
- data/config/locales/sw.yml +26 -0
- data/config/locales/ta.yml +26 -0
- data/config/locales/te.yml +26 -0
- data/config/locales/th.yml +31 -0
- data/config/locales/tr.yml +31 -0
- data/config/locales/uk.yml +31 -0
- data/config/locales/ur.yml +26 -0
- data/config/locales/vi.yml +31 -0
- data/config/locales/zh.yml +21 -0
- data/lib/num2words/converter.rb +47 -64
- data/lib/num2words/core_ext.rb +6 -6
- data/lib/num2words/i18n.rb +30 -0
- data/lib/num2words/locales/ar.rb +19 -0
- data/lib/num2words/locales/be.rb +19 -0
- data/lib/num2words/locales/bg.rb +19 -0
- data/lib/num2words/locales/bn.rb +19 -0
- data/lib/num2words/locales/cs.rb +19 -0
- data/lib/num2words/locales/da.rb +19 -0
- data/lib/num2words/locales/de.rb +19 -0
- data/lib/num2words/locales/el.rb +19 -0
- data/lib/num2words/locales/en.rb +19 -0
- data/lib/num2words/locales/es.rb +19 -0
- data/lib/num2words/locales/et.rb +19 -0
- data/lib/num2words/locales/fa.rb +19 -0
- data/lib/num2words/locales/fi.rb +19 -0
- data/lib/num2words/locales/fr.rb +19 -0
- data/lib/num2words/locales/gu.rb +19 -0
- data/lib/num2words/locales/he.rb +19 -0
- data/lib/num2words/locales/hi.rb +19 -0
- data/lib/num2words/locales/hr.rb +19 -0
- data/lib/num2words/locales/hu.rb +19 -0
- data/lib/num2words/locales/id.rb +19 -0
- data/lib/num2words/locales/it.rb +19 -0
- data/lib/num2words/locales/ja.rb +19 -0
- data/lib/num2words/locales/kn.rb +19 -0
- data/lib/num2words/locales/ko.rb +19 -0
- data/lib/num2words/locales/kz.rb +19 -0
- data/lib/num2words/locales/lt.rb +19 -0
- data/lib/num2words/locales/lv.rb +19 -0
- data/lib/num2words/locales/ml.rb +19 -0
- data/lib/num2words/locales/mr.rb +19 -0
- data/lib/num2words/locales/ms.rb +19 -0
- data/lib/num2words/locales/nl.rb +19 -0
- data/lib/num2words/locales/no.rb +19 -0
- data/lib/num2words/locales/pa.rb +19 -0
- data/lib/num2words/locales/pl.rb +19 -0
- data/lib/num2words/locales/pt.rb +19 -0
- data/lib/num2words/locales/ro.rb +19 -0
- data/lib/num2words/locales/ru.rb +19 -0
- data/lib/num2words/locales/sk.rb +19 -0
- data/lib/num2words/locales/sl.rb +19 -0
- data/lib/num2words/locales/sr.rb +19 -0
- data/lib/num2words/locales/sv.rb +19 -0
- data/lib/num2words/locales/sw.rb +19 -0
- data/lib/num2words/locales/ta.rb +19 -0
- data/lib/num2words/locales/te.rb +19 -0
- data/lib/num2words/locales/th.rb +19 -0
- data/lib/num2words/locales/tr.rb +19 -0
- data/lib/num2words/locales/uk.rb +19 -0
- data/lib/num2words/locales/ur.rb +19 -0
- data/lib/num2words/locales/vi.rb +19 -0
- data/lib/num2words/locales/zh.rb +19 -0
- data/lib/num2words/locales.rb +33 -0
- data/lib/num2words/version.rb +1 -1
- data/lib/num2words.rb +6 -4
- data/num2words.gemspec +2 -0
- metadata +119 -3
data/lib/num2words/converter.rb
CHANGED
@@ -2,68 +2,16 @@
|
|
2
2
|
|
3
3
|
module Num2words
|
4
4
|
class Converter
|
5
|
-
ONES_MASC = %w[ноль один два три четыре пять шесть семь восемь девять].freeze
|
6
|
-
ONES_FEM = %w[ноль одна две три четыре пять шесть семь восемь девять].freeze
|
7
|
-
|
8
|
-
TEENS = %w[десять одиннадцать двенадцать тринадцать четырнадцать пятнадцать
|
9
|
-
шестнадцать семнадцать восемнадцать девятнадцать].freeze
|
10
|
-
|
11
|
-
TENS = [nil, nil, "двадцать", "тридцать", "сорок", "пятьдесят",
|
12
|
-
"шестьдесят", "семьдесят", "восемьдесят", "девяносто"].freeze
|
13
|
-
|
14
|
-
HUNDREDS = [nil, "сто", "двести", "триста", "четыреста", "пятьсот",
|
15
|
-
"шестьсот", "семьсот", "восемьсот", "девятьсот"].freeze
|
16
|
-
|
17
|
-
# формы: [one, few, many]
|
18
|
-
SCALES = [
|
19
|
-
["", "", ""], # 10^0 (единицы)
|
20
|
-
%w[тысяча тысячи тысяч], # 10^3
|
21
|
-
%w[миллион миллиона миллионов], # 10^6
|
22
|
-
%w[миллиард миллиарда миллиардов], # 10^9
|
23
|
-
%w[триллион триллиона триллионов] # 10^12
|
24
|
-
].freeze
|
25
|
-
|
26
|
-
RUB = %w[рубль рубля рублей].freeze
|
27
|
-
KOP = %w[копейка копейки копеек].freeze
|
28
|
-
|
29
5
|
class << self
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
when 2..4 then few
|
35
|
-
else many
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# n — 0..999, scale_idx — индекс разряда (0 — единицы, 1 — тысячи, ...)
|
40
|
-
# feminine: true — использовать женский род для единиц (нужно для тысяч/копеек)
|
41
|
-
def triple_to_words(n, scale_idx, feminine: false)
|
42
|
-
return [] if n.zero?
|
43
|
-
|
44
|
-
words = []
|
45
|
-
words << HUNDREDS[n / 100] if n >= 100
|
46
|
-
|
47
|
-
rest = n % 100
|
48
|
-
if rest.between?(10, 19)
|
49
|
-
words << TEENS[rest - 10]
|
50
|
-
else
|
51
|
-
words << TENS[rest / 10] if rest >= 20
|
52
|
-
ones = rest % 10
|
53
|
-
if ones.positive?
|
54
|
-
words << (feminine ? ONES_FEM[ones] : ONES_MASC[ones])
|
55
|
-
end
|
56
|
-
end
|
6
|
+
# number — целое число (0..10^12-1)
|
7
|
+
def to_words(number, *args, **opts)
|
8
|
+
locale = args.first.is_a?(Symbol) ? args.first : opts[:locale] || :ru
|
9
|
+
feminine = opts.delete(:feminine) || false
|
57
10
|
|
58
|
-
|
59
|
-
words << pluralize(n, *SCALES[scale_idx]) unless scale_idx.zero?
|
60
|
-
words.compact
|
61
|
-
end
|
11
|
+
locale_data = Locales[locale]
|
62
12
|
|
63
|
-
# number — целое число (0..10^12-1)
|
64
|
-
def to_words(number, feminine: false)
|
65
13
|
number = Integer(number)
|
66
|
-
return (feminine ? ONES_FEM[0] : ONES_MASC[0]) if number.zero?
|
14
|
+
return (feminine ? locale_data::ONES_FEM[0] : locale_data::ONES_MASC[0]) if number.zero?
|
67
15
|
|
68
16
|
groups = number.to_s
|
69
17
|
.chars.reverse.each_slice(3).map(&:reverse)
|
@@ -73,27 +21,62 @@ module Num2words
|
|
73
21
|
groups.each_with_index do |grp, idx|
|
74
22
|
scale_idx = groups.size - idx - 1
|
75
23
|
fem = (scale_idx == 1) || feminine # тысячи — жен. род
|
76
|
-
words.concat triple_to_words(grp, scale_idx, feminine: fem)
|
24
|
+
words.concat triple_to_words(grp, scale_idx, locale_data, feminine: fem)
|
77
25
|
end
|
78
26
|
words.join(" ")
|
79
27
|
end
|
80
28
|
|
81
29
|
# amount может быть String, Integer, Float, BigDecimal
|
82
|
-
def to_currency(amount)
|
30
|
+
def to_currency(amount, *args, **opts)
|
31
|
+
locale = args.first.is_a?(Symbol) ? args.first : opts[:locale] || :ru
|
32
|
+
locale_data = Locales[locale]
|
33
|
+
|
83
34
|
str = amount.to_s
|
84
35
|
rub_str, kop_str = str.split(".")
|
85
36
|
rub = Integer(rub_str)
|
86
37
|
# всегда 2 знака для копеек; обрезаем лишние, дополняем недостающие
|
87
38
|
kop = (kop_str || "0")[0, 2].ljust(2, "0").to_i
|
88
39
|
|
89
|
-
rub_words = to_words(rub)
|
90
|
-
rub_name = pluralize(rub, *RUB)
|
40
|
+
rub_words = to_words(rub, locale: locale)
|
41
|
+
rub_name = pluralize(rub, *locale_data::RUB)
|
91
42
|
|
92
|
-
kop_words = to_words(kop, feminine: true)
|
93
|
-
kop_name = pluralize(kop, *KOP)
|
43
|
+
kop_words = to_words(kop, locale: locale, feminine: true)
|
44
|
+
kop_name = pluralize(kop, *locale_data::KOP)
|
94
45
|
|
95
46
|
"#{rub_words} #{rub_name} #{kop_words} #{kop_name}"
|
96
47
|
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def pluralize(n, one, few, many)
|
52
|
+
return many if (11..14).include?(n % 100)
|
53
|
+
case n % 10
|
54
|
+
when 1 then one
|
55
|
+
when 2..4 then few
|
56
|
+
else many
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# n — 0..999, scale_idx — индекс разряда (0 — единицы, 1 — тысячи, ...)
|
61
|
+
# feminine: true — использовать женский род для единиц (нужно для тысяч/копеек)
|
62
|
+
def triple_to_words(n, scale_idx, local_data, feminine: false)
|
63
|
+
return [] if n.zero?
|
64
|
+
words = []
|
65
|
+
|
66
|
+
words << local_data::HUNDREDS[n / 100] if n >= 100
|
67
|
+
rest = n % 100
|
68
|
+
|
69
|
+
if rest.between?(10, 19)
|
70
|
+
words << local_data::TEENS[rest - 10]
|
71
|
+
else
|
72
|
+
words << local_data::TENS[rest / 10] if rest >= 20
|
73
|
+
ones = rest % 10
|
74
|
+
words << (feminine ? local_data::ONES_FEM[ones] : local_data::ONES_MASC[ones]) if ones.positive?
|
75
|
+
end
|
76
|
+
|
77
|
+
words << pluralize(n, *local_data::SCALES[scale_idx]) unless scale_idx.zero?
|
78
|
+
words.compact
|
79
|
+
end
|
97
80
|
end
|
98
81
|
end
|
99
82
|
end
|
data/lib/num2words/core_ext.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Integer
|
4
|
-
def to_words(
|
5
|
-
Num2words::Converter.to_words(self,
|
4
|
+
def to_words(*args, **opts)
|
5
|
+
Num2words::Converter.to_words(self, *args, **opts)
|
6
6
|
end
|
7
7
|
|
8
|
-
def to_currency
|
9
|
-
Num2words::Converter.to_currency(self)
|
8
|
+
def to_currency(*args, **opts)
|
9
|
+
Num2words::Converter.to_currency(self, *args, **opts)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
class Float
|
14
|
-
def to_currency
|
15
|
-
Num2words::Converter.to_currency(self)
|
14
|
+
def to_currency(*args, **opts)
|
15
|
+
Num2words::Converter.to_currency(self, *args, **opts)
|
16
16
|
end
|
17
17
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "i18n"
|
4
|
+
|
5
|
+
module Num2words
|
6
|
+
module I18nSetup
|
7
|
+
def self.load!
|
8
|
+
locales_path = File.expand_path("../../config/locales/*.yml", __dir__)
|
9
|
+
files = Dir[locales_path]
|
10
|
+
|
11
|
+
if files.empty?
|
12
|
+
raise "Num2words: не найдены файлы локалей в #{locales_path}"
|
13
|
+
end
|
14
|
+
|
15
|
+
I18n.load_path += files
|
16
|
+
I18n.available_locales = files.map { |file| File.basename(file, ".*") }.map(&:to_sym)
|
17
|
+
I18n.default_locale = :ru
|
18
|
+
I18n.enforce_available_locales = true
|
19
|
+
|
20
|
+
# Проверяем, что ключи реально доступны
|
21
|
+
I18n.available_locales.each do |loc|
|
22
|
+
unless I18n.exists?("num2words.ones_masc", locale: loc)
|
23
|
+
raise "Num2words: отсутствуют ключи для локали #{loc} в locales/#{loc}.yml"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Num2words::I18nSetup.load!
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module AR
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :ar)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :ar)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :ar)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :ar)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :ar)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :ar)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.SAR.name", locale: :ar)
|
14
|
+
KOP = I18n.t("num2words.currencies.SAR.fractional.name", locale: :ar)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :ar, AR
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module BE
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :be)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :be)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :be)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :be)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :be)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :be)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.BYN.name", locale: :be)
|
14
|
+
KOP = I18n.t("num2words.currencies.BYN.fractional.name", locale: :be)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :be, BE
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module BG
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :bg)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :bg)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :bg)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :bg)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :bg)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :bg)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.BGN.name", locale: :bg)
|
14
|
+
KOP = I18n.t("num2words.currencies.BGN.fractional.name", locale: :bg)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :bg, BG
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module BN
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :bn)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :bn)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :bn)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :bn)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :bn)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :bn)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.BDT.name", locale: :bn)
|
14
|
+
KOP = I18n.t("num2words.currencies.BDT.fractional.name", locale: :bn)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :bn, BN
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module CS
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :cs)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :cs)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :cs)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :cs)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :cs)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :cs)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.CZK.name", locale: :cs)
|
14
|
+
KOP = I18n.t("num2words.currencies.CZK.fractional.name", locale: :cs)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :cs, CS
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module DA
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :da)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :da)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :da)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :da)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :da)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :da)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.DKK.name", locale: :da)
|
14
|
+
KOP = I18n.t("num2words.currencies.DKK.fractional.name", locale: :da)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :da, DA
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module DE
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :de)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :de)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :de)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :de)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :de)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :de)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.EUR.name", locale: :de)
|
14
|
+
KOP = I18n.t("num2words.currencies.EUR.fractional.name", locale: :de)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :de, DE
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module EL
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :el)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :el)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :el)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :el)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :el)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :el)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.EUR.name", locale: :el)
|
14
|
+
KOP = I18n.t("num2words.currencies.EUR.fractional.name", locale: :el)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :el, EL
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module EN
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :en)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :en)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :en)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :en)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :en)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :en)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.USD.name", locale: :en)
|
14
|
+
KOP = I18n.t("num2words.currencies.USD.fractional.name", locale: :en)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :en, EN
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module ES
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :es)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :es)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :es)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :es)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :es)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :es)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.EUR.name", locale: :es)
|
14
|
+
KOP = I18n.t("num2words.currencies.EUR.fractional.name", locale: :es)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :es, ES
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module ET
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :et)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :et)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :et)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :et)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :et)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :et)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.EUR.name", locale: :et)
|
14
|
+
KOP = I18n.t("num2words.currencies.EUR.fractional.name", locale: :et)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :et, ET
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module FA
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :fa)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :fa)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :fa)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :fa)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :fa)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :fa)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.IRR.name", locale: :fa)
|
14
|
+
KOP = I18n.t("num2words.currencies.IRR.fractional.name", locale: :fa)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :fa, FA
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module FI
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :fi)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :fi)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :fi)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :fi)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :fi)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :fi)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.EUR.name", locale: :fi)
|
14
|
+
KOP = I18n.t("num2words.currencies.EUR.fractional.name", locale: :fi)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :fi, FI
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module FR
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :fr)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :fr)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :fr)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :fr)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :fr)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :fr)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.EUR.name", locale: :fr)
|
14
|
+
KOP = I18n.t("num2words.currencies.EUR.fractional.name", locale: :fr)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :fr, FR
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module GU
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :gu)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :gu)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :gu)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :gu)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :gu)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :gu)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.INR.name", locale: :gu)
|
14
|
+
KOP = I18n.t("num2words.currencies.INR.fractional.name", locale: :gu)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :gu, GU
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module HE
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :he)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :he)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :he)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :he)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :he)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :he)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.ILS.name", locale: :he)
|
14
|
+
KOP = I18n.t("num2words.currencies.ILS.fractional.name", locale: :he)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :he, HE
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module HI
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :hi)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :hi)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :hi)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :hi)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :hi)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :hi)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.INR.name", locale: :hi)
|
14
|
+
KOP = I18n.t("num2words.currencies.INR.fractional.name", locale: :hi)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :hi, HI
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module HR
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :hr)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :hr)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :hr)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :hr)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :hr)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :hr)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.EUR.name", locale: :hr)
|
14
|
+
KOP = I18n.t("num2words.currencies.EUR.fractional.name", locale: :hr)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :hr, HR
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module HU
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :hu)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :hu)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :hu)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :hu)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :hu)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :hu)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.HUF.name", locale: :hu)
|
14
|
+
KOP = I18n.t("num2words.currencies.HUF.fractional.name", locale: :hu)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :hu, HU
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module ID
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :id)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :id)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :id)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :id)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :id)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :id)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.IDR.name", locale: :id)
|
14
|
+
KOP = I18n.t("num2words.currencies.IDR.fractional.name", locale: :id)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :id, ID
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module IT
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :it)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :it)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :it)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :it)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :it)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :it)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.EUR.name", locale: :it)
|
14
|
+
KOP = I18n.t("num2words.currencies.EUR.fractional.name", locale: :it)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :it, IT
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module JA
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :ja)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :ja)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :ja)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :ja)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :ja)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :ja)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.JPY.name", locale: :ja)
|
14
|
+
KOP = I18n.t("num2words.currencies.JPY.fractional.name", locale: :ja)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :ja, JA
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Num2words
|
4
|
+
module Locales
|
5
|
+
module KN
|
6
|
+
ONES_MASC = I18n.t("num2words.ones_masc", locale: :kn)
|
7
|
+
ONES_FEM = I18n.t("num2words.ones_fem", locale: :kn)
|
8
|
+
TEENS = I18n.t("num2words.teens", locale: :kn)
|
9
|
+
TENS = I18n.t("num2words.tens", locale: :kn)
|
10
|
+
HUNDREDS = I18n.t("num2words.hundreds", locale: :kn)
|
11
|
+
SCALES = I18n.t("num2words.scales", locale: :kn)
|
12
|
+
|
13
|
+
RUB = I18n.t("num2words.currencies.INR.name", locale: :kn)
|
14
|
+
KOP = I18n.t("num2words.currencies.INR.fractional.name", locale: :kn)
|
15
|
+
end
|
16
|
+
|
17
|
+
register :kn, KN
|
18
|
+
end
|
19
|
+
end
|