russian 0.0.3 → 0.0.4
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.
- data/README.textile +27 -0
- data/Rakefile +1 -1
- data/lib/russian.rb +14 -5
- data/lib/russian/active_record_ext/custom_error_message.rb +46 -48
- data/lib/russian/locale/actionview.yml +16 -16
- data/lib/russian/locale/activerecord.yml +24 -24
- data/lib/russian/locale/pluralize.rb +12 -5
- data/lib/vendor/i18n_label/README.textile +38 -0
- data/lib/vendor/i18n_label/Rakefile +11 -0
- data/lib/vendor/i18n_label/init.rb +1 -0
- data/lib/vendor/i18n_label/install.rb +1 -0
- data/lib/vendor/i18n_label/lib/i18n_label.rb +23 -0
- data/lib/vendor/i18n_label/spec/i18n_label_spec.rb +20 -0
- data/lib/vendor/i18n_label/spec/spec_helper.rb +10 -0
- data/lib/vendor/i18n_label/tasks/i18n_label_tasks.rake +4 -0
- data/lib/vendor/i18n_label/uninstall.rb +1 -0
- data/spec/i18n/locale/pluralization_spec.rb +3 -0
- data/spec/locale_spec.rb +109 -0
- data/spec/russian_spec.rb +0 -35
- metadata +16 -2
data/README.textile
CHANGED
@@ -191,6 +191,33 @@ h3. Хелперы
|
|
191
191
|
|
192
192
|
Хелперы даты-времени получают ключ @:use_standalone_month_names@ для форсирования отображения отдельностоящего названия месяца ("Сентябрь" а не "сентября"). Такое имя месяца используется когда включен ключ @:use_standalone_month_names@ (для отдельностоящего @select_month@ он включается по умолчанию), либо когда есть ключ @:discard_day@.
|
193
193
|
|
194
|
+
В Russian включен плагин i18n_label, который подставляет в форм-хелпер @label@ перевод атрибута из таблицы переводов I18n. Например:
|
195
|
+
|
196
|
+
* в файле переводов:
|
197
|
+
|
198
|
+
<pre><code>
|
199
|
+
ru-RU:
|
200
|
+
activerecord:
|
201
|
+
attributes:
|
202
|
+
user:
|
203
|
+
name: "Имя"
|
204
|
+
</code></pre>
|
205
|
+
|
206
|
+
* во view:
|
207
|
+
|
208
|
+
<pre><code>
|
209
|
+
<% form_for @user do |f| %>
|
210
|
+
<%= f.label :name %>
|
211
|
+
<% end %>
|
212
|
+
</code></pre>
|
213
|
+
|
214
|
+
Даст:
|
215
|
+
|
216
|
+
<pre><code>
|
217
|
+
<label for="user_name">Имя</label>
|
218
|
+
</code></pre>
|
219
|
+
|
220
|
+
|
194
221
|
h3. Валидация
|
195
222
|
|
196
223
|
Обработка ошибок в ActiveRecord перегружается -- в Russian включен популярный плагин custom_error_message, с помощью которого можно переопределять стандартное отображение сообщений об ошибках. Так, например,
|
data/Rakefile
CHANGED
data/lib/russian.rb
CHANGED
@@ -1,19 +1,28 @@
|
|
1
1
|
$KCODE='u'
|
2
2
|
|
3
3
|
$:.push File.join(File.dirname(__FILE__), 'russian')
|
4
|
-
$:.push File.join(File.dirname(__FILE__), 'vendor', 'i18n', 'lib')
|
5
4
|
|
6
|
-
|
5
|
+
# I18n require
|
6
|
+
unless defined?(I18n)
|
7
|
+
$:.push File.join(File.dirname(__FILE__), 'vendor', 'i18n', 'lib')
|
8
|
+
require 'i18n'
|
9
|
+
end
|
7
10
|
|
11
|
+
# Advanced backend
|
8
12
|
require 'backend/advanced'
|
9
|
-
|
10
|
-
|
13
|
+
|
14
|
+
# Rails hacks
|
15
|
+
require 'active_record_ext/custom_error_message' if defined?(ActiveRecord)
|
16
|
+
if defined?(ActionView::Helpers)
|
17
|
+
require 'action_view_ext/helpers/date_helper'
|
18
|
+
require 'vendor/i18n_label/init'
|
19
|
+
end
|
11
20
|
|
12
21
|
module Russian
|
13
22
|
module VERSION
|
14
23
|
MAJOR = 0
|
15
24
|
MINOR = 0
|
16
|
-
TINY =
|
25
|
+
TINY = 4
|
17
26
|
|
18
27
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
19
28
|
end
|
@@ -1,53 +1,51 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
@errors.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
full_messages << @base.class.human_attribute_name(attr) + " " + msg
|
45
|
-
end
|
1
|
+
# The following is taken from custom_error_message plugin by David Easley
|
2
|
+
# (http://rubyforge.org/projects/custom-err-msg/)
|
3
|
+
module ActiveRecord
|
4
|
+
class Errors
|
5
|
+
|
6
|
+
# Redefine the ActiveRecord::Errors::full_messages method:
|
7
|
+
# Returns all the full error messages in an array. 'Base' messages are handled as usual.
|
8
|
+
# Non-base messages are prefixed with the attribute name as usual UNLESS they begin with '^'
|
9
|
+
# in which case the attribute name is omitted.
|
10
|
+
# E.g. validates_acceptance_of :accepted_terms, :message => '^Please accept the terms of service'
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# Переопределяет метод ActiveRecord::Errors::full_messages. Сообщения об ошибках для атрибутов
|
14
|
+
# теперь не имеют префикса с названием атрибута если в сообщении об ошибке первым символом указан "^".
|
15
|
+
#
|
16
|
+
# Так, например,
|
17
|
+
#
|
18
|
+
# validates_acceptance_of :accepted_terms, :message => 'нужно принять соглашение'
|
19
|
+
#
|
20
|
+
# даст сообщение
|
21
|
+
#
|
22
|
+
# Accepted terms нужно принять соглашение
|
23
|
+
#
|
24
|
+
# однако,
|
25
|
+
#
|
26
|
+
# validates_acceptance_of :accepted_terms, :message => '^Нужно принять соглашение'
|
27
|
+
#
|
28
|
+
# даст сообщение
|
29
|
+
#
|
30
|
+
# Нужно принять соглашение
|
31
|
+
def full_messages
|
32
|
+
full_messages = []
|
33
|
+
|
34
|
+
@errors.each_key do |attr|
|
35
|
+
@errors[attr].each do |msg|
|
36
|
+
next if msg.nil?
|
37
|
+
|
38
|
+
if attr == "base"
|
39
|
+
full_messages << msg
|
40
|
+
elsif msg =~ /^\^/
|
41
|
+
full_messages << msg[1..-1]
|
42
|
+
else
|
43
|
+
full_messages << @base.class.human_attribute_name(attr) + " " + msg
|
46
44
|
end
|
47
45
|
end
|
48
|
-
|
49
|
-
return full_messages
|
50
46
|
end
|
47
|
+
|
48
|
+
return full_messages
|
51
49
|
end
|
52
50
|
end
|
53
|
-
end
|
51
|
+
end
|
@@ -59,52 +59,52 @@ ru-RU:
|
|
59
59
|
distance_in_words:
|
60
60
|
half_a_minute: "меньше минуты"
|
61
61
|
less_than_x_seconds:
|
62
|
-
one: "меньше секунды"
|
62
|
+
one: "меньше {{count}} секунды"
|
63
63
|
few: "меньше {{count}} секунд"
|
64
64
|
many: "меньше {{count}} секунд"
|
65
|
-
other: "меньше {{count}}
|
65
|
+
other: "меньше {{count}} секунды"
|
66
66
|
x_seconds:
|
67
|
-
one: "
|
67
|
+
one: "{{count}} секунда"
|
68
68
|
few: "{{count}} секунды"
|
69
69
|
many: "{{count}} секунд"
|
70
70
|
other: "{{count}} секунды"
|
71
71
|
less_than_x_minutes:
|
72
|
-
one: "меньше минуты"
|
72
|
+
one: "меньше {{count}} минуты"
|
73
73
|
few: "меньше {{count}} минут"
|
74
74
|
many: "меньше {{count}} минут"
|
75
|
-
other: "меньше {{count}}
|
75
|
+
other: "меньше {{count}} минуты"
|
76
76
|
x_minutes:
|
77
|
-
one: "
|
77
|
+
one: "{{count}} минуту"
|
78
78
|
few: "{{count}} минуты"
|
79
79
|
many: "{{count}} минут"
|
80
80
|
other: "{{count}} минуты"
|
81
81
|
about_x_hours:
|
82
|
-
one: "около часа"
|
82
|
+
one: "около {{count}} часа"
|
83
83
|
few: "около {{count}} часов"
|
84
84
|
many: "около {{count}} часов"
|
85
|
-
other: "около {{count}}
|
85
|
+
other: "около {{count}} часа"
|
86
86
|
x_days:
|
87
|
-
one: "
|
87
|
+
one: "{{count}} день"
|
88
88
|
few: "{{count}} дня"
|
89
89
|
many: "{{count}} дней"
|
90
90
|
other: "{{count}} дня"
|
91
91
|
about_x_months:
|
92
|
-
one: "около
|
92
|
+
one: "около {{count}} месяца"
|
93
93
|
few: "около {{count}} месяцев"
|
94
94
|
many: "около {{count}} месяцев"
|
95
|
-
other: "около {{count}}
|
95
|
+
other: "около {{count}} месяца"
|
96
96
|
x_months:
|
97
|
-
one: "
|
97
|
+
one: "{{count}} месяц"
|
98
98
|
few: "{{count}} месяца"
|
99
99
|
many: "{{count}} месяцев"
|
100
100
|
other: "{{count}} месяца"
|
101
101
|
about_x_years:
|
102
|
-
one: "около
|
102
|
+
one: "около {{count}} года"
|
103
103
|
few: "около {{count}} лет"
|
104
104
|
many: "около {{count}} лет"
|
105
105
|
other: "около {{count}} лет"
|
106
106
|
over_x_years:
|
107
|
-
one: "больше
|
107
|
+
one: "больше {{count}} года"
|
108
108
|
few: "больше {{count}} лет"
|
109
109
|
many: "больше {{count}} лет"
|
110
110
|
other: "больше {{count}} лет"
|
@@ -115,10 +115,10 @@ ru-RU:
|
|
115
115
|
template:
|
116
116
|
# Заголовок сообщения об ошибке
|
117
117
|
header:
|
118
|
-
one: "{{model}}: сохранение не удалось из-за
|
118
|
+
one: "{{model}}: сохранение не удалось из-за {{count}} ошибки"
|
119
119
|
few: "{{model}}: сохранение не удалось из-за {{count}} ошибок"
|
120
120
|
many: "{{model}}: сохранение не удалось из-за {{count}} ошибок"
|
121
|
-
other: "{{model}}: сохранение не
|
121
|
+
other: "{{model}}: сохранение не удалось из-за {{count}} ошибки"
|
122
122
|
|
123
123
|
# Первый параграф сообщения об ошибке. Можно использовать макрос {{count}}
|
124
124
|
#
|
@@ -24,17 +24,17 @@ ru-RU:
|
|
24
24
|
empty: "не может быть пустым"
|
25
25
|
blank: "не может быть пустым"
|
26
26
|
too_long:
|
27
|
-
one: "слишком большой длины (не может быть больше чем
|
27
|
+
one: "слишком большой длины (не может быть больше чем {{count}} символ)"
|
28
28
|
few: "слишком большой длины (не может быть больше чем {{count}} символа)"
|
29
29
|
many: "слишком большой длины (не может быть больше чем {{count}} символов)"
|
30
30
|
other: "слишком большой длины (не может быть больше чем {{count}} символа)"
|
31
31
|
too_short:
|
32
|
-
one: "недостаточной длины (не может быть меньше
|
32
|
+
one: "недостаточной длины (не может быть меньше {{count}} символа)"
|
33
33
|
few: "недостаточной длины (не может быть меньше {{count}} символов)"
|
34
34
|
many: "недостаточной длины (не может быть меньше {{count}} символов)"
|
35
|
-
other: "недостаточной длины (не может быть меньше {{count}}
|
35
|
+
other: "недостаточной длины (не может быть меньше {{count}} символа)"
|
36
36
|
wrong_length:
|
37
|
-
one: "неверной длины (может быть длиной ровно
|
37
|
+
one: "неверной длины (может быть длиной ровно {{count}} символ)"
|
38
38
|
few: "неверной длины (может быть длиной ровно {{count}} символа)"
|
39
39
|
many: "неверной длины (может быть длиной ровно {{count}} символов)"
|
40
40
|
other: "неверной длины (может быть длиной ровно {{count}} символа)"
|
@@ -66,25 +66,25 @@ ru-RU:
|
|
66
66
|
# # Ниже определим собственное сообщение об ошибке для атрибута name модели User.
|
67
67
|
# name:
|
68
68
|
# blank: "Атрибут {{attribute}} особенный -- у него свое сообщение об ошибке при пустом атрибуте"
|
69
|
-
|
70
69
|
models:
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
70
|
+
|
71
|
+
# Перевод названий моделей. Используется в Model.human_name().
|
72
|
+
#
|
73
|
+
#models:
|
74
|
+
# Например,
|
75
|
+
# user: "Пользователь"
|
76
|
+
# переведет модель User как "Пользователь".
|
77
|
+
#
|
78
|
+
#
|
79
|
+
# Overrides default messages
|
80
|
+
|
81
|
+
# Перевод названий атрибутов моделей. Используется в Model.human_attribute_name(attribute).
|
82
|
+
#attributes:
|
83
|
+
# Например,
|
84
|
+
# user:
|
85
|
+
# name: "Имя"
|
86
|
+
# переведет атрибут name модели User как "Имя".
|
87
|
+
#
|
88
|
+
#
|
89
|
+
# Overrides model and default messages.
|
90
90
|
|
@@ -6,13 +6,20 @@
|
|
6
6
|
#
|
7
7
|
# Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
|
8
8
|
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
9
|
+
# one -> n mod 10 is 1 and n mod 100 is not 11;
|
10
|
+
# few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
|
11
|
+
# many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
|
12
|
+
# other -> everything else
|
13
|
+
#
|
14
|
+
# Examples
|
15
|
+
#
|
16
|
+
# one = 1, 21, 31, 41, 51, 61...
|
17
|
+
# few = 2-4, 22-24, 32-34...
|
18
|
+
# many = 0, 5-20, 25-30, 35-40...
|
19
|
+
# other = 1.31, 2.31, 5.31...
|
13
20
|
if n.modulo(10) == 1 && n.modulo(100) != 11
|
14
21
|
:one
|
15
|
-
elsif (n.modulo(10) >=2 && n.modulo(10) <= 4) && (n.modulo(100) >=12 && n.modulo(100) <= 14)
|
22
|
+
elsif (n.modulo(10) >=2 && n.modulo(10) <= 4) && !(n.modulo(100) >=12 && n.modulo(100) <= 14)
|
16
23
|
:few
|
17
24
|
elsif n.modulo(10) == 0 || (n.modulo(10) >=5 && n.modulo(10) <= 9) ||
|
18
25
|
(n.modulo(100) >= 11 && n.modulo(100) <= 14)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
h1. I18nLabel
|
2
|
+
|
3
|
+
Since labels don't use I18n in Rails 2.2 (I was too late in submitting the
|
4
|
+
patch), we'd have to make due with a plugin.
|
5
|
+
|
6
|
+
Installation and configuration consists of 1 easy steps:
|
7
|
+
|
8
|
+
# Run:
|
9
|
+
|
10
|
+
./script/plugin install git://github.com/iain/i18n_label.git
|
11
|
+
|
12
|
+
|
13
|
+
h1. Example
|
14
|
+
|
15
|
+
In your translation file:
|
16
|
+
|
17
|
+
en-US:
|
18
|
+
activerecord:
|
19
|
+
attributes:
|
20
|
+
topic:
|
21
|
+
name: A nice name
|
22
|
+
|
23
|
+
In your view:
|
24
|
+
|
25
|
+
<% form_for @topic do |f| %>
|
26
|
+
<%= f.label :name %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
The result is:
|
30
|
+
|
31
|
+
<label for="topic_name">A nice name</label> (please ignore the minor problem with html in github)
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
For more information about where to put your translations,
|
36
|
+
visit "my blog":http://iain.nl/2008/09/translating-activerecord/
|
37
|
+
|
38
|
+
Copyright (c) 2008 "Iain Hecker":http://iain.nl/, released under the MIT license
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
desc 'Default: run specs.'
|
5
|
+
task :default => :spec
|
6
|
+
|
7
|
+
desc 'Run the specs'
|
8
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
9
|
+
t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
|
10
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/lib/i18n_label.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
File.readlines(File.dirname(__FILE__)+'/README.textile').each { |line| puts line }
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Just replace the method...
|
2
|
+
module ActionView
|
3
|
+
module Helpers
|
4
|
+
class InstanceTag
|
5
|
+
def to_label_tag(text = nil, options = {})
|
6
|
+
options = options.stringify_keys
|
7
|
+
name_and_id = options.dup
|
8
|
+
add_default_name_and_id(name_and_id)
|
9
|
+
options.delete("index")
|
10
|
+
options["for"] ||= name_and_id["id"]
|
11
|
+
if text.blank?
|
12
|
+
content = method_name.humanize
|
13
|
+
if object.class.respond_to?(:human_attribute_name)
|
14
|
+
content = object.class.human_attribute_name(method_name)
|
15
|
+
end
|
16
|
+
else
|
17
|
+
content = text.to_s
|
18
|
+
end
|
19
|
+
label_tag(name_and_id["id"], content, options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
# give a model to play with
|
4
|
+
class Reply < ActiveRecord::Base
|
5
|
+
attr_accessor :title
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ActionView::Helpers do
|
9
|
+
|
10
|
+
# NOTE gives deprication warning in RSpec 1.1.4:
|
11
|
+
# Modules will no longer be automatically included in RSpec version 1.1.4. Called from ./spec/i18n_label_spec.rb:15
|
12
|
+
it "label should make a call to human_attribute_name" do
|
13
|
+
Reply.should_receive(:human_attribute_name).with('title').and_return("translated title")
|
14
|
+
reply = mock_model(Reply)
|
15
|
+
fields_for(reply) do |f|
|
16
|
+
f.label(:title).should == "<label for=\"reply_title\">translated title</label>"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
begin
|
2
|
+
require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
|
3
|
+
rescue LoadError
|
4
|
+
puts "You need to install rspec in your base app"
|
5
|
+
exit
|
6
|
+
end
|
7
|
+
|
8
|
+
plugin_spec_dir = File.dirname(__FILE__)
|
9
|
+
ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
|
10
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
puts "Bye!"
|
@@ -16,5 +16,8 @@ describe I18n, "Russian pluralization" do
|
|
16
16
|
@backend.send(:pluralize, :'ru-RU', @hash, 29).should == 'вещей'
|
17
17
|
@backend.send(:pluralize, :'ru-RU', @hash, 129).should == 'вещей'
|
18
18
|
@backend.send(:pluralize, :'ru-RU', @hash, 131).should == 'вещь'
|
19
|
+
@backend.send(:pluralize, :'ru-RU', @hash, 1.31).should == 'вещи'
|
20
|
+
@backend.send(:pluralize, :'ru-RU', @hash, 2.31).should == 'вещи'
|
21
|
+
@backend.send(:pluralize, :'ru-RU', @hash, 3.31).should == 'вещи'
|
19
22
|
end
|
20
23
|
end
|
data/spec/locale_spec.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe Russian, "loading locales" do
|
4
|
+
before(:all) do
|
5
|
+
Russian.init_i18n
|
6
|
+
end
|
7
|
+
|
8
|
+
%w(
|
9
|
+
date.formats.default
|
10
|
+
date.formats.short
|
11
|
+
date.formats.long
|
12
|
+
date.day_names
|
13
|
+
date.standalone_day_names
|
14
|
+
date.abbr_day_names
|
15
|
+
date.month_names
|
16
|
+
date.standalone_month_names
|
17
|
+
date.abbr_month_names
|
18
|
+
date.standalone_abbr_month_names
|
19
|
+
date.order
|
20
|
+
|
21
|
+
time.formats.default
|
22
|
+
time.formats.short
|
23
|
+
time.formats.long
|
24
|
+
time.am
|
25
|
+
time.pm
|
26
|
+
).each do |key|
|
27
|
+
it "should define '#{key}' in datetime translations" do
|
28
|
+
lookup(key).should_not be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should load pluralization rules" do
|
33
|
+
lookup(:"pluralize").should_not be_nil
|
34
|
+
lookup(:"pluralize").is_a?(Proc).should be_true
|
35
|
+
end
|
36
|
+
|
37
|
+
%w(
|
38
|
+
number.format.separator
|
39
|
+
number.format.delimiter
|
40
|
+
number.format.precision
|
41
|
+
number.currency.format.format
|
42
|
+
number.currency.format.unit
|
43
|
+
number.currency.format.separator
|
44
|
+
number.currency.format.delimiter
|
45
|
+
number.currency.format.precision
|
46
|
+
number.percentage.format.delimiter
|
47
|
+
number.percentage.format.precision
|
48
|
+
number.precision.format.delimiter
|
49
|
+
number.human.format.delimiter
|
50
|
+
number.human.format.precision
|
51
|
+
|
52
|
+
datetime.distance_in_words.half_a_minute
|
53
|
+
datetime.distance_in_words.less_than_x_seconds
|
54
|
+
datetime.distance_in_words.x_seconds
|
55
|
+
datetime.distance_in_words.less_than_x_minutes
|
56
|
+
datetime.distance_in_words.x_minutes
|
57
|
+
datetime.distance_in_words.about_x_hours
|
58
|
+
datetime.distance_in_words.x_days
|
59
|
+
datetime.distance_in_words.about_x_months
|
60
|
+
datetime.distance_in_words.x_months
|
61
|
+
datetime.distance_in_words.about_x_years
|
62
|
+
datetime.distance_in_words.over_x_years
|
63
|
+
|
64
|
+
activerecord.errors.template.header
|
65
|
+
activerecord.errors.template.body
|
66
|
+
).each do |key|
|
67
|
+
it "should define '#{key}' in actionview translations" do
|
68
|
+
lookup(key).should_not be_nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
%w(
|
73
|
+
activerecord.errors.messages.inclusion
|
74
|
+
activerecord.errors.messages.exclusion
|
75
|
+
activerecord.errors.messages.invalid
|
76
|
+
activerecord.errors.messages.confirmation
|
77
|
+
activerecord.errors.messages.accepted
|
78
|
+
activerecord.errors.messages.empty
|
79
|
+
activerecord.errors.messages.blank
|
80
|
+
activerecord.errors.messages.too_long
|
81
|
+
activerecord.errors.messages.too_short
|
82
|
+
activerecord.errors.messages.wrong_length
|
83
|
+
activerecord.errors.messages.taken
|
84
|
+
activerecord.errors.messages.not_a_number
|
85
|
+
activerecord.errors.messages.greater_than
|
86
|
+
activerecord.errors.messages.greater_than_or_equal_to
|
87
|
+
activerecord.errors.messages.equal_to
|
88
|
+
activerecord.errors.messages.less_than
|
89
|
+
activerecord.errors.messages.less_than_or_equal_to
|
90
|
+
activerecord.errors.messages.odd
|
91
|
+
activerecord.errors.messages.even
|
92
|
+
).each do |key|
|
93
|
+
it "should define '#{key}' in activerecord translations" do
|
94
|
+
lookup(key).should_not be_nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
%w(
|
99
|
+
support.array.sentence_connector
|
100
|
+
).each do |key|
|
101
|
+
it "should define '#{key}' in activesupport translations" do
|
102
|
+
lookup(key).should_not be_nil
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def lookup(*args)
|
107
|
+
I18n.backend.send(:lookup, Russian.locale, *args)
|
108
|
+
end
|
109
|
+
end
|
data/spec/russian_spec.rb
CHANGED
@@ -35,41 +35,6 @@ describe Russian do
|
|
35
35
|
Russian.init_i18n
|
36
36
|
I18n.default_locale.should == Russian.locale
|
37
37
|
end
|
38
|
-
|
39
|
-
describe "loading locales" do
|
40
|
-
before(:all) do
|
41
|
-
Russian.init_i18n
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should load datetime translations" do
|
45
|
-
lookup(:"date.formats.default").should_not be_nil
|
46
|
-
lookup(:"time.formats.default").should_not be_nil
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should load pluralization rules" do
|
50
|
-
lookup(:"pluralize").should_not be_nil
|
51
|
-
lookup(:"pluralize").is_a?(Proc).should be_true
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should load actionview translations" do
|
55
|
-
lookup(:"number.currency.format.format").should_not be_nil
|
56
|
-
lookup(:"datetime.distance_in_words.half_a_minute").should_not be_nil
|
57
|
-
lookup(:"activerecord.errors.template.header").should_not be_nil
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should load activerecord translations" do
|
61
|
-
lookup(:"activerecord.errors.messages.invalid").should_not be_nil
|
62
|
-
lookup(:"activerecord.errors.messages.greater_than_or_equal_to").should_not be_nil
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should load activesupport translations" do
|
66
|
-
lookup(:"support.array.sentence_connector").should_not be_nil
|
67
|
-
end
|
68
|
-
|
69
|
-
def lookup(*args)
|
70
|
-
I18n.backend.send(:lookup, Russian.locale, *args)
|
71
|
-
end
|
72
|
-
end
|
73
38
|
end
|
74
39
|
|
75
40
|
describe "with localize proxy" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: russian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Markin
|
@@ -9,7 +9,7 @@ autorequire: russian
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-14 00:00:00 +04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -64,10 +64,24 @@ files:
|
|
64
64
|
- lib/vendor/i18n/test/locale/en-US.rb
|
65
65
|
- lib/vendor/i18n/test/locale/en-US.yml
|
66
66
|
- lib/vendor/i18n/test/simple_backend_test.rb
|
67
|
+
- lib/vendor/i18n_label
|
68
|
+
- lib/vendor/i18n_label/init.rb
|
69
|
+
- lib/vendor/i18n_label/install.rb
|
70
|
+
- lib/vendor/i18n_label/lib
|
71
|
+
- lib/vendor/i18n_label/lib/i18n_label.rb
|
72
|
+
- lib/vendor/i18n_label/Rakefile
|
73
|
+
- lib/vendor/i18n_label/README.textile
|
74
|
+
- lib/vendor/i18n_label/spec
|
75
|
+
- lib/vendor/i18n_label/spec/i18n_label_spec.rb
|
76
|
+
- lib/vendor/i18n_label/spec/spec_helper.rb
|
77
|
+
- lib/vendor/i18n_label/tasks
|
78
|
+
- lib/vendor/i18n_label/tasks/i18n_label_tasks.rake
|
79
|
+
- lib/vendor/i18n_label/uninstall.rb
|
67
80
|
- spec/i18n
|
68
81
|
- spec/i18n/locale
|
69
82
|
- spec/i18n/locale/datetime_spec.rb
|
70
83
|
- spec/i18n/locale/pluralization_spec.rb
|
84
|
+
- spec/locale_spec.rb
|
71
85
|
- spec/russian_spec.rb
|
72
86
|
- spec/spec_helper.rb
|
73
87
|
has_rdoc: true
|