general_units 0.0.7 → 0.0.9
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/lib/general_units.rb +6 -0
- data/lib/general_units/derivatives/box.rb +5 -10
- data/lib/general_units/helpers/action_view_extension.rb +14 -6
- data/lib/general_units/units/base/measurement.rb +63 -11
- data/lib/general_units/units/base/unit.rb +9 -6
- data/lib/general_units/units/length.rb +9 -9
- data/lib/general_units/units/volume.rb +1 -1
- data/lib/general_units/units/weight.rb +8 -8
- data/lib/general_units/version.rb +1 -1
- data/lib/locales/en.rb +7 -0
- data/lib/locales/en/length.rb +32 -0
- data/lib/locales/en/volume.rb +32 -0
- data/lib/locales/en/weight.rb +30 -0
- data/lib/locales/ru.rb +7 -0
- data/lib/locales/ru/length.rb +32 -0
- data/lib/locales/ru/volume.rb +32 -0
- data/lib/locales/ru/weight.rb +30 -0
- metadata +11 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94037127b1e6a1eb4acb002bf2c6d583c157e469
|
|
4
|
+
data.tar.gz: e8c9f62186a6037583713edc586803b7460fc1b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a9cc0f239fbf93002311fa74b661a63bc35b9fa6f2c456a4e6c46e3c6041f943ca3993c8608024a75848486aeb84dbe2e5145d4fb21ef34843ac131b391aa881
|
|
7
|
+
data.tar.gz: 248a9b76e102a027bcc7aeaf22f00433a587a961294aa2e31d2120c7151d2529763bbc1e82796cfb35ded6a85793b7a25bfcee72b762513ac56708ac53be853f
|
data/lib/general_units.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "i18n"
|
|
1
2
|
require "general_units/version"
|
|
2
3
|
|
|
3
4
|
module GeneralUnits
|
|
@@ -6,6 +7,7 @@ module GeneralUnits
|
|
|
6
7
|
load_units!
|
|
7
8
|
load_numeric!
|
|
8
9
|
load_derivatives!
|
|
10
|
+
load_locales!
|
|
9
11
|
require 'general_units/engine'
|
|
10
12
|
require 'general_units/railtie'
|
|
11
13
|
end
|
|
@@ -29,6 +31,10 @@ module GeneralUnits
|
|
|
29
31
|
def self.load_derivatives!
|
|
30
32
|
require 'general_units/derivatives/box'
|
|
31
33
|
end
|
|
34
|
+
|
|
35
|
+
def self.load_locales!
|
|
36
|
+
I18n.load_path += Dir[ File.join(File.dirname(__FILE__), 'locales', '**', '*.{rb,yml}') ]
|
|
37
|
+
end
|
|
32
38
|
|
|
33
39
|
end
|
|
34
40
|
|
|
@@ -43,16 +43,11 @@ module GeneralUnits
|
|
|
43
43
|
Box.new(*values.map {|v| v.convert_to(unit).amount}, unit)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
def to_s(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if block_given?
|
|
52
|
-
yield to_s(round), unit
|
|
53
|
-
else
|
|
54
|
-
"#{to_s(round)} #{unit.short}"
|
|
55
|
-
end
|
|
46
|
+
def to_s(*args)
|
|
47
|
+
options = args.extract_options!
|
|
48
|
+
value = values.map {|d| d.rounded(options[:round])}.join("x")
|
|
49
|
+
unit_string = unit.to_s(options.merge(:count => values.last.rounded), :format => :short)
|
|
50
|
+
"#{value} #{unit_string}"
|
|
56
51
|
end
|
|
57
52
|
|
|
58
53
|
def to_volume
|
|
@@ -5,13 +5,21 @@ module GeneralUnits
|
|
|
5
5
|
|
|
6
6
|
included do
|
|
7
7
|
end
|
|
8
|
-
|
|
9
|
-
def weight_units_for_select
|
|
10
|
-
Weight.
|
|
8
|
+
|
|
9
|
+
def weight_units_for_select(*args)
|
|
10
|
+
Weight.select_units(*args).map {|u| [u.to_s, u.code]}
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
def
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
def short_weight_units_for_select(*args)
|
|
14
|
+
Weight.select_units(*args).map {|u| [u.to_s(:format => :short), u.code]}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def length_units_for_select(*args)
|
|
18
|
+
Length.select_units(*args).map {|u| [u.to_s, u.code]}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def short_length_units_for_select(*args)
|
|
22
|
+
Length.select_units(*args).map {|u| [u.to_s(:format => :short), u.code]}
|
|
15
23
|
end
|
|
16
24
|
|
|
17
25
|
end
|
|
@@ -13,24 +13,54 @@ module GeneralUnits
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
def self.i18n_scope_key
|
|
17
|
+
'general_units'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.i18n_class_key
|
|
21
|
+
"#{i18n_scope_key}.#{name.demodulize.underscore}"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.i18n_format_key(format = nil)
|
|
25
|
+
[i18n_class_key, :formats, format].compact.join(".")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.i18n_key(*args)
|
|
29
|
+
key = args.first
|
|
30
|
+
options = args.extract_options!
|
|
31
|
+
options[:locale] ||= I18n.locale
|
|
32
|
+
begin
|
|
33
|
+
I18n.t("#{i18n_format_key(options[:format])}.#{key}", options.merge(:raise => true))
|
|
34
|
+
rescue
|
|
35
|
+
begin
|
|
36
|
+
I18n.t("#{i18n_class_key}.#{key}", options.merge(:raise => true))
|
|
37
|
+
rescue
|
|
38
|
+
I18n.t("#{i18n_scope_key}.#{key}", options)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def i18n_delimeter(options = {})
|
|
44
|
+
self.class.i18n_key(:delimeter, options)
|
|
45
|
+
end
|
|
46
|
+
|
|
16
47
|
def attributes
|
|
17
48
|
{:amount => amount, :unit => unit}
|
|
18
49
|
end
|
|
19
50
|
|
|
20
|
-
def to_s(
|
|
21
|
-
|
|
51
|
+
def to_s(*args)
|
|
52
|
+
options = args.extract_options!
|
|
53
|
+
value = "#{rounded(options[:round])}".gsub(".", i18n_delimeter(options))
|
|
54
|
+
unit_string = unit.to_s({:count => rounded(options[:round]), :format => :short}.merge(options))
|
|
55
|
+
"#{value} #{unit_string}"
|
|
22
56
|
end
|
|
23
57
|
|
|
24
|
-
def
|
|
25
|
-
|
|
58
|
+
def rounded(round = nil)
|
|
59
|
+
to_f.divmod(1).last == 0 ? to_f.round(0) : to_f.round(round||2)
|
|
26
60
|
end
|
|
27
|
-
|
|
28
|
-
def
|
|
29
|
-
|
|
30
|
-
yield to_s(round), unit
|
|
31
|
-
else
|
|
32
|
-
"#{to_s(round)} #{unit.short}"
|
|
33
|
-
end
|
|
61
|
+
|
|
62
|
+
def inspect
|
|
63
|
+
"<#{self.class.name} amount=#{to_f} unit=#{unit.code}>"
|
|
34
64
|
end
|
|
35
65
|
|
|
36
66
|
### ARITHMETICS START ###
|
|
@@ -162,6 +192,28 @@ module GeneralUnits
|
|
|
162
192
|
end
|
|
163
193
|
### ARITHMETICS END ###
|
|
164
194
|
|
|
195
|
+
### SELECT UNITS START ###
|
|
196
|
+
|
|
197
|
+
def self.select_units(*args)
|
|
198
|
+
options = args.extract_options!
|
|
199
|
+
systems = Array(options[:system]).map(&:to_sym)
|
|
200
|
+
only = Array(options[:only]).map(&:to_sym)
|
|
201
|
+
except = Array(options[:except]).map(&:to_sym)
|
|
202
|
+
list = (Array(args.first) if args.first)||self.units
|
|
203
|
+
if systems.present?
|
|
204
|
+
list = list.select {|u| u.system.in?(systems)}
|
|
205
|
+
end
|
|
206
|
+
if only.present?
|
|
207
|
+
list = list.select {|u| u.code.in?(only)}
|
|
208
|
+
end
|
|
209
|
+
if except.present?
|
|
210
|
+
list = list.select {|u| !u.code.in?(except)}
|
|
211
|
+
end
|
|
212
|
+
list
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
### SELECT UNITS END ###
|
|
216
|
+
|
|
165
217
|
private
|
|
166
218
|
|
|
167
219
|
def valid_amount(other_object)
|
|
@@ -3,12 +3,12 @@ module GeneralUnits
|
|
|
3
3
|
class Unit
|
|
4
4
|
METRIC_SYSTEMS = [:metric, :english, :american]
|
|
5
5
|
|
|
6
|
-
attr_reader :
|
|
6
|
+
attr_reader :owner_class, :code, :fractional, :system
|
|
7
|
+
delegate :i18n_key, :to => :owner_class
|
|
7
8
|
|
|
8
|
-
def initialize(
|
|
9
|
+
def initialize(owner_class, code, fractional, system = :metric)
|
|
10
|
+
@owner_class = owner_class
|
|
9
11
|
@code = code
|
|
10
|
-
@name = name.to_s
|
|
11
|
-
@short = short.to_s
|
|
12
12
|
@fractional = fractional.to_d
|
|
13
13
|
@system = system.to_sym
|
|
14
14
|
METRIC_SYSTEMS.each do |s|
|
|
@@ -20,8 +20,11 @@ module GeneralUnits
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def to_s
|
|
24
|
-
|
|
23
|
+
def to_s(*args)
|
|
24
|
+
options = args.extract_options!
|
|
25
|
+
options[:format] ||= :long
|
|
26
|
+
options[:count] ||= 1
|
|
27
|
+
i18n_key(code.to_sym, options)
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
def inspect
|
|
@@ -5,15 +5,15 @@ module GeneralUnits
|
|
|
5
5
|
alias :millimeters :fractional
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
self.units = [Unit.new(:mile_nautical,
|
|
9
|
-
Unit.new(:mile,
|
|
10
|
-
Unit.new(:yard,
|
|
11
|
-
Unit.new(:foot,
|
|
12
|
-
Unit.new(:inch,
|
|
13
|
-
Unit.new(:kilometer,
|
|
14
|
-
Unit.new(:meter,
|
|
15
|
-
Unit.new(:centimeter,
|
|
16
|
-
Unit.new(:millimeter,
|
|
8
|
+
self.units = [Unit.new(self, :mile_nautical, 1852000.0, :english),
|
|
9
|
+
Unit.new(self, :mile, 1609344.0, :english),
|
|
10
|
+
Unit.new(self, :yard, 914.4, :english),
|
|
11
|
+
Unit.new(self, :foot, 304.8, :english),
|
|
12
|
+
Unit.new(self, :inch, 25.4, :english),
|
|
13
|
+
Unit.new(self, :kilometer, 1000000.0),
|
|
14
|
+
Unit.new(self, :meter, 1000.0),
|
|
15
|
+
Unit.new(self, :centimeter, 10.0),
|
|
16
|
+
Unit.new(self, :millimeter, 1.0)]
|
|
17
17
|
|
|
18
18
|
def convert_to(unit)
|
|
19
19
|
if convert_unit = valid_unit?(unit)
|
|
@@ -6,7 +6,7 @@ module GeneralUnits
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
self.units = Length.units.map do |unit|
|
|
9
|
-
Unit.new("cubic_#{unit.code}",
|
|
9
|
+
Unit.new(self, :"cubic_#{unit.code}", unit.fractional**3, unit.system)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def convert_to(unit)
|
|
@@ -5,14 +5,14 @@ module GeneralUnits
|
|
|
5
5
|
alias :grams :fractional
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
self.units = [Unit.new(:short_ton_us,
|
|
9
|
-
Unit.new(:pound_us,
|
|
10
|
-
Unit.new(:ounce_us,
|
|
11
|
-
Unit.new(:stone,
|
|
12
|
-
Unit.new(:long_ton_uk,
|
|
13
|
-
Unit.new(:metric_ton,
|
|
14
|
-
Unit.new(:kilogram,
|
|
15
|
-
Unit.new(:gram,
|
|
8
|
+
self.units = [Unit.new(self, :short_ton_us, 907184.74, :american),
|
|
9
|
+
Unit.new(self, :pound_us, 453.59237, :american),
|
|
10
|
+
Unit.new(self, :ounce_us, 28.349523, :american),
|
|
11
|
+
Unit.new(self, :stone, 6350.2932, :english),
|
|
12
|
+
Unit.new(self, :long_ton_uk, 1016046.9, :english),
|
|
13
|
+
Unit.new(self, :metric_ton, 1000000.0),
|
|
14
|
+
Unit.new(self, :kilogram, 1000.0),
|
|
15
|
+
Unit.new(self, :gram, 1.0)]
|
|
16
16
|
|
|
17
17
|
def convert_to(unit)
|
|
18
18
|
if convert_unit = valid_unit?(unit)
|
data/lib/locales/en.rb
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
:en => {
|
|
3
|
+
:general_units => {
|
|
4
|
+
:length => {
|
|
5
|
+
:formats => {
|
|
6
|
+
:long => {
|
|
7
|
+
:mile_nautical => {:zero => "miles (nautical)", :one => "mile (nautical)", :two => "miles (nautical)", :few => "miles (nautical)", :many => "miles (nautical)", :other => "miles (nautical)"},
|
|
8
|
+
:mile => {:zero => "miles", :one => "mile", :two => "miles", :few => "miles", :many => "miles", :other => "miles"},
|
|
9
|
+
:yard => {:zero => "yards", :one => "yard", :two => "yards", :few => "yards", :many => "yards", :other => "yards"},
|
|
10
|
+
:foot => {:zero => "feet", :one => "foot", :two => "feet", :few => "feet", :many => "feet", :other => "feet"},
|
|
11
|
+
:inch => {:zero => "inches", :one => "inch", :two => "inches", :few => "inches", :many => "inches", :other => "inches"},
|
|
12
|
+
:kilometer => {:zero => "kilometers", :one => "kilometer", :two => "kilometers", :few => "kilometers", :many => "kilometers", :other => "kilometers"},
|
|
13
|
+
:meter => {:zero => "meters", :one => "meter", :two => "meters", :few => "meters", :many => "meters", :other => "meters"},
|
|
14
|
+
:centimeter => {:zero => "centimeters", :one => "centimeter", :two => "centimeters", :few => "centimeters", :many => "centimeters", :other => "centimeters"},
|
|
15
|
+
:millimeter => {:zero => "millimeters", :one => "millimeter", :two => "millimeters", :few => "millimeters", :many => "millimeters", :other => "millimeters"}
|
|
16
|
+
},
|
|
17
|
+
:short => {
|
|
18
|
+
:mile_nautical=> {:zero => "mln", :one => "mln", :two => "mln", :few => "mln", :many => "mln", :other => "mln"},
|
|
19
|
+
:mile => {:zero => "ml", :one => "ml", :two => "ml", :few => "ml", :many => "ml", :other => "ml"},
|
|
20
|
+
:yard => {:zero => "yrd", :one => "yrd", :two => "yrd", :few => "yrd", :many => "yrd", :other => "yrd"},
|
|
21
|
+
:foot => {:zero => "ft", :one => "ft", :two => "ft", :few => "ft", :many => "ft", :other => "ft"},
|
|
22
|
+
:inch => {:zero => "in", :one => "in", :two => "in", :few => "in", :many => "in", :other => "in"},
|
|
23
|
+
:kilometer => {:zero => "km", :one => "km", :two => "km", :few => "km", :many => "km", :other => "km"},
|
|
24
|
+
:meter => {:zero => "m", :one => "m", :two => "m", :few => "m", :many => "m", :other => "m"},
|
|
25
|
+
:centimeter => {:zero => "cm", :one => "cm", :two => "cm", :few => "cm", :many => "cm", :other => "cm"},
|
|
26
|
+
:millimeter => {:zero => "mm", :one => "mm", :two => "mm", :few => "mm", :many => "mm", :other => "mm"}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
:en => {
|
|
3
|
+
:general_units => {
|
|
4
|
+
:volume => {
|
|
5
|
+
:formats => {
|
|
6
|
+
:long => {
|
|
7
|
+
:cubic_mile_nautical => {:zero => "cubic miles (nautical)", :one => "cubic mile (nautical)", :two => "cubic miles (nautical)", :few => "cubic miles (nautical)", :many => "cubic miles (nautical)", :other => "cubic miles (nautical)"},
|
|
8
|
+
:cubic_mile => {:zero => "cubic miles", :one => "cubic mile", :two => "cubic miles", :few => "cubic miles", :many => "cubic miles", :other => "cubic miles"},
|
|
9
|
+
:cubic_yard => {:zero => "cubic yards", :one => "cubic yard", :two => "cubic yards", :few => "cubic yards", :many => "cubic yards", :other => "cubic yards"},
|
|
10
|
+
:cubic_foot => {:zero => "cubic feet", :one => "cubic foot", :two => "cubic feet", :few => "cubic feet", :many => "cubic feet", :other => "cubic feet"},
|
|
11
|
+
:cubic_inch => {:zero => "cubic inches", :one => "cubic inch", :two => "cubic inches", :few => "cubic inches", :many => "cubic inches", :other => "cubic inches"},
|
|
12
|
+
:cubic_kilometer => {:zero => "cubic kilometers", :one => "cubic kilometer", :two => "cubic kilometers", :few => "cubic kilometers", :many => "cubic kilometers", :other => "cubic kilometers"},
|
|
13
|
+
:cubic_meter => {:zero => "cubic meters", :one => "cubic meter", :two => "cubic meters", :few => "cubic meters", :many => "cubic meters", :other => "cubic meters"},
|
|
14
|
+
:cubic_centimeter => {:zero => "cubic centimeters", :one => "cubic centimeter", :two => "cubic centimeters", :few => "cubic centimeters", :many => "cubic centimeters", :other => "cubic centimeters"},
|
|
15
|
+
:cubic_millimeter => {:zero => "cubic millimeters", :one => "cubic millimeter", :two => "cubic millimeters", :few => "cubic millimeters", :many => "cubic millimeters", :other => "cubic millimeters"}
|
|
16
|
+
},
|
|
17
|
+
:short => {
|
|
18
|
+
:cubic_mile_nautical=> {:zero => "mln<sup>3</sup>", :one => "mln<sup>3</sup>", :two => "mln<sup>3</sup>", :few => "mln<sup>3</sup>", :many => "mln<sup>3</sup>", :other => "mln<sup>3</sup>"},
|
|
19
|
+
:cubic_mile => {:zero => "ml<sup>3</sup>", :one => "ml<sup>3</sup>", :two => "ml<sup>3</sup>", :few => "ml<sup>3</sup>", :many => "ml<sup>3</sup>", :other => "ml<sup>3</sup>"},
|
|
20
|
+
:cubic_yard => {:zero => "yrd<sup>3</sup>", :one => "yrd<sup>3</sup>", :two => "yrd<sup>3</sup>", :few => "yrd<sup>3</sup>", :many => "yrd<sup>3</sup>", :other => "yrd<sup>3</sup>"},
|
|
21
|
+
:cubic_foot => {:zero => "ft<sup>3</sup>", :one => "ft<sup>3</sup>", :two => "ft<sup>3</sup>", :few => "ft<sup>3</sup>", :many => "ft<sup>3</sup>", :other => "ft<sup>3</sup>"},
|
|
22
|
+
:cubic_inch => {:zero => "in<sup>3</sup>", :one => "in<sup>3</sup>", :two => "in<sup>3</sup>", :few => "in<sup>3</sup>", :many => "in<sup>3</sup>", :other => "in<sup>3</sup>"},
|
|
23
|
+
:cubic_kilometer => {:zero => "km<sup>3</sup>", :one => "km<sup>3</sup>", :two => "km<sup>3</sup>", :few => "km<sup>3</sup>", :many => "km<sup>3</sup>", :other => "km<sup>3</sup>"},
|
|
24
|
+
:cubic_meter => {:zero => "m<sup>3</sup>", :one => "m<sup>3</sup>", :two => "m<sup>3</sup>", :few => "m<sup>3</sup>", :many => "m<sup>3</sup>", :other => "m<sup>3</sup>"},
|
|
25
|
+
:cubic_centimeter => {:zero => "cm<sup>3</sup>", :one => "cm<sup>3</sup>", :two => "cm<sup>3</sup>", :few => "cm<sup>3</sup>", :many => "cm<sup>3</sup>", :other => "cm<sup>3</sup>"},
|
|
26
|
+
:cubic_millimeter => {:zero => "mm<sup>3</sup>", :one => "mm<sup>3</sup>", :two => "mm<sup>3</sup>", :few => "mm<sup>3</sup>", :many => "mm<sup>3</sup>", :other => "mm<sup>3</sup>"}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
:en => {
|
|
3
|
+
:general_units => {
|
|
4
|
+
:weight => {
|
|
5
|
+
:formats => {
|
|
6
|
+
:long => {
|
|
7
|
+
:short_ton_us => {:zero => "short tons", :one => "short ton", :two => "short tons", :few => "short ton (US)", :many => "short tons", :other => "short tons"},
|
|
8
|
+
:pound_us => {:zero => "pounds", :one => "pound", :two => "pounds", :few => "pounds", :many => "pounds", :other => "pounds"},
|
|
9
|
+
:ounce_us => {:zero => "ounces", :one => "ounce", :two => "ounces", :few => "ounces", :many => "ounces", :other => "ounces"},
|
|
10
|
+
:stone => {:zero => "stones", :one => "stone", :two => "stones", :few => "stones", :many => "stones", :other => "stones"},
|
|
11
|
+
:long_ton_uk => {:zero => "long tons", :one => "long ton", :two => "long tons", :few => "long tons", :many => "long tons", :other => "long tons"},
|
|
12
|
+
:metric_ton => {:zero => "tons", :one => "ton", :two => "tons", :few => "tons", :many => "tons", :other => "tons"},
|
|
13
|
+
:kilogram => {:zero => "kilograms", :one => "kilogram", :two => "kilograms", :few => "kilograms", :many => "kilograms", :other => "kilograms"},
|
|
14
|
+
:gram => {:zero => "grams", :one => "gram", :two => "grams", :few => "grams", :many => "grams", :other => "grams"}
|
|
15
|
+
},
|
|
16
|
+
:short => {
|
|
17
|
+
:short_ton_us => {:zero => "st", :one => "st", :two => "st", :few => "st", :many => "st", :other => "st"},
|
|
18
|
+
:pound_us => {:zero => "pnd", :one => "pnd", :two => "pnd", :few => "pnd", :many => "pnd", :other => "pnd"},
|
|
19
|
+
:ounce_us => {:zero => "ounce", :one => "ounce", :two => "ounce", :few => "ounce", :many => "ounce", :other => "ounce"},
|
|
20
|
+
:stone => {:zero => "stn", :one => "stn", :two => "stn", :few => "stn", :many => "stn", :other => "stn"},
|
|
21
|
+
:long_ton_uk => {:zero => "lt", :one => "lt", :two => "lt", :few => "lt", :many => "lt", :other => "lt"},
|
|
22
|
+
:metric_ton => {:zero => "t", :one => "t", :two => "t", :few => "t", :many => "t", :other => "t"},
|
|
23
|
+
:kilogram => {:zero => "kg", :one => "kg", :two => "kg", :few => "kg", :many => "kg", :other => "kg"},
|
|
24
|
+
:gram => {:zero => "g", :one => "g", :two => "g", :few => "g", :many => "g", :other => "g"}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
data/lib/locales/ru.rb
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
:ru => {
|
|
3
|
+
:general_units => {
|
|
4
|
+
:length => {
|
|
5
|
+
:formats => {
|
|
6
|
+
:long => {
|
|
7
|
+
:mile_nautical => {:zero => "морских миль", :one => "морская миля", :two => "морские мили", :few => "морские мили", :many => "морских миль", :other => "морских миль"},
|
|
8
|
+
:mile => {:zero => "миль", :one => "миля", :two => "мили", :few => "мили", :many => "миль", :other => "миль"},
|
|
9
|
+
:yard => {:zero => "ярдов", :one => "ярд", :two => "ярда", :few => "ярда", :many => "ярдов", :other => "ярдов"},
|
|
10
|
+
:foot => {:zero => "футов", :one => "фут", :two => "фута", :few => "футов", :many => "футов", :other => "футов"},
|
|
11
|
+
:inch => {:zero => "дюймов", :one => "дюйм", :two => "дюйма", :few => "дюйма", :many => "дюймов", :other => "дюймов"},
|
|
12
|
+
:kilometer => {:zero => "километров", :one => "километр", :two => "километра", :few => "километра", :many => "километров", :other => "километров"},
|
|
13
|
+
:meter => {:zero => "метров", :one => "метр", :two => "метра", :few => "метра", :many => "метров", :other => "метров"},
|
|
14
|
+
:centimeter => {:zero => "сантиметров", :one => "сантиметр", :two => "сантиметра", :few => "сантиметра", :many => "сантиметров", :other => "сантиметров"},
|
|
15
|
+
:millimeter => {:zero => "миллиметров", :one => "миллиметр", :two => "миллиметра", :few => "миллиметра", :many => "миллиметров", :other => "миллиметров"}
|
|
16
|
+
},
|
|
17
|
+
:short => {
|
|
18
|
+
:mile_nautical => {:zero => "м.миль", :one => "м.миля", :two => "м.мили", :few => "м.мили", :many => "м.миль", :other => "м.миль"},
|
|
19
|
+
:mile => {:zero => "миль", :one => "миля", :two => "мили", :few => "мили", :many => "миль", :other => "миль"},
|
|
20
|
+
:yard => {:zero => "ярдов", :one => "ярд", :two => "ярда", :few => "ярда", :many => "ярдов", :other => "ярдов"},
|
|
21
|
+
:foot => {:zero => "футов", :one => "фут", :two => "фута", :few => "футов", :many => "футов", :other => "футов"},
|
|
22
|
+
:inch => {:zero => "д", :one => "д", :two => "д", :few => "д", :many => "д", :other => "д"},
|
|
23
|
+
:kilometer => {:zero => "км", :one => "км", :two => "км", :few => "км", :many => "км", :other => "км"},
|
|
24
|
+
:meter => {:zero => "м", :one => "м", :two => "м", :few => "м", :many => "м", :other => "м"},
|
|
25
|
+
:centimeter => {:zero => "см", :one => "см", :two => "см", :few => "см", :many => "см", :other => "см"},
|
|
26
|
+
:millimeter => {:zero => "мм", :one => "мм", :two => "мм", :few => "мм", :many => "мм", :other => "мм"}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
:ru => {
|
|
3
|
+
:general_units => {
|
|
4
|
+
:volume => {
|
|
5
|
+
:formats => {
|
|
6
|
+
:long => {
|
|
7
|
+
:cubic_mile_nautical => {:zero => "куб. морских миль", :one => "куб. морская миля", :two => "куб. морские мили", :few => "куб. морские мили", :many => "куб. морских миль", :other => "куб. морских миль"},
|
|
8
|
+
:cubic_mile => {:zero => "куб. миль", :one => "куб. миля", :two => "куб. мили", :few => "куб. мили", :many => "куб. миль", :other => "куб. миль"},
|
|
9
|
+
:cubic_yard => {:zero => "куб. ярдов", :one => "куб. ярд", :two => "куб. ярда", :few => "куб. ярда", :many => "куб. ярдов", :other => "куб. ярдов"},
|
|
10
|
+
:cubic_foot => {:zero => "куб. футов", :one => "куб. фут", :two => "куб. фута", :few => "куб. футов", :many => "куб. футов", :other => "куб. футов"},
|
|
11
|
+
:cubic_inch => {:zero => "куб. дюймов", :one => "куб. дюйм", :two => "куб. дюйма", :few => "куб. дюйма", :many => "куб. дюймов", :other => "куб. дюймов"},
|
|
12
|
+
:cubic_kilometer => {:zero => "куб. километров", :one => "куб. километр", :two => "куб. километра", :few => "куб. километра", :many => "куб. километров", :other => "куб. километров"},
|
|
13
|
+
:cubic_meter => {:zero => "куб. метров", :one => "куб. метр", :two => "куб. метра", :few => "куб. метра", :many => "куб. метров", :other => "куб. метров"},
|
|
14
|
+
:cubic_centimeter => {:zero => "куб. сантиметров", :one => "куб. сантиметр", :two => "куб. сантиметра", :few => "куб. сантиметра", :many => "куб. сантиметров", :other => "куб. сантиметров"},
|
|
15
|
+
:cubic_millimeter => {:zero => "куб. миллиметров", :one => "куб. миллиметр", :two => "куб. миллиметра", :few => "куб. миллиметра", :many => "куб. миллиметров", :other => "куб. миллиметров"}
|
|
16
|
+
},
|
|
17
|
+
:short => {
|
|
18
|
+
:cubic_mile_nautical=> {:zero => "м.мл<sup>3</sup>", :one => "м.мл<sup>3</sup>", :two => "м.мл<sup>3</sup>", :few => "м.мл<sup>3</sup>", :many => "м.мл<sup>3</sup>", :other => "м.мл<sup>3</sup>"},
|
|
19
|
+
:cubic_mile => {:zero => "мл<sup>3</sup>", :one => "мл<sup>3</sup>", :two => "мл<sup>3</sup>", :few => "мл<sup>3</sup>", :many => "мл<sup>3</sup>", :other => "мл<sup>3</sup>"},
|
|
20
|
+
:cubic_yard => {:zero => "ярд<sup>3</sup>", :one => "ярд<sup>3</sup>", :two => "ярд<sup>3</sup>", :few => "ярд<sup>3</sup>", :many => "ярд<sup>3</sup>", :other => "ярд<sup>3</sup>"},
|
|
21
|
+
:cubic_foot => {:zero => "фут<sup>3</sup>", :one => "фут<sup>3</sup>", :two => "фут<sup>3</sup>", :few => "фут<sup>3</sup>", :many => "фут<sup>3</sup>", :other => "фут<sup>3</sup>"},
|
|
22
|
+
:cubic_inch => {:zero => "д<sup>3</sup>", :one => "д<sup>3</sup>", :two => "д<sup>3</sup>", :few => "д<sup>3</sup>", :many => "д<sup>3</sup>", :other => "д<sup>3</sup>"},
|
|
23
|
+
:cubic_kilometer => {:zero => "км<sup>3</sup>", :one => "км<sup>3</sup>", :two => "км<sup>3</sup>", :few => "км<sup>3</sup>", :many => "км<sup>3</sup>", :other => "км<sup>3</sup>"},
|
|
24
|
+
:cubic_meter => {:zero => "м<sup>3</sup>", :one => "м<sup>3</sup>", :two => "м<sup>3</sup>", :few => "м<sup>3</sup>", :many => "м<sup>3</sup>", :other => "м<sup>3</sup>"},
|
|
25
|
+
:cubic_centimeter => {:zero => "см<sup>3</sup>", :one => "см<sup>3</sup>", :two => "см<sup>3</sup>", :few => "см<sup>3</sup>", :many => "см<sup>3</sup>", :other => "см<sup>3</sup>"},
|
|
26
|
+
:cubic_millimeter => {:zero => "мм<sup>3</sup>", :one => "мм<sup>3</sup>", :two => "мм<sup>3</sup>", :few => "мм<sup>3</sup>", :many => "мм<sup>3</sup>", :other => "мм<sup>3</sup>"}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
:ru => {
|
|
3
|
+
:general_units => {
|
|
4
|
+
:weight => {
|
|
5
|
+
:formats => {
|
|
6
|
+
:long => {
|
|
7
|
+
:short_ton_us => {:zero => "ам.тонн", :one => "ам.тонна", :two => "ам.тонны", :few => "ам.тонны", :many => "ам.тонн", :other => "ам.тонн"},
|
|
8
|
+
:pound_us => {:zero => "фунтов", :one => "фунт", :two => "фунта", :few => "фунта", :many => "фунтов", :other => "фунтов"},
|
|
9
|
+
:ounce_us => {:zero => "унций", :one => "унция", :two => "унции", :few => "унций", :many => "унций", :other => "унций"},
|
|
10
|
+
:stone => {:zero => "стоунов", :one => "стоун", :two => "стоуна", :few => "стоуна", :many => "стоунов", :other => "стоунов"},
|
|
11
|
+
:long_ton_uk => {:zero => "англ.тонн", :one => "англ.тонна", :two => "англ.тонны", :few => "англ.тонны", :many => "англ.тонн", :other => "англ.тонн"},
|
|
12
|
+
:metric_ton => {:zero => "тонн", :one => "тонна", :two => "тонны", :few => "тонны", :many => "тонн", :other => "тонн"},
|
|
13
|
+
:kilogram => {:zero => "килограмм", :one => "килограмм", :two => "килограмма", :few => "килограмма", :many => "килограмм", :other => "килограмм"},
|
|
14
|
+
:gram => {:zero => "грамм", :one => "грамм", :two => "грамма", :few => "грамма", :many => "грамм", :other => "грамм"}
|
|
15
|
+
},
|
|
16
|
+
:short => {
|
|
17
|
+
:short_ton_us => {:zero => "ам.т", :one => "ам.т", :two => "ам.т", :few => "ам.т", :many => "ам.т", :other => "ам.т"},
|
|
18
|
+
:pound_us => {:zero => "фунтов", :one => "фунт", :two => "фунта", :few => "фунта", :many => "фунтов", :other => "фунтов"},
|
|
19
|
+
:ounce_us => {:zero => "ун", :one => "ун", :two => "ун", :few => "ун", :many => "ун", :other => "ун"},
|
|
20
|
+
:stone => {:zero => "ст", :one => "ст", :two => "ст", :few => "ст", :many => "ст", :other => "ст"},
|
|
21
|
+
:long_ton_uk => {:zero => "англ.т", :one => "англ.т", :two => "англ.т", :few => "англ.т", :many => "англ.т", :other => "англ.т"},
|
|
22
|
+
:metric_ton => {:zero => "т", :one => "т", :two => "т", :few => "т", :many => "т", :other => "т"},
|
|
23
|
+
:kilogram => {:zero => "кг", :one => "кг", :two => "кг", :few => "кг", :many => "кг", :other => "кг"},
|
|
24
|
+
:gram => {:zero => "г", :one => "г", :two => "г", :few => "г", :many => "г", :other => "г"}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: general_units
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Valery Kvon
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: i18n
|
|
@@ -52,6 +52,14 @@ files:
|
|
|
52
52
|
- lib/general_units/units/volume.rb
|
|
53
53
|
- lib/general_units/units/weight.rb
|
|
54
54
|
- lib/general_units/version.rb
|
|
55
|
+
- lib/locales/en.rb
|
|
56
|
+
- lib/locales/en/length.rb
|
|
57
|
+
- lib/locales/en/volume.rb
|
|
58
|
+
- lib/locales/en/weight.rb
|
|
59
|
+
- lib/locales/ru.rb
|
|
60
|
+
- lib/locales/ru/length.rb
|
|
61
|
+
- lib/locales/ru/volume.rb
|
|
62
|
+
- lib/locales/ru/weight.rb
|
|
55
63
|
homepage: http://vkvon.ru/projects/general_units
|
|
56
64
|
licenses:
|
|
57
65
|
- MIT
|
|
@@ -72,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
80
|
version: '0'
|
|
73
81
|
requirements: []
|
|
74
82
|
rubyforge_project: general_units
|
|
75
|
-
rubygems_version: 2.
|
|
83
|
+
rubygems_version: 2.5.1
|
|
76
84
|
signing_key:
|
|
77
85
|
specification_version: 4
|
|
78
86
|
summary: Weight Length Power and other general units
|