numbers_and_words 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +10 -0
  3. data/lib/numbers_and_words/i18n/locales/numbers.cs.yml +37 -26
  4. data/lib/numbers_and_words/i18n/locales/numbers.de.yml +5 -4
  5. data/lib/numbers_and_words/i18n/locales/numbers.en-GB.yml +24 -8
  6. data/lib/numbers_and_words/i18n/locales/numbers.en.yml +10 -6
  7. data/lib/numbers_and_words/i18n/locales/numbers.es.yml +6 -5
  8. data/lib/numbers_and_words/i18n/locales/numbers.et.yml +4 -4
  9. data/lib/numbers_and_words/i18n/locales/numbers.fr.yml +45 -41
  10. data/lib/numbers_and_words/i18n/locales/numbers.hu.yml +11 -7
  11. data/lib/numbers_and_words/i18n/locales/numbers.it.yml +3 -3
  12. data/lib/numbers_and_words/i18n/locales/numbers.ka.yml +6 -14
  13. data/lib/numbers_and_words/i18n/locales/numbers.lt.yml +4 -5
  14. data/lib/numbers_and_words/i18n/locales/numbers.lv.yml +4 -5
  15. data/lib/numbers_and_words/i18n/locales/numbers.nl.yml +4 -3
  16. data/lib/numbers_and_words/i18n/locales/numbers.pt-BR.yml +51 -22
  17. data/lib/numbers_and_words/i18n/locales/numbers.pt.yml +21 -8
  18. data/lib/numbers_and_words/i18n/locales/numbers.ru.yml +39 -27
  19. data/lib/numbers_and_words/i18n/locales/numbers.se.yml +3 -3
  20. data/lib/numbers_and_words/i18n/locales/numbers.tr.yml +3 -3
  21. data/lib/numbers_and_words/i18n/locales/numbers.ua.yml +39 -15
  22. data/lib/numbers_and_words/i18n/locales/numbers.vi.yml +13 -0
  23. data/lib/numbers_and_words/strategies/array_joiner/languages.rb +1 -0
  24. data/lib/numbers_and_words/strategies/array_joiner/languages/en-GB.rb +1 -1
  25. data/lib/numbers_and_words/strategies/array_joiner/languages/families/base.rb +3 -3
  26. data/lib/numbers_and_words/strategies/array_joiner/languages/vi.rb +10 -0
  27. data/lib/numbers_and_words/strategies/figures_converter/decorators.rb +1 -0
  28. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/fractional.rb +1 -1
  29. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb +3 -0
  30. data/lib/numbers_and_words/strategies/figures_converter/{languages/families/latin.rb → decorators/vi/base.rb} +3 -4
  31. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb +12 -0
  32. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb +12 -0
  33. data/lib/numbers_and_words/strategies/figures_converter/languages.rb +11 -15
  34. data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +2 -2
  35. data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +2 -4
  36. data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +5 -7
  37. data/lib/numbers_and_words/strategies/figures_converter/languages/en.rb +0 -2
  38. data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +0 -2
  39. data/lib/numbers_and_words/strategies/figures_converter/languages/et.rb +0 -2
  40. data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +10 -12
  41. data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +0 -2
  42. data/lib/numbers_and_words/strategies/figures_converter/languages/it.rb +0 -1
  43. data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +10 -12
  44. data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +6 -12
  45. data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +2 -14
  46. data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +0 -2
  47. data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +1 -3
  48. data/lib/numbers_and_words/strategies/figures_converter/languages/pt.rb +1 -3
  49. data/lib/numbers_and_words/strategies/figures_converter/languages/se.rb +0 -1
  50. data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +2 -4
  51. data/lib/numbers_and_words/strategies/figures_converter/languages/vi.rb +96 -0
  52. data/lib/numbers_and_words/translations.rb +1 -0
  53. data/lib/numbers_and_words/translations/cs.rb +4 -31
  54. data/lib/numbers_and_words/translations/de.rb +3 -3
  55. data/lib/numbers_and_words/translations/en-GB.rb +3 -1
  56. data/lib/numbers_and_words/translations/es.rb +5 -20
  57. data/lib/numbers_and_words/translations/et.rb +2 -7
  58. data/lib/numbers_and_words/translations/extensions/fraction_significance.rb +4 -4
  59. data/lib/numbers_and_words/translations/families/base.rb +3 -3
  60. data/lib/numbers_and_words/translations/families/cyrillic.rb +4 -8
  61. data/lib/numbers_and_words/translations/fr.rb +9 -14
  62. data/lib/numbers_and_words/translations/hu.rb +2 -7
  63. data/lib/numbers_and_words/translations/ka.rb +3 -13
  64. data/lib/numbers_and_words/translations/lt.rb +2 -11
  65. data/lib/numbers_and_words/translations/lv.rb +2 -11
  66. data/lib/numbers_and_words/translations/nl.rb +3 -2
  67. data/lib/numbers_and_words/translations/pt-BR.rb +14 -21
  68. data/lib/numbers_and_words/translations/pt.rb +3 -12
  69. data/lib/numbers_and_words/translations/ru.rb +0 -17
  70. data/lib/numbers_and_words/translations/tr.rb +0 -4
  71. data/lib/numbers_and_words/translations/ua.rb +0 -13
  72. data/lib/numbers_and_words/translations/vi.rb +21 -0
  73. data/lib/numbers_and_words/version.rb +1 -1
  74. metadata +11 -4
@@ -3,23 +3,14 @@ module NumbersAndWords
3
3
  class Pt < Base
4
4
  include NumbersAndWords::Translations::Families::Latin
5
5
 
6
- def tens(numbers, options = {})
7
- options[:alone] = true if options[:alone].nil?
8
- options[:alone] ? super(numbers) : "#{t(:union)} " + super(numbers)
9
- end
10
-
11
6
  def tens_with_ones(numbers, _options = {})
12
- [tens(numbers[1]), " #{t(:union)} ", ones(numbers[0])].join
7
+ super numbers, separator: " #{union} "
13
8
  end
14
9
 
15
10
  def hundreds(number, options = {})
16
11
  return t(:one_hundred) if options[:is_one_hundred]
17
- options[:is_hundred] ? t(:hundreds)[number - 1] : t(:hundreds)[number - 1] + ' e'
18
- end
19
-
20
- def megs(capacity, options = {})
21
- options[:is_one] = false if options[:is_one].nil?
22
- options[:is_one] ? t(:mega)[capacity] : t(:megas)[capacity]
12
+ return t(:hundreds)[number] if options[:is_hundred]
13
+ [t(:hundreds)[number], union].join(' ')
23
14
  end
24
15
  end
25
16
  end
@@ -3,23 +3,6 @@ module NumbersAndWords
3
3
  class Ru < Base
4
4
  include NumbersAndWords::Translations::Families::Cyrillic
5
5
  include NumbersAndWords::Translations::Extensions::FractionSignificance
6
-
7
- def micros(capacity, number = nil, separator = ' ')
8
- micro, prefix = capacity
9
- micros = t(:micro, count: number)[micro]
10
- [micro_prefix(prefix), micros].compact.join separator
11
- end
12
-
13
- def micro_prefix(capacity)
14
- case capacity
15
- when 2 then t(:sub_micro)[2]
16
- when 1 then t(:sub_micro)[1]
17
- end
18
- end
19
-
20
- # def fraction_separator options = {}
21
- # super if options[:with_fractional_separator]
22
- # end
23
6
  end
24
7
  end
25
8
  end
@@ -3,10 +3,6 @@ module NumbersAndWords
3
3
  class Tr < Base
4
4
  include NumbersAndWords::Translations::Families::Latin
5
5
 
6
- def tens_with_ones(numbers, _options = {})
7
- super numbers, separator: ' '
8
- end
9
-
10
6
  def hundreds(number, options = {})
11
7
  if number == 1
12
8
  [t([options[:prefix], :hundreds].join('.'))].join options[:separator] || ' '
@@ -3,19 +3,6 @@ module NumbersAndWords
3
3
  class Ua < Base
4
4
  include NumbersAndWords::Translations::Families::Cyrillic
5
5
  include NumbersAndWords::Translations::Extensions::FractionSignificance
6
-
7
- def micros(capacity, number = nil, separator = ' ')
8
- micro, prefix = capacity
9
- micros = t(:micro, count: number)[micro]
10
- [micro_prefix(prefix), micros].compact.join separator
11
- end
12
-
13
- def micro_prefix(capacity)
14
- case capacity
15
- when 2 then t(:sub_micro)[2]
16
- when 1 then t(:sub_micro)[1]
17
- end
18
- end
19
6
  end
20
7
  end
21
8
  end
@@ -0,0 +1,21 @@
1
+ module NumbersAndWords
2
+ module Translations
3
+ class Vi < Base
4
+ include NumbersAndWords::Translations::Families::Latin
5
+ include NumbersAndWords::Translations::Extensions::FractionSignificance
6
+ def ones_of_tens(number, options = {})
7
+ return t(%i[units tens one].join('.')) if number == 1
8
+ return t(%i[units tens five].join('.')) if number == 5
9
+ ones(number, options)
10
+ end
11
+
12
+ def tens_with_ones(numbers, options = {})
13
+ [tens(numbers[1]), ones_of_tens(numbers[0], options)].join options[:separator] || ' '
14
+ end
15
+
16
+ def ones_union(number, options = {})
17
+ [t(:ones_union), ones(number, options)].join options[:separator] || ' '
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module NumbersAndWords
2
- VERSION = '0.11.2'.freeze
2
+ VERSION = '0.11.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numbers_and_words
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Lazarev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-14 00:00:00.000000000 Z
11
+ date: 2017-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -92,6 +92,7 @@ files:
92
92
  - lib/numbers_and_words/i18n/locales/numbers.se.yml
93
93
  - lib/numbers_and_words/i18n/locales/numbers.tr.yml
94
94
  - lib/numbers_and_words/i18n/locales/numbers.ua.yml
95
+ - lib/numbers_and_words/i18n/locales/numbers.vi.yml
95
96
  - lib/numbers_and_words/i18n/pluralization.rb
96
97
  - lib/numbers_and_words/i18n/plurals/cs.rb
97
98
  - lib/numbers_and_words/i18n/plurals/fr.rb
@@ -114,6 +115,7 @@ files:
114
115
  - lib/numbers_and_words/strategies/array_joiner/languages/pt-BR.rb
115
116
  - lib/numbers_and_words/strategies/array_joiner/languages/ru.rb
116
117
  - lib/numbers_and_words/strategies/array_joiner/languages/ua.rb
118
+ - lib/numbers_and_words/strategies/array_joiner/languages/vi.rb
117
119
  - lib/numbers_and_words/strategies/figures_converter.rb
118
120
  - lib/numbers_and_words/strategies/figures_converter/decorators.rb
119
121
  - lib/numbers_and_words/strategies/figures_converter/decorators/base.rb
@@ -153,6 +155,10 @@ files:
153
155
  - lib/numbers_and_words/strategies/figures_converter/decorators/ua/base.rb
154
156
  - lib/numbers_and_words/strategies/figures_converter/decorators/ua/fractional.rb
155
157
  - lib/numbers_and_words/strategies/figures_converter/decorators/ua/integral.rb
158
+ - lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb
159
+ - lib/numbers_and_words/strategies/figures_converter/decorators/vi/base.rb
160
+ - lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb
161
+ - lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb
156
162
  - lib/numbers_and_words/strategies/figures_converter/languages.rb
157
163
  - lib/numbers_and_words/strategies/figures_converter/languages/base.rb
158
164
  - lib/numbers_and_words/strategies/figures_converter/languages/cs.rb
@@ -164,7 +170,6 @@ files:
164
170
  - lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb
165
171
  - lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb
166
172
  - lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb
167
- - lib/numbers_and_words/strategies/figures_converter/languages/families/latin.rb
168
173
  - lib/numbers_and_words/strategies/figures_converter/languages/fr.rb
169
174
  - lib/numbers_and_words/strategies/figures_converter/languages/hu.rb
170
175
  - lib/numbers_and_words/strategies/figures_converter/languages/it.rb
@@ -178,6 +183,7 @@ files:
178
183
  - lib/numbers_and_words/strategies/figures_converter/languages/se.rb
179
184
  - lib/numbers_and_words/strategies/figures_converter/languages/tr.rb
180
185
  - lib/numbers_and_words/strategies/figures_converter/languages/ua.rb
186
+ - lib/numbers_and_words/strategies/figures_converter/languages/vi.rb
181
187
  - lib/numbers_and_words/strategies/figures_converter/options.rb
182
188
  - lib/numbers_and_words/strategies/figures_converter/options/cs.rb
183
189
  - lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb
@@ -234,6 +240,7 @@ files:
234
240
  - lib/numbers_and_words/translations/se.rb
235
241
  - lib/numbers_and_words/translations/tr.rb
236
242
  - lib/numbers_and_words/translations/ua.rb
243
+ - lib/numbers_and_words/translations/vi.rb
237
244
  - lib/numbers_and_words/version.rb
238
245
  - lib/numbers_and_words/wrappers.rb
239
246
  - lib/numbers_and_words/wrappers/float.rb
@@ -258,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
265
  version: '0'
259
266
  requirements: []
260
267
  rubyforge_project:
261
- rubygems_version: 2.6.12
268
+ rubygems_version: 2.6.13
262
269
  signing_key:
263
270
  specification_version: 4
264
271
  summary: Convert numbers to words using I18N.