numbers_and_words 0.11.2 → 0.11.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.rdoc +23 -5
- data/lib/numbers_and_words.rb +2 -0
- data/lib/numbers_and_words/core_ext.rb +2 -0
- data/lib/numbers_and_words/core_ext/array.rb +2 -0
- data/lib/numbers_and_words/core_ext/float.rb +2 -0
- data/lib/numbers_and_words/core_ext/integer.rb +2 -0
- data/lib/numbers_and_words/helper_classes.rb +2 -0
- data/lib/numbers_and_words/helper_classes/array_extensions/helpers.rb +6 -4
- data/lib/numbers_and_words/helper_classes/figures_array.rb +2 -0
- data/lib/numbers_and_words/helper_classes/words_array.rb +2 -0
- data/lib/numbers_and_words/i18n.rb +2 -0
- data/lib/numbers_and_words/i18n/initialization.rb +2 -0
- data/lib/numbers_and_words/i18n/locales/numbers.cs.yml +37 -26
- data/lib/numbers_and_words/i18n/locales/numbers.de.yml +5 -4
- data/lib/numbers_and_words/i18n/locales/numbers.en-GB.yml +24 -8
- data/lib/numbers_and_words/i18n/locales/numbers.en.yml +10 -6
- data/lib/numbers_and_words/i18n/locales/numbers.es.yml +6 -5
- data/lib/numbers_and_words/i18n/locales/numbers.et.yml +4 -4
- data/lib/numbers_and_words/i18n/locales/numbers.fr.yml +45 -41
- data/lib/numbers_and_words/i18n/locales/numbers.hu.yml +11 -7
- data/lib/numbers_and_words/i18n/locales/numbers.hy.yml +7 -0
- data/lib/numbers_and_words/i18n/locales/numbers.it.yml +3 -3
- data/lib/numbers_and_words/i18n/locales/numbers.ka.yml +6 -14
- data/lib/numbers_and_words/i18n/locales/numbers.lt.yml +4 -5
- data/lib/numbers_and_words/i18n/locales/numbers.lv.yml +4 -5
- data/lib/numbers_and_words/i18n/locales/numbers.nl.yml +4 -3
- data/lib/numbers_and_words/i18n/locales/numbers.pt-BR.yml +51 -22
- data/lib/numbers_and_words/i18n/locales/numbers.pt.yml +21 -8
- data/lib/numbers_and_words/i18n/locales/numbers.ru.yml +39 -27
- data/lib/numbers_and_words/i18n/locales/numbers.se.yml +3 -3
- data/lib/numbers_and_words/i18n/locales/numbers.tr.yml +3 -3
- data/lib/numbers_and_words/i18n/locales/numbers.ua.yml +39 -15
- data/lib/numbers_and_words/i18n/locales/numbers.vi.yml +13 -0
- data/lib/numbers_and_words/i18n/pluralization.rb +3 -1
- data/lib/numbers_and_words/i18n/plurals/cs.rb +15 -10
- data/lib/numbers_and_words/i18n/plurals/fr.rb +5 -3
- data/lib/numbers_and_words/i18n/plurals/lt.rb +10 -7
- data/lib/numbers_and_words/i18n/plurals/lv.rb +5 -3
- data/lib/numbers_and_words/i18n/plurals/plurals.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/ru.rb +15 -10
- data/lib/numbers_and_words/i18n/plurals/ua.rb +2 -0
- data/lib/numbers_and_words/strategies.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages.rb +3 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/base.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/en-GB.rb +3 -1
- data/lib/numbers_and_words/strategies/array_joiner/languages/en.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/es.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/families/base.rb +5 -3
- data/lib/numbers_and_words/strategies/array_joiner/languages/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/vi.rb +12 -0
- data/lib/numbers_and_words/strategies/figures_converter.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/integral.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/fractional.rb +3 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/fractional.rb +3 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb +5 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/base.rb +14 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb +14 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb +14 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages.rb +14 -15
- data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +4 -2
- data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +4 -4
- data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +7 -7
- data/lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/en.rb +3 -9
- data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +11 -13
- data/lib/numbers_and_words/strategies/figures_converter/languages/et.rb +2 -2
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +12 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +2 -2
- data/lib/numbers_and_words/strategies/figures_converter/languages/{families/latin.rb → hy.rb} +3 -4
- data/lib/numbers_and_words/strategies/figures_converter/languages/it.rb +2 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +13 -15
- data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +8 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +4 -14
- data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +3 -5
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +14 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt.rb +3 -3
- data/lib/numbers_and_words/strategies/figures_converter/languages/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/se.rb +2 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +4 -4
- data/lib/numbers_and_words/strategies/figures_converter/languages/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/vi.rb +100 -0
- data/lib/numbers_and_words/strategies/figures_converter/options.rb +15 -2
- data/lib/numbers_and_words/strategies/figures_converter/options/base.rb +5 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +28 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb +3 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb +3 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/pronounced.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_hyphen.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_zero.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/hundreds_with_union.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +3 -10
- data/lib/numbers_and_words/strategies/figures_converter/options/en/pronounced.rb +6 -13
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_hyphen.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/es.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/es/apocopated.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/es/gender.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/es/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb +3 -50
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/gender.rb +3 -18
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/ordinal.rb +3 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/gender.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/ua/gender.rb +3 -17
- data/lib/numbers_and_words/translations.rb +4 -0
- data/lib/numbers_and_words/translations/base.rb +3 -1
- data/lib/numbers_and_words/translations/cs.rb +6 -31
- data/lib/numbers_and_words/translations/de.rb +5 -3
- data/lib/numbers_and_words/translations/en-GB.rb +5 -1
- data/lib/numbers_and_words/translations/en.rb +2 -0
- data/lib/numbers_and_words/translations/es.rb +15 -25
- data/lib/numbers_and_words/translations/et.rb +4 -7
- data/lib/numbers_and_words/translations/extensions/fraction_significance.rb +6 -4
- data/lib/numbers_and_words/translations/families/base.rb +5 -3
- data/lib/numbers_and_words/translations/families/cyrillic.rb +6 -8
- data/lib/numbers_and_words/translations/families/latin.rb +2 -0
- data/lib/numbers_and_words/translations/fr.rb +15 -18
- data/lib/numbers_and_words/translations/hu.rb +4 -7
- data/lib/numbers_and_words/translations/hy.rb +21 -0
- data/lib/numbers_and_words/translations/it.rb +2 -0
- data/lib/numbers_and_words/translations/ka.rb +6 -14
- data/lib/numbers_and_words/translations/lt.rb +4 -11
- data/lib/numbers_and_words/translations/lv.rb +4 -11
- data/lib/numbers_and_words/translations/nl.rb +6 -2
- data/lib/numbers_and_words/translations/pt-BR.rb +23 -23
- data/lib/numbers_and_words/translations/pt.rb +5 -11
- data/lib/numbers_and_words/translations/ru.rb +2 -17
- data/lib/numbers_and_words/translations/se.rb +2 -0
- data/lib/numbers_and_words/translations/tr.rb +2 -4
- data/lib/numbers_and_words/translations/ua.rb +2 -13
- data/lib/numbers_and_words/translations/vi.rb +24 -0
- data/lib/numbers_and_words/version.rb +3 -1
- data/lib/numbers_and_words/wrappers.rb +2 -0
- data/lib/numbers_and_words/wrappers/float.rb +3 -1
- data/lib/numbers_and_words/wrappers/integer.rb +2 -0
- metadata +33 -20
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class De < Base
|
4
|
-
include NumbersAndWords::Translations::Families::
|
6
|
+
include NumbersAndWords::Translations::Families::Base
|
5
7
|
DEFAULT_POSTFIX = :combine
|
6
8
|
|
7
9
|
def ones(number, options = {})
|
@@ -9,11 +11,11 @@ module NumbersAndWords
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def tens_with_ones(numbers, options = {})
|
12
|
-
[tens(numbers[1]), ones(numbers[0], options)].reverse.join
|
14
|
+
[tens(numbers[1]), ones(numbers[0], options)].reverse.join(union)
|
13
15
|
end
|
14
16
|
|
15
17
|
def hundreds(number, _options = {})
|
16
|
-
[ones(number), t(:hundreds)].join
|
18
|
+
[ones(number), t(:hundreds)].join
|
17
19
|
end
|
18
20
|
|
19
21
|
def zero(_options = {})
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
|
-
class EnGb <
|
5
|
+
class EnGb < Base
|
6
|
+
include NumbersAndWords::Translations::Families::Latin
|
7
|
+
include NumbersAndWords::Translations::Extensions::FractionSignificance
|
4
8
|
end
|
5
9
|
end
|
6
10
|
end
|
@@ -1,47 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class Es < Base
|
4
|
-
include NumbersAndWords::Translations::Families::
|
6
|
+
include NumbersAndWords::Translations::Families::Base
|
5
7
|
include NumbersAndWords::Translations::Extensions::FractionSignificance
|
6
8
|
|
7
9
|
def zero(_options = {})
|
8
|
-
t(
|
10
|
+
t('ones.male')[0]
|
9
11
|
end
|
10
12
|
|
11
13
|
def ones(number, options = {})
|
12
14
|
return if options[:is_one_thousand]
|
13
|
-
return t(
|
14
|
-
|
15
|
-
t([:ones, options[:gender]].join('.'))[number]
|
16
|
-
end
|
15
|
+
return t('ones.apocopated') if number == 1 &&
|
16
|
+
options[:is_apocopated]
|
17
17
|
|
18
|
-
|
19
|
-
return t(%i[twenties apocopated].join('.')) if options[:is_apocopated]
|
20
|
-
t([:twenties, options[:gender]].join('.'))[numbers[0]]
|
18
|
+
t([:ones, options[:gender]].join('.'))[number]
|
21
19
|
end
|
22
20
|
|
23
21
|
def tens_with_ones(numbers, options = {})
|
24
|
-
|
25
|
-
t(:union),
|
26
|
-
ones(numbers[0], options)].join(' ')
|
22
|
+
super numbers, options.merge(separator: " #{union} ")
|
27
23
|
end
|
28
24
|
|
29
|
-
def
|
30
|
-
return t(
|
31
|
-
t([:hundreds, options[:gender]].join('.'))[number]
|
32
|
-
end
|
25
|
+
def twenties_with_ones(numbers, options = {})
|
26
|
+
return t('twenties.apocopated') if options[:is_apocopated]
|
33
27
|
|
34
|
-
|
35
|
-
micro, prefix = capacity
|
36
|
-
micros = number ? t(micro(micro), count: number) : micro(micro)
|
37
|
-
[micro_prefix(prefix), micros].compact.join
|
28
|
+
t([:twenties, options[:gender]].join('.'))[numbers[0]]
|
38
29
|
end
|
39
30
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
31
|
+
def hundreds(number, options = {})
|
32
|
+
return t('hundreds.apocopated') if options[:is_apocopated]
|
33
|
+
|
34
|
+
t([:hundreds, options[:gender]].join('.'))[number]
|
45
35
|
end
|
46
36
|
end
|
47
37
|
end
|
@@ -1,15 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class Et < Base
|
4
6
|
include NumbersAndWords::Translations::Families::Latin
|
5
7
|
|
6
|
-
def
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def hundreds(number, options = {})
|
11
|
-
options[:separator] = ''
|
12
|
-
super number, options
|
8
|
+
def hundreds(number, _options = {})
|
9
|
+
super number, separator: ''
|
13
10
|
end
|
14
11
|
end
|
15
12
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
module Extensions
|
4
6
|
module FractionSignificance
|
5
|
-
def micros(capacity, number = nil
|
7
|
+
def micros(capacity, number = nil)
|
6
8
|
micro, prefix = capacity
|
7
9
|
micros = number ? t(micro(micro), count: number) : micro(micro)
|
8
|
-
[micro_prefix(prefix), micros].compact.join
|
10
|
+
[micro_prefix(prefix), micros].compact.join(t('micro_prefix.union'))
|
9
11
|
end
|
10
12
|
|
11
13
|
def micro(capacity)
|
@@ -14,8 +16,8 @@ module NumbersAndWords
|
|
14
16
|
|
15
17
|
def micro_prefix(capacity)
|
16
18
|
case capacity
|
17
|
-
when 2 then t(
|
18
|
-
when 1 then tens
|
19
|
+
when 2 then t('micro_prefix.hundreds')
|
20
|
+
when 1 then t('micro_prefix.tens')
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
module Families
|
@@ -11,7 +13,7 @@ module NumbersAndWords
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def tens_with_ones(numbers, options = {})
|
14
|
-
[tens(numbers[1]), ones(numbers[0], options)].join options[:separator]
|
16
|
+
[tens(numbers[1]), ones(numbers[0], options)].join options[:separator] || ' '
|
15
17
|
end
|
16
18
|
|
17
19
|
def megs(capacity, options = {})
|
@@ -28,8 +30,8 @@ module NumbersAndWords
|
|
28
30
|
t :union
|
29
31
|
end
|
30
32
|
|
31
|
-
def
|
32
|
-
t :
|
33
|
+
def micro_separator
|
34
|
+
t :micro_separator
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
@@ -1,25 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
module Families
|
4
6
|
module Cyrillic
|
5
7
|
include NumbersAndWords::Translations::Families::Base
|
6
8
|
|
7
|
-
def
|
8
|
-
t(:ones)[
|
9
|
+
def zero(_options = {})
|
10
|
+
t(:ones).values.first[0]
|
9
11
|
end
|
10
12
|
|
11
|
-
def
|
12
|
-
|
13
|
+
def ones(number, options = {})
|
14
|
+
t(:ones)[options[:gender]][number]
|
13
15
|
end
|
14
16
|
|
15
17
|
def hundreds(number, _options = {})
|
16
18
|
t(:hundreds)[number]
|
17
19
|
end
|
18
20
|
|
19
|
-
def zero(_options = {})
|
20
|
-
t(:ones).values.first[0]
|
21
|
-
end
|
22
|
-
|
23
21
|
def integral(number, _options = {})
|
24
22
|
t(:integral, count: number)
|
25
23
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class Fr < Base
|
@@ -7,30 +9,25 @@ module NumbersAndWords
|
|
7
9
|
SPECIAL_TENS_CASE = 8
|
8
10
|
|
9
11
|
def tens(number, options = {})
|
10
|
-
|
11
|
-
|
12
|
+
return t(:eighty) if number == SPECIAL_TENS_CASE && options[:alone].nil?
|
13
|
+
|
14
|
+
super number, options
|
12
15
|
end
|
13
16
|
|
14
|
-
def tens_with_ones(numbers,
|
15
|
-
if [7, 9].include? numbers[1]
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
[tens(numbers[1], alone: false), ones(numbers[0])].join union
|
20
|
-
end
|
17
|
+
def tens_with_ones(numbers, options = {})
|
18
|
+
return [tens(numbers[1] - 1, alone: false), teens(numbers)].join('-') if [7, 9].include? numbers[1]
|
19
|
+
|
20
|
+
separator = numbers[0] == 1 ? " #{union} " : '-'
|
21
|
+
super numbers, options.merge(separator: separator)
|
21
22
|
end
|
22
23
|
|
23
24
|
def hundreds(number, options = {})
|
24
|
-
options[:pluralize]
|
25
|
-
hundreds = t(:hundreds, count:
|
26
|
-
|
27
|
-
|
25
|
+
count = options[:pluralize] ? number : 1
|
26
|
+
hundreds = t(:hundreds, count: count)
|
27
|
+
|
28
|
+
return hundreds if number == 1
|
28
29
|
|
29
|
-
|
30
|
-
case capacity
|
31
|
-
when 2 then t(:hundreds, count: 1)
|
32
|
-
when 1 then tens(1)
|
33
|
-
end
|
30
|
+
[t(:ones)[number], hundreds].join(' ')
|
34
31
|
end
|
35
32
|
end
|
36
33
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class Hu < Base
|
@@ -6,16 +8,11 @@ module NumbersAndWords
|
|
6
8
|
|
7
9
|
def tens_with_ones(numbers, options = {})
|
8
10
|
ones, tens = numbers
|
9
|
-
[t(:tens_with_ones)[tens], t([options[:prefix], :ones_with_tens].join('.'))[ones]].join
|
11
|
+
[t(:tens_with_ones)[tens], t([options[:prefix], :ones_with_tens].join('.'))[ones]].join
|
10
12
|
end
|
11
13
|
|
12
14
|
def hundreds(number, options = {})
|
13
|
-
options
|
14
|
-
super number, options
|
15
|
-
end
|
16
|
-
|
17
|
-
def micros(capacity, _number = nil, separator = '')
|
18
|
-
super capacity, nil, separator
|
15
|
+
super number, options.merge(separator: '')
|
19
16
|
end
|
20
17
|
end
|
21
18
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NumbersAndWords
|
4
|
+
module Translations
|
5
|
+
class Hy < Base
|
6
|
+
include NumbersAndWords::Translations::Families::Latin
|
7
|
+
|
8
|
+
def tens_with_ones(numbers, options = {})
|
9
|
+
options[:separator] ||= ''
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def hundreds(number, _options = {})
|
14
|
+
parts = [t(:hundreds)]
|
15
|
+
parts.unshift(t(:ones)[number]) if number > 1
|
16
|
+
|
17
|
+
parts.join(' ')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class Ka < Base
|
@@ -40,32 +42,22 @@ module NumbersAndWords
|
|
40
42
|
def tens_with_ones(numbers, _options = {})
|
41
43
|
range = vigesimal_range(numbers[1])
|
42
44
|
|
43
|
-
minor = if numbers[1] - range[:multiplicative]
|
45
|
+
minor = if (numbers[1] - range[:multiplicative]).positive?
|
44
46
|
teens(numbers)
|
45
47
|
else
|
46
48
|
ones(numbers[0])
|
47
49
|
end
|
48
50
|
|
49
|
-
[t([:partials, range[:name]].join('.')), minor].join
|
51
|
+
[t([:partials, range[:name]].join('.')), minor].join
|
50
52
|
end
|
51
53
|
|
52
54
|
def hundreds(number, options = {})
|
53
55
|
options[:prefix] ||= options[:only_hundreds] == true ? nil : :partials
|
54
56
|
|
55
|
-
parts = [t([options[:prefix], :
|
57
|
+
parts = [t([options[:prefix], :hundreds].join('.'))]
|
56
58
|
parts.unshift(ones(number, prefix: :partials)) if number > 1
|
57
59
|
|
58
|
-
parts.join
|
59
|
-
end
|
60
|
-
|
61
|
-
def megs(capacity, options = {})
|
62
|
-
if capacity == 1
|
63
|
-
t([options[:prefix], :one_thousand].join('.'))
|
64
|
-
elsif capacity == 2
|
65
|
-
t([options[:prefix], :one_million].join('.'))
|
66
|
-
elsif capacity == 3
|
67
|
-
t([options[:prefix], :one_billion].join('.'))
|
68
|
-
end
|
60
|
+
parts.join
|
69
61
|
end
|
70
62
|
end
|
71
63
|
end
|
@@ -1,19 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class Lt < Base
|
4
6
|
include NumbersAndWords::Translations::Families::Latin
|
5
7
|
|
6
|
-
def
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def tens_with_ones(numbers, _options = {})
|
11
|
-
[tens(numbers[1], alone: false), ones(numbers[0])].join ' '
|
12
|
-
end
|
13
|
-
|
14
|
-
def hundreds(number, options = {})
|
15
|
-
options[:is_hundred] = false if options[:is_hundred].nil?
|
16
|
-
options[:is_hundred] ? t(:one_hundred) : t(:hundreds)[number - 1]
|
8
|
+
def hundreds(number, _options = {})
|
9
|
+
t(:hundreds)[number]
|
17
10
|
end
|
18
11
|
end
|
19
12
|
end
|
@@ -1,19 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class Lv < Base
|
4
6
|
include NumbersAndWords::Translations::Families::Latin
|
5
7
|
|
6
|
-
def
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def tens_with_ones(numbers, _options = {})
|
11
|
-
[tens(numbers[1], alone: false), ones(numbers[0])].join ' '
|
12
|
-
end
|
13
|
-
|
14
|
-
def hundreds(number, options = {})
|
15
|
-
options[:is_hundred] = false if options[:is_hundred].nil?
|
16
|
-
options[:is_hundred] ? t(:one_hundred) : t(:hundreds)[number - 1]
|
8
|
+
def hundreds(number, _options = {})
|
9
|
+
t(:hundreds)[number]
|
17
10
|
end
|
18
11
|
end
|
19
12
|
end
|
@@ -1,14 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class Nl < Base
|
4
6
|
include NumbersAndWords::Translations::Families::Latin
|
5
7
|
|
6
8
|
def tens_with_ones(numbers, _options = {})
|
7
|
-
[ones(numbers[0]), tens(numbers[1])].join
|
9
|
+
[ones(numbers[0]), tens(numbers[1])].join(union)
|
8
10
|
end
|
9
11
|
|
10
12
|
def hundreds(number, _options = {})
|
11
|
-
|
13
|
+
return t(:hundreds) if number == 1
|
14
|
+
|
15
|
+
super number, separator: ''
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Translations
|
3
5
|
class PtBr < Base
|
4
|
-
include NumbersAndWords::Translations::Families::
|
6
|
+
include NumbersAndWords::Translations::Families::Base
|
5
7
|
include NumbersAndWords::Translations::Extensions::FractionSignificance
|
6
8
|
|
7
9
|
def integral(number, _options = {})
|
@@ -14,50 +16,48 @@ module NumbersAndWords
|
|
14
16
|
|
15
17
|
def ones(number, options = {})
|
16
18
|
return if options[:is_one_thousand]
|
19
|
+
|
17
20
|
t([options[:prefix], :ones, options[:gender]].join('.'))[number]
|
18
21
|
end
|
19
22
|
|
20
23
|
def tens(number, options = {})
|
21
|
-
options[:alone] = true if options[:alone].nil?
|
22
24
|
path = [options[:prefix], :tens]
|
23
|
-
path.push(options[:gender]) if ordinal?
|
24
|
-
|
25
|
-
options[:alone] ? translated : "#{union} " + translated
|
25
|
+
path.push(options[:gender]) if ordinal?(options)
|
26
|
+
t(path.join('.'))[number]
|
26
27
|
end
|
27
28
|
|
28
29
|
def teens(number, options = {})
|
29
|
-
return [tens(1, options),
|
30
|
+
return [tens(1, options), ones(number[0], options)].join(' ') if ordinal? options
|
31
|
+
|
30
32
|
super(number, options)
|
31
33
|
end
|
32
34
|
|
33
35
|
def tens_with_ones(numbers, options = {})
|
34
|
-
connector = ' '
|
35
|
-
|
36
|
-
[tens(numbers[1], options), connector, ones(numbers[0], options)].join
|
36
|
+
connector = ordinal?(options) ? ' ' : " #{union} "
|
37
|
+
[tens(numbers[1], options), ones(numbers[0], options)].join(connector)
|
37
38
|
end
|
38
39
|
|
39
40
|
def hundreds(number, options = {})
|
40
|
-
return t(:one_hundred) if options[:is_one_hundred] && !
|
41
|
-
|
42
|
-
|
43
|
-
options[:is_hundred]
|
41
|
+
return t(:one_hundred) if options[:is_one_hundred] && !ordinal?(options)
|
42
|
+
|
43
|
+
hundreds = t([options[:prefix], :hundreds, options[:gender]].join('.'))[number]
|
44
|
+
return hundreds if ordinal?(options) || options[:is_hundred]
|
45
|
+
|
46
|
+
[hundreds, union].join(' ')
|
44
47
|
end
|
45
48
|
|
46
49
|
def megs(capacity, options = {})
|
47
|
-
return t([options[:prefix], :mega, options[:gender]].join('.'))[capacity] if ordinal?
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
suffix = options[:is_opaque] ? '' : connector
|
53
|
-
suffix = options[:is_without_connector] ? '' : suffix
|
54
|
-
(options[:is_one] ? t(:mega)[capacity] : t(:megas)[capacity]) + suffix
|
50
|
+
return t([options[:prefix], :mega, options[:gender]].join('.'))[capacity] if ordinal?(options)
|
51
|
+
return super(capacity, options) if options[:is_opaque] || options[:is_without_connector]
|
52
|
+
|
53
|
+
suffix = options[:is_with_comma] ? ',' : " #{union}"
|
54
|
+
super(capacity, options) + suffix
|
55
55
|
end
|
56
56
|
|
57
|
-
def micros(capacity, number
|
57
|
+
def micros(capacity, number = nil)
|
58
58
|
micro, prefix = capacity
|
59
59
|
micros = number ? t(micro(micro), count: number) : micro(micro)
|
60
|
-
[micro_prefix(prefix, number), micros].compact.join(
|
60
|
+
[micro_prefix(prefix, number), micros].compact.join(t('micro_prefix.union'))
|
61
61
|
end
|
62
62
|
|
63
63
|
def micro_prefix(capacity, number)
|