Skip to content

Commit 573bedb

Browse files
committed
Modified the script to test the structure integrity of each locale files
It checks their validity for both Rails 2 and 3. The base idea is originated from Akira Matsuda's work. See http://gist.github.com/607863
1 parent 050acdc commit 573bedb

10 files changed

+398
-112
lines changed

Rakefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'rake'
2+
require 'rake/testtask'
3+
4+
require 'rbconfig'
5+
6+
desc 'Run all tests by default'
7+
task :default => :test
8+
task :test => 'test:all'
9+
10+
namespace :test do
11+
desc 'Check formality of all locale files.'
12+
task :all do
13+
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
14+
system(ruby, File.dirname(__FILE__) + '/rails/test/structure.rb')
15+
end
16+
end

rails/rails/action_view.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
delimiter: ","
1010
# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
1111
precision: 3
12-
12+
1313
# Used in number_to_currency()
1414
currency:
1515
format:
@@ -20,28 +20,28 @@
2020
separator: "."
2121
delimiter: ","
2222
precision: 2
23-
23+
2424
# Used in number_to_percentage()
2525
percentage:
2626
format:
2727
# These three are to override number.format and are optional
28-
# separator:
28+
# separator:
2929
delimiter: ""
30-
# precision:
31-
30+
# precision:
31+
3232
# Used in number_to_precision()
3333
precision:
3434
format:
3535
# These three are to override number.format and are optional
3636
# separator:
3737
delimiter: ""
3838
# precision:
39-
39+
4040
# Used in number_to_human_size()
4141
human:
4242
format:
4343
# These three are to override number.format and are optional
44-
# separator:
44+
# separator:
4545
delimiter: ""
4646
precision: 1
4747
storage_units:
@@ -63,37 +63,37 @@
6363
half_a_minute: "half a minute"
6464
less_than_x_seconds:
6565
one: "less than 1 second"
66-
other: "less than {{count}} seconds"
66+
other: "less than %{count} seconds"
6767
x_seconds:
6868
one: "1 second"
69-
other: "{{count}} seconds"
69+
other: "%{count} seconds"
7070
less_than_x_minutes:
7171
one: "less than a minute"
72-
other: "less than {{count}} minutes"
72+
other: "less than %{count} minutes"
7373
x_minutes:
7474
one: "1 minute"
75-
other: "{{count}} minutes"
75+
other: "%{count} minutes"
7676
about_x_hours:
7777
one: "about 1 hour"
78-
other: "about {{count}} hours"
78+
other: "about %{count} hours"
7979
x_days:
8080
one: "1 day"
81-
other: "{{count}} days"
81+
other: "%{count} days"
8282
about_x_months:
8383
one: "about 1 month"
84-
other: "about {{count}} months"
84+
other: "about %{count} months"
8585
x_months:
8686
one: "1 month"
87-
other: "{{count}} months"
87+
other: "%{count} months"
8888
about_x_years:
8989
one: "about 1 year"
90-
other: "about {{count}} years"
90+
other: "about %{count} years"
9191
over_x_years:
9292
one: "over 1 year"
93-
other: "over {{count}} years"
93+
other: "over %{count} years"
9494
almost_x_years:
9595
one: "almost 1 year"
96-
other: "almost {{count}} years"
96+
other: "almost %{count} years"
9797
prompts:
9898
year: "Year"
9999
month: "Month"
@@ -102,12 +102,12 @@
102102
minute: "Minute"
103103
second: "Seconds"
104104

105-
activemodel:
105+
activerecord:
106106
errors:
107107
template:
108108
header:
109-
one: "1 error prohibited this {{model}} from being saved"
110-
other: "{{count}} errors prohibited this {{model}} from being saved"
109+
one: "1 error prohibited this %{model} from being saved"
110+
other: "%{count} errors prohibited this %{model} from being saved"
111111
# The variable :count is also available
112112
body: "There were problems with the following fields:"
113113

rails/rails/active_record.yml

+16-14
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,44 @@ en:
1111
accepted: "must be accepted"
1212
empty: "can't be empty"
1313
blank: "can't be blank"
14-
too_long: "is too long (maximum is {{count}} characters)"
15-
too_short: "is too short (minimum is {{count}} characters)"
16-
wrong_length: "is the wrong length (should be {{count}} characters)"
14+
too_long: "is too long (maximum is %{count} characters)"
15+
too_short: "is too short (minimum is %{count} characters)"
16+
wrong_length: "is the wrong length (should be %{count} characters)"
1717
taken: "has already been taken"
1818
not_a_number: "is not a number"
19-
not_an_integer: "must be an integer"
20-
greater_than: "must be greater than {{count}}"
21-
greater_than_or_equal_to: "must be greater than or equal to {{count}}"
22-
equal_to: "must be equal to {{count}}"
23-
less_than: "must be less than {{count}}"
24-
less_than_or_equal_to: "must be less than or equal to {{count}}"
19+
greater_than: "must be greater than %{count}"
20+
greater_than_or_equal_to: "must be greater than or equal to %{count}"
21+
equal_to: "must be equal to %{count}"
22+
less_than: "must be less than %{count}"
23+
less_than_or_equal_to: "must be less than or equal to %{count}"
2524
odd: "must be odd"
2625
even: "must be even"
27-
record_invalid: "Validation failed: {{errors}}"
26+
record_invalid: "Validation failed: %{errors}"
2827
# Append your own errors here or at the model/attributes scope.
2928

29+
full_messages:
30+
format: "%{attribute} %{message}"
31+
3032
# You can define own errors for models or model attributes.
3133
# The values :model, :attribute and :value are always available for interpolation.
3234
#
3335
# For example,
3436
# models:
3537
# user:
36-
# blank: "This is a custom blank message for {{model}}: {{attribute}}"
38+
# blank: "This is a custom blank message for %{model}: %{attribute}"
3739
# attributes:
3840
# login:
3941
# blank: "This is a custom blank message for User login"
40-
# Will define custom blank validation message for User model and
42+
# Will define custom blank validation message for User model and
4143
# custom blank validation message for login attribute of User model.
4244
#models:
43-
45+
4446
# Translate model names. Used in Model.human_name().
4547
#models:
4648
# For example,
4749
# user: "Dude"
4850
# will translate User model name to "Dude"
49-
51+
5052
# Translate model attribute names. Used in Model.human_attribute_name(attribute).
5153
#attributes:
5254
# For example,

rails/rails/active_support.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ en:
77
default: "%Y-%m-%d"
88
short: "%b %d"
99
long: "%B %d, %Y"
10-
10+
1111
day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
1212
abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
13-
13+
1414
# Don't forget the nil at the beginning; there's no such thing as a 0th month
1515
month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
1616
abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
@@ -24,7 +24,7 @@ en:
2424
long: "%B %d, %Y %H:%M"
2525
am: "am"
2626
pm: "pm"
27-
27+
2828
# Used in array.to_sentence.
2929
support:
3030
array:

rails/rails3/action_view.yml

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
"en":
2+
number:
3+
# Used in number_with_delimiter()
4+
# These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
5+
format:
6+
# Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
7+
separator: "."
8+
# Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three)
9+
delimiter: ","
10+
# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
11+
precision: 3
12+
# If set to true, precision will mean the number of significant digits instead
13+
# of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2)
14+
significant: false
15+
# If set, the zeros after the decimal separator will always be stripped (eg.: 1.200 will be 1.2)
16+
strip_insignificant_zeros: false
17+
18+
# Used in number_to_currency()
19+
currency:
20+
format:
21+
# Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
22+
format: "%u%n"
23+
unit: "$"
24+
# These five are to override number.format and are optional
25+
separator: "."
26+
delimiter: ","
27+
precision: 2
28+
significant: false
29+
strip_insignificant_zeros: false
30+
31+
# Used in number_to_percentage()
32+
percentage:
33+
format:
34+
# These five are to override number.format and are optional
35+
# separator:
36+
delimiter: ""
37+
# precision:
38+
# significant: false
39+
# strip_insignificant_zeros: false
40+
41+
# Used in number_to_precision()
42+
precision:
43+
format:
44+
# These five are to override number.format and are optional
45+
# separator:
46+
delimiter: ""
47+
# precision:
48+
# significant: false
49+
# strip_insignificant_zeros: false
50+
51+
# Used in number_to_human_size() and number_to_human()
52+
human:
53+
format:
54+
# These five are to override number.format and are optional
55+
# separator:
56+
delimiter: ""
57+
precision: 3
58+
significant: true
59+
strip_insignificant_zeros: true
60+
# Used in number_to_human_size()
61+
storage_units:
62+
# Storage units output formatting.
63+
# %u is the storage unit, %n is the number (default: 2 MB)
64+
format: "%n %u"
65+
units:
66+
byte:
67+
one: "Byte"
68+
other: "Bytes"
69+
kb: "KB"
70+
mb: "MB"
71+
gb: "GB"
72+
tb: "TB"
73+
# Used in number_to_human()
74+
decimal_units:
75+
format: "%n %u"
76+
# Decimal units output formatting
77+
# By default we will only quantify some of the exponents
78+
# but the commented ones might be defined or overridden
79+
# by the user.
80+
units:
81+
# femto: Quadrillionth
82+
# pico: Trillionth
83+
# nano: Billionth
84+
# micro: Millionth
85+
# mili: Thousandth
86+
# centi: Hundredth
87+
# deci: Tenth
88+
unit: ""
89+
# ten:
90+
# one: Ten
91+
# other: Tens
92+
# hundred: Hundred
93+
thousand: Thousand
94+
million: Million
95+
billion: Billion
96+
trillion: Trillion
97+
quadrillion: Quadrillion
98+
99+
# Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
100+
datetime:
101+
distance_in_words:
102+
half_a_minute: "half a minute"
103+
less_than_x_seconds:
104+
one: "less than 1 second"
105+
other: "less than %{count} seconds"
106+
x_seconds:
107+
one: "1 second"
108+
other: "%{count} seconds"
109+
less_than_x_minutes:
110+
one: "less than a minute"
111+
other: "less than %{count} minutes"
112+
x_minutes:
113+
one: "1 minute"
114+
other: "%{count} minutes"
115+
about_x_hours:
116+
one: "about 1 hour"
117+
other: "about %{count} hours"
118+
x_days:
119+
one: "1 day"
120+
other: "%{count} days"
121+
about_x_months:
122+
one: "about 1 month"
123+
other: "about %{count} months"
124+
x_months:
125+
one: "1 month"
126+
other: "%{count} months"
127+
about_x_years:
128+
one: "about 1 year"
129+
other: "about %{count} years"
130+
over_x_years:
131+
one: "over 1 year"
132+
other: "over %{count} years"
133+
almost_x_years:
134+
one: "almost 1 year"
135+
other: "almost %{count} years"
136+
prompts:
137+
year: "Year"
138+
month: "Month"
139+
day: "Day"
140+
hour: "Hour"
141+
minute: "Minute"
142+
second: "Seconds"
143+
144+
helpers:
145+
select:
146+
# Default value for :prompt => true in FormOptionsHelper
147+
prompt: "Please select"
148+
149+
# Default translation keys for submit FormHelper
150+
submit:
151+
create: 'Create %{model}'
152+
update: 'Update %{model}'
153+
submit: 'Save %{model}'
154+

rails/rails3/active_model.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
en:
2+
errors:
3+
# The default format to use in full error messages.
4+
format: "%{attribute} %{message}"
5+
6+
# The values :model, :attribute and :value are always available for interpolation
7+
# The value :count is available when applicable. Can be used for pluralization.
8+
messages:
9+
inclusion: "is not included in the list"
10+
exclusion: "is reserved"
11+
invalid: "is invalid"
12+
confirmation: "doesn't match confirmation"
13+
accepted: "must be accepted"
14+
empty: "can't be empty"
15+
blank: "can't be blank"
16+
too_long: "is too long (maximum is %{count} characters)"
17+
too_short: "is too short (minimum is %{count} characters)"
18+
wrong_length: "is the wrong length (should be %{count} characters)"
19+
not_a_number: "is not a number"
20+
not_an_integer: "must be an integer"
21+
greater_than: "must be greater than %{count}"
22+
greater_than_or_equal_to: "must be greater than or equal to %{count}"
23+
equal_to: "must be equal to %{count}"
24+
less_than: "must be less than %{count}"
25+
less_than_or_equal_to: "must be less than or equal to %{count}"
26+
odd: "must be odd"
27+
even: "must be even"

0 commit comments

Comments
 (0)