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,7 @@
|
|
1
1
|
se:
|
2
2
|
numbers:
|
3
3
|
ones: [noll, en, två, tre, fyra, fem, sex, sju, åtta, nio]
|
4
|
-
teens: [
|
5
|
-
tens: [
|
4
|
+
teens: [_, elva, tolv, tretton, fjorton, femton, sexton, sjutton, arton, nitton]
|
5
|
+
tens: [_, tio, tjugo, trettio, fyrtio, femtio, sextio, sjuttio, åttio, nittio]
|
6
6
|
hundreds: hundra
|
7
|
-
mega: [
|
7
|
+
mega: [_, tusen, miljoner, miljarder, biljoner, kvadriljon, kvintiljon, sextillion, septillion, octillion, nonillion, decillion]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
tr:
|
2
2
|
numbers:
|
3
3
|
ones: [sıfır, bir, iki, üç, dört, beş, altı, yedi, sekiz, dokuz]
|
4
|
-
teens: [
|
5
|
-
tens: [
|
4
|
+
teens: [_, on bir, on iki, on üç, on dört, on beş, on altı, on yedi, on sekiz, on dokuz]
|
5
|
+
tens: [_, 'on', yirmi, otuz, kırk, elli, altmış, yetmiş, seksen, doksan]
|
6
6
|
hundreds: yüz
|
7
|
-
mega: [
|
7
|
+
mega: [_, bin, milyon, milyar, trilyon, katrilyon, kentilyon, seksilyon, septilyon, oktilyon, nonilyon, desilyon]
|
@@ -4,20 +4,10 @@ ua:
|
|
4
4
|
male: [нуль, один, два, три, чотири, п’ять, шiсть, сiм, вiсiм, дев’ять]
|
5
5
|
female: [нуль, одна, двi, три, чотири, п’ять, шiсть, сiм, вiсiм, дев’ять]
|
6
6
|
neuter: [нуль, одне, два, три, чотири, п’ять, шiсть, сiм, вiсiм, дев’ять]
|
7
|
-
teens: [
|
8
|
-
tens: [
|
9
|
-
hundreds: [
|
10
|
-
|
11
|
-
union: 'i'
|
12
|
-
micro:
|
13
|
-
one: [_, десята, сота, тысячна, мiльйонна, мiльярдна, трильйонна]
|
14
|
-
few: [_, десятих, сотих, тисячних, мiльйонних, мiльярдних, трильйонних]
|
15
|
-
many: [_, десятих, сотих, тисячних, мiльйонних, мiльярдних, трильйонних]
|
16
|
-
sub_micro: [_, десяти, сто]
|
17
|
-
integral:
|
18
|
-
one: цiла
|
19
|
-
few: цiлих
|
20
|
-
many: цiлих
|
7
|
+
teens: [_, одинадцять, дванадцять, тринадцять, чотирнадцять, п’ятнадцять, шiстнадцять, сiмнадцять, вiсiмнадцять, дев’ятнадцять]
|
8
|
+
tens: [_, десять, двадцять, тридцять, сорок, п’ятдесят, шiстдесят, сiмдесят, вiсiмдесят, дев’яносто]
|
9
|
+
hundreds: [_, сто, двiстi, триста, чотириста, п’ятсот, шiстсот, сiмсот, вiсiмсот, дев’ятсот]
|
10
|
+
mega: [_, thousands, millions, billions, trillions, quadrillions, quintillion, sextillions, septillions, octillions, nonillions, decillions]
|
21
11
|
thousands:
|
22
12
|
one: тисяча
|
23
13
|
few: тисячi
|
@@ -62,4 +52,38 @@ ua:
|
|
62
52
|
one: децильйон
|
63
53
|
few: децильйона
|
64
54
|
many: децильйонiв
|
65
|
-
|
55
|
+
integral:
|
56
|
+
one: цiла
|
57
|
+
few: цiлих
|
58
|
+
many: цiлих
|
59
|
+
micro: [_, tenths, hundredths, thousandths, millionths, billionths, trillionths]
|
60
|
+
tenths:
|
61
|
+
one: десята
|
62
|
+
few: десятих
|
63
|
+
many: десятих
|
64
|
+
hundredths:
|
65
|
+
one: сота
|
66
|
+
few: сотих
|
67
|
+
many: сотих
|
68
|
+
thousandths:
|
69
|
+
one: тысячна
|
70
|
+
few: тисячних
|
71
|
+
many: тисячних
|
72
|
+
millionths:
|
73
|
+
one: мiльйонна
|
74
|
+
few: мiльйонних
|
75
|
+
many: мiльйонних
|
76
|
+
billionths:
|
77
|
+
one: мiльярдна
|
78
|
+
few: мiльярдних
|
79
|
+
many: мiльярдних
|
80
|
+
trillionths:
|
81
|
+
one: трильйонна
|
82
|
+
few: трильйонних
|
83
|
+
many: трильйонних
|
84
|
+
micro_separator: 'i'
|
85
|
+
micro_prefix:
|
86
|
+
tens: десяти
|
87
|
+
hundreds: сто
|
88
|
+
union: ' '
|
89
|
+
union: 'i'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
vi:
|
2
|
+
numbers:
|
3
|
+
ones: ['không', 'một', 'hai', 'ba', 'bốn', 'năm', 'sáu', 'bảy', 'tám', 'chín']
|
4
|
+
teens: [_, 'mười một', 'mười hai', 'mười ba', 'mười bốn', 'mười lăm', 'mười sáu', 'mười bảy', 'thứ mười tám', 'mười chín']
|
5
|
+
tens: [_, 'mười', 'hai mươi', 'ba mươi', 'bốn mươi', 'năm mươi', 'sáu mươi', 'bảy mươi', 'tám mươi', 'chín mươi']
|
6
|
+
hundreds: 'trăm'
|
7
|
+
mega: [_, 'nghìn', 'triệu', 'tỷ', 'nghìn tỷ', 'triệu tỷ']
|
8
|
+
units:
|
9
|
+
tens:
|
10
|
+
one: 'mốt'
|
11
|
+
five: 'lăm'
|
12
|
+
ones_union: 'linh'
|
13
|
+
micro_separator: 'phẩy'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'numbers_and_words/i18n/plurals/cs'
|
2
4
|
require 'numbers_and_words/i18n/plurals/ru'
|
3
5
|
require 'numbers_and_words/i18n/plurals/ua'
|
@@ -12,7 +14,7 @@ module NumbersAndWords
|
|
12
14
|
|
13
15
|
def init
|
14
16
|
::I18n.load_path << config_file
|
15
|
-
::I18n::Backend::Simple.
|
17
|
+
::I18n::Backend::Simple.include ::I18n::Backend::Pluralization
|
16
18
|
end
|
17
19
|
|
18
20
|
def files
|
@@ -1,31 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Cs
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = lambda do |
|
8
|
-
if one_conditions(
|
9
|
+
RULE = lambda do |number|
|
10
|
+
if one_conditions(number)
|
9
11
|
:one
|
10
|
-
elsif few_conditions(
|
12
|
+
elsif few_conditions(number)
|
11
13
|
:few
|
12
|
-
elsif many_conditions(
|
14
|
+
elsif many_conditions(number)
|
13
15
|
:many
|
14
16
|
else
|
15
17
|
:other
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
def one_conditions(
|
20
|
-
|
21
|
+
def one_conditions(number)
|
22
|
+
number % 10 == 1 && number % 100 != 11
|
21
23
|
end
|
22
24
|
|
23
|
-
def few_conditions(
|
24
|
-
[2, 3, 4].include?(
|
25
|
+
def few_conditions(number)
|
26
|
+
[2, 3, 4].include?(number % 10) &&
|
27
|
+
![12, 13, 14].include?(number % 100)
|
25
28
|
end
|
26
29
|
|
27
|
-
def many_conditions(
|
28
|
-
(
|
30
|
+
def many_conditions(number)
|
31
|
+
(number % 10).zero? ||
|
32
|
+
[5, 6, 7, 8, 9].include?(number % 10) ||
|
33
|
+
[11, 12, 13, 14].include?(number % 100)
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Fr
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = ->(
|
9
|
+
RULE = ->(number) { one_conditions(number) ? :one : :other }
|
8
10
|
|
9
|
-
def one_conditions(
|
10
|
-
|
11
|
+
def one_conditions(number)
|
12
|
+
number % 10 == 1 && number % 100 != 11
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -1,25 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Lt
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = lambda do |
|
8
|
-
if one_conditions(
|
9
|
+
RULE = lambda do |number|
|
10
|
+
if one_conditions(number)
|
9
11
|
:one
|
10
|
-
elsif ones_conditions(
|
12
|
+
elsif ones_conditions(number)
|
11
13
|
:ones
|
12
14
|
else
|
13
15
|
:other
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
|
-
def one_conditions(
|
18
|
-
|
19
|
+
def one_conditions(number)
|
20
|
+
number % 10 == 1 && number % 100 != 11
|
19
21
|
end
|
20
22
|
|
21
|
-
def ones_conditions(
|
22
|
-
[2, 3, 4, 5, 6, 7, 8, 9].include?(
|
23
|
+
def ones_conditions(number)
|
24
|
+
[2, 3, 4, 5, 6, 7, 8, 9].include?(number % 10) &&
|
25
|
+
![12, 13, 14, 15, 16, 17, 18, 19].include?(number % 100)
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Lv
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = ->(
|
9
|
+
RULE = ->(number) { one_conditions(number) ? :one : :other }
|
8
10
|
|
9
|
-
def one_conditions(
|
10
|
-
|
11
|
+
def one_conditions(number)
|
12
|
+
number % 10 == 1 && number % 100 != 11
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -1,31 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module I18n
|
3
5
|
module Plurals
|
4
6
|
module Ru
|
5
7
|
module_function
|
6
8
|
|
7
|
-
RULE = lambda do |
|
8
|
-
if one_conditions(
|
9
|
+
RULE = lambda do |number|
|
10
|
+
if one_conditions(number)
|
9
11
|
:one
|
10
|
-
elsif few_conditions(
|
12
|
+
elsif few_conditions(number)
|
11
13
|
:few
|
12
|
-
elsif many_conditions(
|
14
|
+
elsif many_conditions(number)
|
13
15
|
:many
|
14
16
|
else
|
15
17
|
:other
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
def one_conditions(
|
20
|
-
|
21
|
+
def one_conditions(number)
|
22
|
+
number % 10 == 1 && number % 100 != 11
|
21
23
|
end
|
22
24
|
|
23
|
-
def few_conditions(
|
24
|
-
[2, 3, 4].include?(
|
25
|
+
def few_conditions(number)
|
26
|
+
[2, 3, 4].include?(number % 10) &&
|
27
|
+
![12, 13, 14].include?(number % 100)
|
25
28
|
end
|
26
29
|
|
27
|
-
def many_conditions(
|
28
|
-
(
|
30
|
+
def many_conditions(number)
|
31
|
+
(number % 10).zero? ||
|
32
|
+
[5, 6, 7, 8, 9].include?(number % 10) ||
|
33
|
+
[11, 12, 13, 14].include?(number % 100)
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'numbers_and_words/strategies/array_joiner/languages/families/base'
|
2
4
|
|
3
5
|
require 'numbers_and_words/strategies/array_joiner/languages/base'
|
@@ -11,6 +13,7 @@ require 'numbers_and_words/strategies/array_joiner/languages/ru'
|
|
11
13
|
require 'numbers_and_words/strategies/array_joiner/languages/ua'
|
12
14
|
require 'numbers_and_words/strategies/array_joiner/languages/pt-BR'
|
13
15
|
require 'numbers_and_words/strategies/array_joiner/languages/cs'
|
16
|
+
require 'numbers_and_words/strategies/array_joiner/languages/vi'
|
14
17
|
|
15
18
|
module NumbersAndWords
|
16
19
|
module Strategies
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Strategies
|
3
5
|
module ArrayJoiner
|
@@ -8,7 +10,7 @@ module NumbersAndWords
|
|
8
10
|
end
|
9
11
|
|
10
12
|
def union_element
|
11
|
-
@elements.first.empty? ? "#{
|
13
|
+
@elements.first.empty? ? "#{micro_separator} " : super
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Strategies
|
3
5
|
module ArrayJoiner
|
@@ -9,11 +11,11 @@ module NumbersAndWords
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def union_element
|
12
|
-
|
14
|
+
micro_separator.empty? ? ' ' : " #{micro_separator} "
|
13
15
|
end
|
14
16
|
|
15
|
-
def
|
16
|
-
options[:
|
17
|
+
def micro_separator
|
18
|
+
options[:micro_separator] || @translations.micro_separator || ''
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|