ruby-cldr 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/Gemfile.lock +23 -0
- data/README.textile +9 -6
- data/VERSION +1 -1
- data/lib/cldr.rb +1 -1
- data/lib/cldr/data.rb +9 -29
- data/lib/cldr/download.rb +2 -2
- data/lib/cldr/export.rb +8 -2
- data/lib/cldr/export/code.rb +34 -0
- data/lib/cldr/export/code/numbers.rb +29 -0
- data/lib/cldr/export/data.rb +36 -0
- data/lib/cldr/export/data/base.rb +61 -0
- data/lib/cldr/export/data/calendars.rb +14 -0
- data/lib/cldr/export/data/calendars/gregorian.rb +142 -0
- data/lib/cldr/export/data/currencies.rb +28 -0
- data/lib/cldr/export/data/delimiters.rb +29 -0
- data/lib/cldr/export/data/languages.rb +19 -0
- data/lib/cldr/export/data/numbers.rb +67 -0
- data/lib/cldr/export/data/plurals.rb +41 -0
- data/lib/cldr/{data → export/data}/plurals/cldr_grammar.treetop +0 -0
- data/lib/cldr/export/data/plurals/grammar.rb +538 -0
- data/lib/cldr/export/data/plurals/rules.rb +119 -0
- data/lib/cldr/export/data/territories.rb +19 -0
- data/lib/cldr/export/data/timezones.rb +27 -0
- data/lib/cldr/export/data/units.rb +29 -0
- data/lib/cldr/export/ruby.rb +1 -1
- data/lib/cldr/export/yaml.rb +1 -1
- data/lib/cldr/format.rb +1 -97
- data/lib/cldr/format/currency.rb +1 -1
- data/lib/cldr/format/date.rb +1 -1
- data/lib/cldr/format/datetime.rb +14 -18
- data/lib/cldr/format/datetime/base.rb +1 -1
- data/lib/cldr/format/decimal.rb +1 -1
- data/lib/cldr/format/decimal/base.rb +1 -1
- data/lib/cldr/format/decimal/fraction.rb +1 -1
- data/lib/cldr/format/decimal/integer.rb +1 -1
- data/lib/cldr/format/decimal/number.rb +1 -1
- data/lib/cldr/format/percent.rb +1 -1
- data/lib/cldr/format/time.rb +1 -1
- data/lib/cldr/thor.rb +3 -3
- data/test/all.rb +1 -1
- data/test/export/code/numbers_test.rb +11 -0
- data/test/{data → export/data}/all.rb +1 -1
- data/test/{data → export/data}/calendars_test.rb +18 -18
- data/test/{data → export/data}/currencies_test.rb +6 -6
- data/test/{data → export/data}/delimiters_test.rb +6 -6
- data/test/{data → export/data}/languages_test.rb +6 -6
- data/test/{data → export/data}/numbers_test.rb +8 -8
- data/test/export/data/plurals_test.rb +141 -0
- data/test/{data → export/data}/territories_test.rb +6 -6
- data/test/{data → export/data}/timezones_test.rb +6 -6
- data/test/{data → export/data}/units_test.rb +6 -6
- data/test/export_test.rb +8 -8
- data/test/{formats → format}/all.rb +1 -1
- data/test/format/currency_test.rb +0 -0
- data/test/format/date_test.rb +265 -0
- data/test/format/datetime_test.rb +18 -0
- data/test/{formats → format}/decimal/fraction_test.rb +4 -4
- data/test/{formats → format}/decimal/integer_test.rb +17 -17
- data/test/{formats → format}/decimal/number_test.rb +19 -19
- data/test/{formats → format}/decimal_test.rb +5 -5
- data/test/format/percent_test.rb +0 -0
- data/test/format/time_test.rb +195 -0
- data/test/test_autotest.rb +36 -0
- data/test/test_helper.rb +16 -1
- metadata +124 -114
- data/lib/cldr/data/base.rb +0 -66
- data/lib/cldr/data/calendars.rb +0 -12
- data/lib/cldr/data/calendars/gregorian.rb +0 -124
- data/lib/cldr/data/currencies.rb +0 -26
- data/lib/cldr/data/delimiters.rb +0 -21
- data/lib/cldr/data/languages.rb +0 -17
- data/lib/cldr/data/numbers.rb +0 -60
- data/lib/cldr/data/plurals.rb +0 -39
- data/lib/cldr/data/plurals/grammar.rb +0 -536
- data/lib/cldr/data/plurals/rules.rb +0 -113
- data/lib/cldr/data/territories.rb +0 -17
- data/lib/cldr/data/timezones.rb +0 -25
- data/lib/cldr/data/units.rb +0 -25
- data/test/data/plurals_test.rb +0 -132
- data/test/formats/datetime/all.rb +0 -3
- data/test/formats/datetime/date_test.rb +0 -31
- data/test/formats/datetime/datetime_test.rb +0 -18
- data/test/formats/datetime/day_test.rb +0 -41
- data/test/formats/datetime/hour_test.rb +0 -79
- data/test/formats/datetime/minute_test.rb +0 -25
- data/test/formats/datetime/month_test.rb +0 -76
- data/test/formats/datetime/period_test.rb +0 -20
- data/test/formats/datetime/quarter_test.rb +0 -118
- data/test/formats/datetime/second_test.rb +0 -80
- data/test/formats/datetime/time_test.rb +0 -33
- data/test/formats/datetime/timezone_test.rb +0 -23
- data/test/formats/datetime/year_test.rb +0 -57
- data/test/formats/format_test.rb +0 -66
- data/test/formats/rails_compat/all.rb +0 -3
- data/test/formats/rails_compat/format_integer_test.rb +0 -56
- data/test/formats/rails_compat/format_number_test.rb +0 -134
@@ -1,56 +0,0 @@
|
|
1
|
-
# # encoding: utf-8
|
2
|
-
# require File.dirname(__FILE__) + '/../../test_helper'
|
3
|
-
#
|
4
|
-
# class TestCldrFormatIntegerRailsCompat < Test::Unit::TestCase
|
5
|
-
# def setup
|
6
|
-
# @options = { :decimal => ".", :group => ",", :format => "#,##0.###" }
|
7
|
-
# end
|
8
|
-
#
|
9
|
-
# def format_integer(number, options = {})
|
10
|
-
# Cldr::Format.format_integer(number, @options.merge(options))
|
11
|
-
# end
|
12
|
-
#
|
13
|
-
# define_method :"test: compatible with number_with_delimiter: 12345678 => 12,345,678" do
|
14
|
-
# assert_equal '12,345,678', format_integer(12345678)
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# define_method :"test: compatible with number_with_delimiter: 0 => 0" do
|
18
|
-
# assert_equal '0', format_integer(0)
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
# define_method :"test: compatible with number_with_delimiter: 123 => 123" do
|
22
|
-
# assert_equal '123', format_integer(123)
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
# define_method :"test: compatible with number_with_delimiter: 123456 => 123,456" do
|
26
|
-
# assert_equal '123,456', format_integer(123456)
|
27
|
-
# end
|
28
|
-
#
|
29
|
-
# define_method :"test: NOT compatible with number_with_delimiter: 123456.78 => 123,457" do
|
30
|
-
# assert_equal '123,457', format_integer(123456.78)
|
31
|
-
# end
|
32
|
-
#
|
33
|
-
# define_method :"test: NOT compatible with number_with_delimiter: 123456.789 => 123,457" do
|
34
|
-
# assert_equal '123,457', format_integer(123456.789)
|
35
|
-
# end
|
36
|
-
#
|
37
|
-
# define_method :"test: NOT compatible with number_with_delimiter: 123456.78901 => 123,457" do
|
38
|
-
# assert_equal '123,457', format_integer(123456.78901)
|
39
|
-
# end
|
40
|
-
#
|
41
|
-
# define_method :"test: NOT compatible with number_with_delimiter: 123456789.78901 => 123,456,790" do
|
42
|
-
# assert_equal '123,456,790', format_integer(123456789.78901)
|
43
|
-
# end
|
44
|
-
#
|
45
|
-
# define_method :"test: NOT compatible with number_with_delimiter: 0.78901 => 0" do
|
46
|
-
# assert_equal '1', format_integer(0.78901)
|
47
|
-
# end
|
48
|
-
#
|
49
|
-
# define_method :"test: compatible with number_with_delimiter: 'x' => 'x'" do
|
50
|
-
# assert_equal 'x', format_integer('x')
|
51
|
-
# end
|
52
|
-
#
|
53
|
-
# define_method :"test: compatible with number_with_delimiter: nil => nil" do
|
54
|
-
# assert_nil format_integer(nil)
|
55
|
-
# end
|
56
|
-
# end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
# # encoding: utf-8
|
2
|
-
# require File.dirname(__FILE__) + '/../../test_helper'
|
3
|
-
#
|
4
|
-
# class TestCldrFormatRailsCompat < Test::Unit::TestCase
|
5
|
-
# def setup
|
6
|
-
# @options = { :decimal => ".", :group => ",", :format => "#,##0.###" }
|
7
|
-
# end
|
8
|
-
#
|
9
|
-
# def format_number(number, options = {})
|
10
|
-
# Cldr::Format.format_number(number, @options.merge(options))
|
11
|
-
# end
|
12
|
-
#
|
13
|
-
# # number_with_delimiter assertions:
|
14
|
-
# #
|
15
|
-
# # assert_equal("12,345,678", number_with_delimiter(12345678))
|
16
|
-
# # assert_equal("0", number_with_delimiter(0))
|
17
|
-
# # assert_equal("123", number_with_delimiter(123))
|
18
|
-
# # assert_equal("123,456", number_with_delimiter(123456))
|
19
|
-
# # assert_equal("123,456.78", number_with_delimiter(123456.78))
|
20
|
-
# # assert_equal("123,456.789", number_with_delimiter(123456.789))
|
21
|
-
# # assert_equal("123,456.78901", number_with_delimiter(123456.78901))
|
22
|
-
# # assert_equal("123,456,789.78901", number_with_delimiter(123456789.78901))
|
23
|
-
# # assert_equal("0.78901", number_with_delimiter(0.78901))
|
24
|
-
# # assert_equal("123,456.78", number_with_delimiter("123456.78"))
|
25
|
-
# # assert_equal("x", number_with_delimiter("x"))
|
26
|
-
# # assert_nil number_with_delimiter(nil)
|
27
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 12345678 => 12,345,678.0" do
|
28
|
-
# # assert_equal '12,345,678.0', format_number(12345678)
|
29
|
-
# # end
|
30
|
-
# #
|
31
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 0 => 0.0" do
|
32
|
-
# # assert_equal '0.0', format_number(0)
|
33
|
-
# # end
|
34
|
-
# #
|
35
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 123 => 123.0" do
|
36
|
-
# # assert_equal '123.0', format_number(123)
|
37
|
-
# # end
|
38
|
-
# #
|
39
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 123456 => 123,456" do
|
40
|
-
# # assert_equal '123,456.0', format_number(123456)
|
41
|
-
# # end
|
42
|
-
# #
|
43
|
-
# # define_method :"test: compatible with number_with_delimiter: 123456.78 => 123,456.78" do
|
44
|
-
# # assert_equal '123,456.78', format_number(123456.78)
|
45
|
-
# # end
|
46
|
-
# #
|
47
|
-
# # define_method :"test: compatible with number_with_delimiter: 123456.789 => 123,456.789" do
|
48
|
-
# # assert_equal '123,456.789', format_number(123456.789)
|
49
|
-
# # end
|
50
|
-
# #
|
51
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 123456.78901 => 123,456.789" do
|
52
|
-
# # assert_equal '123,456.789', format_number(123456.78901)
|
53
|
-
# # end
|
54
|
-
# #
|
55
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 123456.78901 w/ precision 5 => 123,456.78901" do
|
56
|
-
# # assert_equal '123,456.78901', format_number(123456.78901, :precision => 5)
|
57
|
-
# # end
|
58
|
-
# #
|
59
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 123456789.78901 => 123,456,789.789" do
|
60
|
-
# # assert_equal '123,456,789.789', format_number(123456789.78901)
|
61
|
-
# # end
|
62
|
-
# #
|
63
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 123456789.78901 w/ precision 5 => 123,456,789.78901" do
|
64
|
-
# # assert_equal '123,456,789.78901', format_number(123456789.78901, :precision => 5)
|
65
|
-
# # end
|
66
|
-
# #
|
67
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 0.78901 => 0.789" do
|
68
|
-
# # assert_equal '0.789', format_number(0.78901)
|
69
|
-
# # end
|
70
|
-
# #
|
71
|
-
# # define_method :"test: NOT compatible with number_with_delimiter: 0.78901 w/ precision 5 => 0.78901" do
|
72
|
-
# # assert_equal '0.78901', format_number(0.78901, :precision => 5)
|
73
|
-
# # end
|
74
|
-
# #
|
75
|
-
# # define_method :"test: compatible with number_with_delimiter: 'x' => 'x'" do
|
76
|
-
# # assert_equal 'x', format_number('x')
|
77
|
-
# # end
|
78
|
-
# #
|
79
|
-
# # define_method :"test: compatible with number_with_delimiter: nil => nil" do
|
80
|
-
# # assert_nil format_number(nil)
|
81
|
-
# # end
|
82
|
-
#
|
83
|
-
# # number_with_precision assertions:
|
84
|
-
# #
|
85
|
-
# # assert_equal("111.235", number_with_precision(111.2346))
|
86
|
-
# # assert_equal("31.83", number_with_precision(31.825, :precision => 2))
|
87
|
-
# # assert_equal("111.23", number_with_precision(111.2346, :precision => 2))
|
88
|
-
# # assert_equal("111.00", number_with_precision(111, :precision => 2))
|
89
|
-
# # assert_equal("111.235", number_with_precision("111.2346"))
|
90
|
-
# # assert_equal("31.83", number_with_precision("31.825", :precision => 2))
|
91
|
-
# # assert_equal("112", number_with_precision(111.50, :precision => 0))
|
92
|
-
# # assert_equal("1234567892", number_with_precision(1234567891.50, :precision => 0))
|
93
|
-
# # assert_equal("x", number_with_precision("x"))
|
94
|
-
# # assert_nil number_with_precision(nil)
|
95
|
-
# define_method :"test: compatible with number_with_precision: 111.235 => 111.2346" do
|
96
|
-
# assert_equal "111.235", format_number(111.2346)
|
97
|
-
# end
|
98
|
-
#
|
99
|
-
# define_method :"test: compatible with number_with_precision: 31.825 w/ precision 2 => 31.83" do
|
100
|
-
# assert_equal "31.83", format_number(31.825, :precision => 2)
|
101
|
-
# end
|
102
|
-
#
|
103
|
-
# # define_method :"test: compatible with number_with_precision: 111.2346 w/ precision 2 => 111.23" do
|
104
|
-
# # assert_equal "111.23", format_number(111.2346, :precision => 2)
|
105
|
-
# # end
|
106
|
-
# #
|
107
|
-
# # define_method :"test: compatible with number_with_precision: 111 w/ precision 2 => 111.00" do
|
108
|
-
# # assert_equal "111.00", format_number(111, :precision => 2)
|
109
|
-
# # end
|
110
|
-
# #
|
111
|
-
# # define_method :"test: compatible with number_with_precision: '111.2346' => '111.235'" do
|
112
|
-
# # assert_equal "111.235", format_number("111.2346")
|
113
|
-
# # end
|
114
|
-
# #
|
115
|
-
# # define_method :"test: compatible with number_with_precision: '31.825' w/ precision 2 => 31.83" do
|
116
|
-
# # assert_equal "31.83", format_number("31.825", :precision => 2)
|
117
|
-
# # end
|
118
|
-
# #
|
119
|
-
# # define_method :"test: compatible with number_with_precision: 111.50 w/ precision 0 => 112" do
|
120
|
-
# # assert_equal "112", format_number(111.50, :precision => 0)
|
121
|
-
# # end
|
122
|
-
# #
|
123
|
-
# # define_method :"test: NOT compatible with number_with_precision: 1234567891.50 w/ precision 0 => 1,234,567,892" do
|
124
|
-
# # assert_equal "1,234,567,892", format_number(1234567891.50, :precision => 0)
|
125
|
-
# # end
|
126
|
-
# #
|
127
|
-
# # define_method :"test: compatible with number_with_precision: 'x' => 'x'" do
|
128
|
-
# # assert_equal "x", format_number("x")
|
129
|
-
# # end
|
130
|
-
# #
|
131
|
-
# # define_method :"test: compatible with number_with_precision: nil => nil" do
|
132
|
-
# # assert_nil format_number(nil)
|
133
|
-
# # end
|
134
|
-
# end
|