rs_russian 0.7.0
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 +7 -0
- data/.gitignore +5 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +9 -0
- data/CHANGELOG +132 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +48 -0
- data/LICENSE +20 -0
- data/README.textile +268 -0
- data/Rakefile +12 -0
- data/TODO +4 -0
- data/lib/rs_russian.rb +1 -0
- data/lib/russian/action_view_ext/helpers/date_helper.rb +118 -0
- data/lib/russian/active_model_ext/custom_error_message.rb +70 -0
- data/lib/russian/locale/actionview.yml +212 -0
- data/lib/russian/locale/activemodel.yml +50 -0
- data/lib/russian/locale/activerecord.yml +95 -0
- data/lib/russian/locale/activesupport.yml +16 -0
- data/lib/russian/locale/datetime.rb +39 -0
- data/lib/russian/locale/datetime.yml +50 -0
- data/lib/russian/locale/pluralization.rb +28 -0
- data/lib/russian/locale/transliterator.rb +17 -0
- data/lib/russian/russian_rails.rb +8 -0
- data/lib/russian/transliteration.rb +64 -0
- data/lib/russian/version.rb +9 -0
- data/lib/russian.rb +121 -0
- data/russian.gemspec +33 -0
- data/spec/fixtures/en.yml +4 -0
- data/spec/fixtures/ru.yml +4 -0
- data/spec/i18n/locale/datetime_spec.rb +120 -0
- data/spec/i18n/locale/pluralization_spec.rb +28 -0
- data/spec/locale_spec.rb +47 -0
- data/spec/russian_spec.rb +133 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/transliteration_spec.rb +51 -0
- metadata +173 -0
@@ -0,0 +1,118 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
# Заменяет хелпер Rails <tt>select_month</tt> и метод <tt>translated_month_names</tt>
|
4
|
+
# для поддержки функционала "отдельностоящих имен месяцев".
|
5
|
+
#
|
6
|
+
# Теперь можно использовать и полные, и сокращенные название месяцев в двух вариантах -- контекстном
|
7
|
+
# (по умолчанию) и отдельностоящем (если в текущем языке есть соответствующие переводы).
|
8
|
+
# Теперь хелперы поддерживают ключ <tt>:use_standalone_month_names</tt>, хелпер <tt>select_month</tt>
|
9
|
+
# устанавливает его по умолчанию.
|
10
|
+
# Отдельностоящие имена месяцев также используютс когда указан ключ <tt>:discard_day</tt>.
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# Replaces Rails <tt>select_month</tt> helper and <tt>translated_month_names</tt> private method to provide
|
14
|
+
# "standalone month names" feature.
|
15
|
+
#
|
16
|
+
# It is now possible to use both abbreviated and full month names in two variants (if current locale provides them).
|
17
|
+
# All date helpers support <tt>:use_standalone_month_names</tt> key now, <tt>select_month</tt> helper sets
|
18
|
+
# it to true by default.
|
19
|
+
# Standalone month names are also used when <tt>:discard_day</tt> key is provided.
|
20
|
+
if defined?(ActionView::Helpers::DateTimeSelector)
|
21
|
+
module ActionView
|
22
|
+
module Helpers
|
23
|
+
module DateHelper
|
24
|
+
# Returns a select tag with options for each of the months January through December with the current month
|
25
|
+
# selected. The month names are presented as keys (what's shown to the user) and the month numbers (1-12) are
|
26
|
+
# used as values (what's submitted to the server). It's also possible to use month numbers for the presentation
|
27
|
+
# instead of names -- set the <tt>:use_month_numbers</tt> key in +options+ to true for this to happen. If you
|
28
|
+
# want both numbers and names, set the <tt>:add_month_numbers</tt> key in +options+ to true. If you would prefer
|
29
|
+
# to show month names as abbreviations, set the <tt>:use_short_month</tt> key in +options+ to true. If you want
|
30
|
+
# to use your own month names, set the <tt>:use_month_names</tt> key in +options+ to an array of 12 month names.
|
31
|
+
# You can also choose if you want to use i18n standalone month names or default month names -- you can
|
32
|
+
# force standalone month names usage by using <tt>:use_standalone_month_names</tt> key.
|
33
|
+
# Override the field name using the <tt>:field_name</tt> option, 'month' by default.
|
34
|
+
#
|
35
|
+
#
|
36
|
+
# Также поддерживается ключ <tt>:use_standalone_month_names</tt> для явного указания о необходимости
|
37
|
+
# использования отдельностоящих имен месяцев, если текущий язык их поддерживает.
|
38
|
+
#
|
39
|
+
#
|
40
|
+
# ==== Examples
|
41
|
+
# # Generates a select field for months that defaults to the current month that
|
42
|
+
# # will use keys like "January", "March".
|
43
|
+
# select_month(Date.today)
|
44
|
+
#
|
45
|
+
# # Generates a select field for months that defaults to the current month that
|
46
|
+
# # is named "start" rather than "month"
|
47
|
+
# select_month(Date.today, :field_name => 'start')
|
48
|
+
#
|
49
|
+
# # Generates a select field for months that defaults to the current month that
|
50
|
+
# # will use keys like "1", "3".
|
51
|
+
# select_month(Date.today, :use_month_numbers => true)
|
52
|
+
#
|
53
|
+
# # Generates a select field for months that defaults to the current month that
|
54
|
+
# # will use keys like "1 - January", "3 - March".
|
55
|
+
# select_month(Date.today, :add_month_numbers => true)
|
56
|
+
#
|
57
|
+
# # Generates a select field for months that defaults to the current month that
|
58
|
+
# # will use keys like "Jan", "Mar".
|
59
|
+
# select_month(Date.today, :use_short_month => true)
|
60
|
+
#
|
61
|
+
# # Generates a select field for months that defaults to the current month that
|
62
|
+
# # will use keys like "Januar", "Marts."
|
63
|
+
# select_month(Date.today, :use_month_names => %w(Januar Februar Marts ...))
|
64
|
+
#
|
65
|
+
def select_month(date, options = {}, html_options = {})
|
66
|
+
DateTimeSelector.new(date, options.merge(:use_standalone_month_names => true), html_options).select_month
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class DateTimeSelector #:nodoc:
|
71
|
+
private
|
72
|
+
# Returns translated month names
|
73
|
+
# => [nil, "January", "February", "March",
|
74
|
+
# "April", "May", "June", "July",
|
75
|
+
# "August", "September", "October",
|
76
|
+
# "November", "December"]
|
77
|
+
#
|
78
|
+
# If :use_short_month option is set
|
79
|
+
# => [nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
80
|
+
# "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
81
|
+
#
|
82
|
+
# Also looks up if <tt>:discard_day</tt> or <tt>:use_standalone_month_names</tt> option is set
|
83
|
+
# and uses i18n standalone month names if so.
|
84
|
+
#
|
85
|
+
#
|
86
|
+
# Также в зависимости от использования ключей <tt>:discard_day</tt> или <tt>:use_standalone_month_names</tt>
|
87
|
+
# убеждается, есть ли соотвествующие переводы в текущем языке и использует "отдельностоящие" названия
|
88
|
+
# месяцев по необходимости
|
89
|
+
def translated_month_names
|
90
|
+
if @options[:use_short_month]
|
91
|
+
if I18n.backend.send(:lookup, I18n.locale, :'date.common_abbr_month_names')
|
92
|
+
if (@options[:discard_day] || @options[:use_standalone_month_names])
|
93
|
+
key = :'date.standalone_abbr_month_names'
|
94
|
+
else
|
95
|
+
key = :'date.common_abbr_month_names'
|
96
|
+
end
|
97
|
+
else
|
98
|
+
key = :'date.abbr_month_names'
|
99
|
+
end
|
100
|
+
else
|
101
|
+
if I18n.backend.send(:lookup, I18n.locale, :'date.common_month_names')
|
102
|
+
if (@options[:discard_day] || @options[:use_standalone_month_names])
|
103
|
+
key = :'date.standalone_month_names'
|
104
|
+
else
|
105
|
+
key = :'date.common_month_names'
|
106
|
+
end
|
107
|
+
else
|
108
|
+
key = :'date.month_names'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
I18n.translate(key, :locale => @options[:locale])
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end # if defined?
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
if defined?(ActiveModel::Errors)
|
4
|
+
module ActiveModel
|
5
|
+
class Errors
|
6
|
+
# Redefine the ActiveModel::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
|
+
# Переопределяет метод ActiveModel::Errors.full_messages. Сообщения об ошибках для атрибутов
|
13
|
+
# теперь не имеют префикса с названием атрибута если в сообщении об ошибке первым символом указан "^".
|
14
|
+
#
|
15
|
+
# Так, например,
|
16
|
+
#
|
17
|
+
# validates_acceptance_of :accepted_terms, :message => 'нужно принять соглашение'
|
18
|
+
#
|
19
|
+
# даст сообщение
|
20
|
+
#
|
21
|
+
# Accepted terms нужно принять соглашение
|
22
|
+
#
|
23
|
+
# однако,
|
24
|
+
#
|
25
|
+
# validates_acceptance_of :accepted_terms, :message => '^Нужно принять соглашение'
|
26
|
+
#
|
27
|
+
# даст сообщение
|
28
|
+
#
|
29
|
+
# Нужно принять соглашение
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# Returns all the full error messages in an array.
|
33
|
+
#
|
34
|
+
# class Company
|
35
|
+
# validates_presence_of :name, :address, :email
|
36
|
+
# validates_length_of :name, :in => 5..30
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# company = Company.create(:address => '123 First St.')
|
40
|
+
# company.errors.full_messages # =>
|
41
|
+
# ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Address can't be blank"]
|
42
|
+
def full_messages
|
43
|
+
full_messages = []
|
44
|
+
|
45
|
+
each do |attribute, messages|
|
46
|
+
messages = Array.wrap(messages)
|
47
|
+
next if messages.empty?
|
48
|
+
|
49
|
+
if attribute == :base
|
50
|
+
messages.each {|m| full_messages << m }
|
51
|
+
else
|
52
|
+
attr_name = attribute.to_s.gsub('.', '_').humanize
|
53
|
+
attr_name = @base.class.human_attribute_name(attribute, :default => attr_name)
|
54
|
+
options = { :attribute => attr_name, :default => "%{attribute} %{message}" }
|
55
|
+
|
56
|
+
messages.each do |m|
|
57
|
+
if m =~ /^\^/
|
58
|
+
full_messages << m[1..-1]
|
59
|
+
else
|
60
|
+
full_messages << I18n.t(:"errors.format", options.merge(:message => m))
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
full_messages
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end # if defined?
|
@@ -0,0 +1,212 @@
|
|
1
|
+
ru:
|
2
|
+
number:
|
3
|
+
# Используется в number_with_delimiter()
|
4
|
+
# Также является установками по умолчанию для 'currency', 'percentage', 'precision', 'human'
|
5
|
+
#
|
6
|
+
# Used in number_with_delimiter()
|
7
|
+
# These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
|
8
|
+
format:
|
9
|
+
# Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
|
10
|
+
separator: ","
|
11
|
+
# Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three)
|
12
|
+
delimiter: " "
|
13
|
+
# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
|
14
|
+
precision: 3
|
15
|
+
significant: false
|
16
|
+
strip_insignificant_zeros: false
|
17
|
+
|
18
|
+
# Used in number_to_currency()
|
19
|
+
currency:
|
20
|
+
format:
|
21
|
+
# Формат отображения валюты и обозначение самой валюты
|
22
|
+
#
|
23
|
+
#
|
24
|
+
format: "%n %u"
|
25
|
+
negative_format: "-%n %u"
|
26
|
+
unit: "руб."
|
27
|
+
# These three are to override number.format and are optional
|
28
|
+
separator: "."
|
29
|
+
delimiter: " "
|
30
|
+
precision: 2
|
31
|
+
significant: false
|
32
|
+
strip_insignificant_zeros: false
|
33
|
+
|
34
|
+
# Used in number_to_percentage()
|
35
|
+
percentage:
|
36
|
+
format:
|
37
|
+
# These three are to override number.format and are optional
|
38
|
+
# separator:
|
39
|
+
delimiter: ""
|
40
|
+
|
41
|
+
# Used in number_to_precision()
|
42
|
+
precision:
|
43
|
+
format:
|
44
|
+
# These three are to override number.format and are optional
|
45
|
+
# separator:
|
46
|
+
delimiter: ""
|
47
|
+
# precision:
|
48
|
+
|
49
|
+
# Used in number_to_human_size()
|
50
|
+
human:
|
51
|
+
format:
|
52
|
+
# These three are to override number.format and are optional
|
53
|
+
# separator:
|
54
|
+
delimiter: ""
|
55
|
+
precision: 1
|
56
|
+
significant: false
|
57
|
+
strip_insignificant_zeros: false
|
58
|
+
|
59
|
+
# Rails 2.2
|
60
|
+
# storage_units: [байт, КБ, МБ, ГБ, ТБ]
|
61
|
+
|
62
|
+
# Rails 2.3+
|
63
|
+
storage_units:
|
64
|
+
# Storage units output formatting.
|
65
|
+
# %u is the storage unit, %n is the number (default: 2 MB)
|
66
|
+
format: "%n %u"
|
67
|
+
units:
|
68
|
+
byte:
|
69
|
+
one: "байт"
|
70
|
+
few: "байта"
|
71
|
+
many: "байт"
|
72
|
+
other: "байта"
|
73
|
+
kb: "КБ"
|
74
|
+
mb: "МБ"
|
75
|
+
gb: "ГБ"
|
76
|
+
tb: "ТБ"
|
77
|
+
|
78
|
+
decimal_units:
|
79
|
+
format: "%n %u"
|
80
|
+
units:
|
81
|
+
unit: ""
|
82
|
+
thousand:
|
83
|
+
one: "тысяча"
|
84
|
+
few: "тысяч"
|
85
|
+
many: "тысяч"
|
86
|
+
other: "тысяч"
|
87
|
+
million:
|
88
|
+
one: "миллион"
|
89
|
+
few: "миллионов"
|
90
|
+
many: "миллионов"
|
91
|
+
other: "миллионов"
|
92
|
+
billion:
|
93
|
+
one: "миллиард"
|
94
|
+
few: "миллиардов"
|
95
|
+
many: "миллиардов"
|
96
|
+
other: "миллиардов"
|
97
|
+
trillion:
|
98
|
+
one: "триллион"
|
99
|
+
few: "триллионов"
|
100
|
+
many: "триллионов"
|
101
|
+
other: "триллионов"
|
102
|
+
quadrillion:
|
103
|
+
one: "квадриллион"
|
104
|
+
few: "квадриллионов"
|
105
|
+
many: "квадриллионов"
|
106
|
+
other: "квадриллионов"
|
107
|
+
|
108
|
+
# Используется в хелперах distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
|
109
|
+
#
|
110
|
+
#
|
111
|
+
# Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
|
112
|
+
datetime:
|
113
|
+
distance_in_words:
|
114
|
+
half_a_minute: "меньше минуты"
|
115
|
+
less_than_x_seconds:
|
116
|
+
one: "меньше %{count} секунды"
|
117
|
+
few: "меньше %{count} секунд"
|
118
|
+
many: "меньше %{count} секунд"
|
119
|
+
other: "меньше %{count} секунды"
|
120
|
+
x_seconds:
|
121
|
+
one: "%{count} секунда"
|
122
|
+
few: "%{count} секунды"
|
123
|
+
many: "%{count} секунд"
|
124
|
+
other: "%{count} секунды"
|
125
|
+
less_than_x_minutes:
|
126
|
+
one: "меньше %{count} минуты"
|
127
|
+
few: "меньше %{count} минут"
|
128
|
+
many: "меньше %{count} минут"
|
129
|
+
other: "меньше %{count} минуты"
|
130
|
+
x_minutes:
|
131
|
+
one: "%{count} минута"
|
132
|
+
few: "%{count} минуты"
|
133
|
+
many: "%{count} минут"
|
134
|
+
other: "%{count} минуты"
|
135
|
+
about_x_hours:
|
136
|
+
one: "около %{count} часа"
|
137
|
+
few: "около %{count} часов"
|
138
|
+
many: "около %{count} часов"
|
139
|
+
other: "около %{count} часа"
|
140
|
+
x_days:
|
141
|
+
one: "%{count} день"
|
142
|
+
few: "%{count} дня"
|
143
|
+
many: "%{count} дней"
|
144
|
+
other: "%{count} дня"
|
145
|
+
about_x_months:
|
146
|
+
one: "около %{count} месяца"
|
147
|
+
few: "около %{count} месяцев"
|
148
|
+
many: "около %{count} месяцев"
|
149
|
+
other: "около %{count} месяца"
|
150
|
+
x_months:
|
151
|
+
one: "%{count} месяц"
|
152
|
+
few: "%{count} месяца"
|
153
|
+
many: "%{count} месяцев"
|
154
|
+
other: "%{count} месяца"
|
155
|
+
about_x_years:
|
156
|
+
one: "около %{count} года"
|
157
|
+
few: "около %{count} лет"
|
158
|
+
many: "около %{count} лет"
|
159
|
+
other: "около %{count} лет"
|
160
|
+
over_x_years:
|
161
|
+
one: "больше %{count} года"
|
162
|
+
few: "больше %{count} лет"
|
163
|
+
many: "больше %{count} лет"
|
164
|
+
other: "больше %{count} лет"
|
165
|
+
almost_x_years:
|
166
|
+
one: "почти %{count} год"
|
167
|
+
few: "почти %{count} года"
|
168
|
+
many: "почти %{count} лет"
|
169
|
+
other: "почти %{count} лет"
|
170
|
+
|
171
|
+
prompts:
|
172
|
+
year: "Год"
|
173
|
+
month: "Месяц"
|
174
|
+
day: "День"
|
175
|
+
hour: "Часов"
|
176
|
+
minute: "Минут"
|
177
|
+
second: "Секунд"
|
178
|
+
|
179
|
+
# Используется в хелпере error_messages_for
|
180
|
+
activerecord:
|
181
|
+
errors:
|
182
|
+
template:
|
183
|
+
# Заголовок сообщения об ошибке
|
184
|
+
header:
|
185
|
+
one: "%{model}: сохранение не удалось из-за %{count} ошибки"
|
186
|
+
few: "%{model}: сохранение не удалось из-за %{count} ошибок"
|
187
|
+
many: "%{model}: сохранение не удалось из-за %{count} ошибок"
|
188
|
+
other: "%{model}: сохранение не удалось из-за %{count} ошибки"
|
189
|
+
|
190
|
+
# Первый параграф сообщения об ошибке. Можно использовать макрос %{count}
|
191
|
+
#
|
192
|
+
#
|
193
|
+
# The variable :count is also available
|
194
|
+
body: "Проблемы возникли со следующими полями:"
|
195
|
+
|
196
|
+
support:
|
197
|
+
select:
|
198
|
+
# default value for :prompt => true in FormOptionsHelper
|
199
|
+
prompt: "Выберите: "
|
200
|
+
|
201
|
+
helpers:
|
202
|
+
select:
|
203
|
+
# default value for :prompt => true in FormOptionsHelper
|
204
|
+
prompt: "Выберите: "
|
205
|
+
|
206
|
+
|
207
|
+
# Default translation keys for submit FormHelper
|
208
|
+
submit:
|
209
|
+
create: 'Создать %{model}'
|
210
|
+
update: 'Сохранить %{model}'
|
211
|
+
submit: 'Сохранить %{model}'
|
212
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
ru:
|
2
|
+
errors:
|
3
|
+
format: "%{attribute} %{message}"
|
4
|
+
|
5
|
+
messages:
|
6
|
+
inclusion: "имеет непредусмотренное значение"
|
7
|
+
exclusion: "имеет зарезервированное значение"
|
8
|
+
invalid: "имеет неверное значение"
|
9
|
+
confirmation: "не совпадает с подтверждением"
|
10
|
+
accepted: "нужно подтвердить"
|
11
|
+
empty: "не может быть пустым"
|
12
|
+
blank: "не может быть пустым"
|
13
|
+
too_long:
|
14
|
+
one: "слишком большой длины (не может быть больше чем %{count} символ)"
|
15
|
+
few: "слишком большой длины (не может быть больше чем %{count} символа)"
|
16
|
+
many: "слишком большой длины (не может быть больше чем %{count} символов)"
|
17
|
+
other: "слишком большой длины (не может быть больше чем %{count} символа)"
|
18
|
+
too_short:
|
19
|
+
one: "недостаточной длины (не может быть меньше %{count} символа)"
|
20
|
+
few: "недостаточной длины (не может быть меньше %{count} символов)"
|
21
|
+
many: "недостаточной длины (не может быть меньше %{count} символов)"
|
22
|
+
other: "недостаточной длины (не может быть меньше %{count} символа)"
|
23
|
+
wrong_length:
|
24
|
+
one: "неверной длины (может быть длиной ровно %{count} символ)"
|
25
|
+
few: "неверной длины (может быть длиной ровно %{count} символа)"
|
26
|
+
many: "неверной длины (может быть длиной ровно %{count} символов)"
|
27
|
+
other: "неверной длины (может быть длиной ровно %{count} символа)"
|
28
|
+
taken: "уже существует"
|
29
|
+
not_a_number: "не является числом"
|
30
|
+
not_an_integer: "не является целым числом"
|
31
|
+
greater_than: "может иметь значение большее %{count}"
|
32
|
+
greater_than_or_equal_to: "может иметь значение большее или равное %{count}"
|
33
|
+
equal_to: "может иметь лишь значение, равное %{count}"
|
34
|
+
less_than: "может иметь значение меньшее чем %{count}"
|
35
|
+
less_than_or_equal_to: "может иметь значение меньшее или равное %{count}"
|
36
|
+
odd: "может иметь лишь четное значение"
|
37
|
+
even: "может иметь лишь нечетное значение"
|
38
|
+
record_invalid: "Возникли ошибки: %{errors}"
|
39
|
+
|
40
|
+
template:
|
41
|
+
# Заголовок сообщения об ошибке
|
42
|
+
header:
|
43
|
+
one: "%{model}: сохранение не удалось из-за %{count} ошибки"
|
44
|
+
few: "%{model}: сохранение не удалось из-за %{count} ошибок"
|
45
|
+
many: "%{model}: сохранение не удалось из-за %{count} ошибок"
|
46
|
+
other: "%{model}: сохранение не удалось из-за %{count} ошибки"
|
47
|
+
|
48
|
+
# Первый параграф сообщения об ошибке. Можно использовать макрос %{count}
|
49
|
+
# The variable :count is also available
|
50
|
+
body: "Проблемы возникли со следующими полями:"
|
@@ -0,0 +1,95 @@
|
|
1
|
+
ru:
|
2
|
+
activerecord:
|
3
|
+
# Сообщения об ошибке (валидации) ActiveRecord
|
4
|
+
errors:
|
5
|
+
# Для всех сообщений доступны макросы %{model}, {{attribute}}, {{value}}.
|
6
|
+
# Для некоторых доступен макрос %{count} -- в этом случае можно задать несколько вариантов
|
7
|
+
# сообщения (плюрализация)
|
8
|
+
#
|
9
|
+
# Также можно использовать сообщения, начинающиеся с "^" -- в этом случае
|
10
|
+
# в списке ошибок валидации перед конкретным сообщением не будет выводиться имя атрибута.
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# The values :model, :attribute and :value are always available for interpolation
|
14
|
+
# The value :count is available when applicable. Can be used for pluralization.
|
15
|
+
#
|
16
|
+
# You can use ^-prefixed messages as well to get rid of human attribute name appearing
|
17
|
+
# before your message in validation messages.
|
18
|
+
messages:
|
19
|
+
inclusion: "имеет непредусмотренное значение"
|
20
|
+
exclusion: "имеет зарезервированное значение"
|
21
|
+
invalid: "имеет неверное значение"
|
22
|
+
confirmation: "не совпадает с подтверждением"
|
23
|
+
accepted: "нужно подтвердить"
|
24
|
+
empty: "не может быть пустым"
|
25
|
+
blank: "не может быть пустым"
|
26
|
+
too_long:
|
27
|
+
one: "слишком большой длины (не может быть больше чем %{count} символ)"
|
28
|
+
few: "слишком большой длины (не может быть больше чем %{count} символа)"
|
29
|
+
many: "слишком большой длины (не может быть больше чем %{count} символов)"
|
30
|
+
other: "слишком большой длины (не может быть больше чем %{count} символа)"
|
31
|
+
too_short:
|
32
|
+
one: "недостаточной длины (не может быть меньше %{count} символа)"
|
33
|
+
few: "недостаточной длины (не может быть меньше %{count} символов)"
|
34
|
+
many: "недостаточной длины (не может быть меньше %{count} символов)"
|
35
|
+
other: "недостаточной длины (не может быть меньше %{count} символа)"
|
36
|
+
wrong_length:
|
37
|
+
one: "неверной длины (может быть длиной ровно %{count} символ)"
|
38
|
+
few: "неверной длины (может быть длиной ровно %{count} символа)"
|
39
|
+
many: "неверной длины (может быть длиной ровно %{count} символов)"
|
40
|
+
other: "неверной длины (может быть длиной ровно %{count} символа)"
|
41
|
+
taken: "уже существует"
|
42
|
+
not_a_number: "не является числом"
|
43
|
+
greater_than: "может иметь лишь значение большее %{count}"
|
44
|
+
greater_than_or_equal_to: "может иметь лишь значение большее или равное %{count}"
|
45
|
+
equal_to: "может иметь лишь значение, равное %{count}"
|
46
|
+
less_than: "может иметь лишь значение меньшее чем %{count}"
|
47
|
+
less_than_or_equal_to: "может иметь значение меньшее или равное %{count}"
|
48
|
+
odd: "может иметь лишь четное значение"
|
49
|
+
even: "может иметь лишь нечетное значение"
|
50
|
+
record_invalid: "Возникли ошибки: %{errors}"
|
51
|
+
|
52
|
+
full_messages:
|
53
|
+
format: "%{attribute} %{message}"
|
54
|
+
|
55
|
+
# Можно добавить собственные сообщения об ошибке тут или задавать их в контексте атрибута.
|
56
|
+
#
|
57
|
+
#
|
58
|
+
# Append your own errors here or at the model/attributes scope.
|
59
|
+
#
|
60
|
+
#
|
61
|
+
# Например,
|
62
|
+
# models:
|
63
|
+
# user:
|
64
|
+
# # Задает сообщение об ошибке (пустое значение) для атрибутов модели User
|
65
|
+
# # Можно использовать макросы %{model}, {{attribute}}.
|
66
|
+
# # Также можно использовать сообщения, начинающиеся с "^" -- в этом случае
|
67
|
+
# # в списке ошибок валидации перед конкретным сообщением не будет выводиться имя атрибута.
|
68
|
+
# blank: "собственное сообщение об ошибке (пустой атрибут) для модели %{model} и атрибута {{attribute}}"
|
69
|
+
# attributes:
|
70
|
+
# # Также можно задавать собственные сообщения об ошибке для конкретных атрибутов модели.
|
71
|
+
# # Ниже определим собственное сообщение об ошибке для атрибута name модели User.
|
72
|
+
# name:
|
73
|
+
# blank: "Атрибут %{attribute} особенный -- у него свое сообщение об ошибке при пустом атрибуте"
|
74
|
+
models:
|
75
|
+
|
76
|
+
# Перевод названий моделей. Используется в Model.human_name().
|
77
|
+
#
|
78
|
+
#models:
|
79
|
+
# Например,
|
80
|
+
# user: "Пользователь"
|
81
|
+
# переведет модель User как "Пользователь".
|
82
|
+
#
|
83
|
+
#
|
84
|
+
# Overrides default messages
|
85
|
+
|
86
|
+
# Перевод названий атрибутов моделей. Используется в Model.human_attribute_name(attribute).
|
87
|
+
#attributes:
|
88
|
+
# Например,
|
89
|
+
# user:
|
90
|
+
# name: "Имя"
|
91
|
+
# переведет атрибут name модели User как "Имя".
|
92
|
+
#
|
93
|
+
#
|
94
|
+
# Overrides model and default messages.
|
95
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
ru:
|
2
|
+
# Используется в array.to_sentence
|
3
|
+
#
|
4
|
+
#
|
5
|
+
# Used in array.to_sentence.
|
6
|
+
support:
|
7
|
+
array:
|
8
|
+
# Rails 2.2
|
9
|
+
sentence_connector: "и"
|
10
|
+
skip_last_comma: true
|
11
|
+
|
12
|
+
# Rails 2.3
|
13
|
+
words_connector: ", "
|
14
|
+
two_words_connector: " и "
|
15
|
+
last_word_connector: " и "
|
16
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
# Context-based month name and day name switching for Russian
|
4
|
+
#
|
5
|
+
# Названия месяцев и дней недели в зависимости от контекста ("1 декабря", но "Декабрь 1985")
|
6
|
+
{
|
7
|
+
:ru => {
|
8
|
+
:date => {
|
9
|
+
:abbr_day_names => lambda { |key, options|
|
10
|
+
if options[:format] && options[:format] =~ Russian::LOCALIZE_STANDALONE_ABBR_DAY_NAMES_MATCH
|
11
|
+
:'date.common_abbr_day_names'
|
12
|
+
else
|
13
|
+
:'date.standalone_abbr_day_names'
|
14
|
+
end
|
15
|
+
},
|
16
|
+
:day_names => lambda { |key, options|
|
17
|
+
if options[:format] && options[:format] =~ Russian::LOCALIZE_STANDALONE_DAY_NAMES_MATCH
|
18
|
+
:'date.standalone_day_names'
|
19
|
+
else
|
20
|
+
:'date.common_day_names'
|
21
|
+
end
|
22
|
+
},
|
23
|
+
:abbr_month_names => lambda { |key, options|
|
24
|
+
if options[:format] && options[:format] =~ Russian::LOCALIZE_ABBR_MONTH_NAMES_MATCH
|
25
|
+
:'date.common_abbr_month_names'
|
26
|
+
else
|
27
|
+
:'date.standalone_abbr_month_names'
|
28
|
+
end
|
29
|
+
},
|
30
|
+
:month_names => lambda { |key, options|
|
31
|
+
if options[:format] && options[:format] =~ Russian::LOCALIZE_MONTH_NAMES_MATCH
|
32
|
+
:'date.common_month_names'
|
33
|
+
else
|
34
|
+
:'date.standalone_month_names'
|
35
|
+
end
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
ru:
|
2
|
+
date:
|
3
|
+
formats:
|
4
|
+
# Форматы указываются в виде, поддерживаемом strftime.
|
5
|
+
# По умолчанию используется default.
|
6
|
+
# Можно добавлять собственные форматы
|
7
|
+
#
|
8
|
+
#
|
9
|
+
# Use the strftime parameters for formats.
|
10
|
+
# When no format has been given, it uses default.
|
11
|
+
# You can provide other formats here if you like!
|
12
|
+
default: "%d.%m.%Y"
|
13
|
+
short: "%d %b"
|
14
|
+
long: "%d %B %Y"
|
15
|
+
|
16
|
+
# Названия дней недели -- контекстные и отдельностоящие
|
17
|
+
common_day_names: [воскресенье, понедельник, вторник, среда, четверг, пятница, суббота]
|
18
|
+
standalone_day_names: [Воскресенье, Понедельник, Вторник, Среда, Четверг, Пятница, Суббота]
|
19
|
+
common_abbr_day_names: [Вс, Пн, Вт, Ср, Чт, Пт, Сб]
|
20
|
+
standalone_abbr_day_names: [вс, пн, вт, ср, чт, пт, сб]
|
21
|
+
|
22
|
+
# Названия месяцев -- сокращенные и полные, плюс отдельностоящие.
|
23
|
+
# Не забудьте nil в начале массиве (~)
|
24
|
+
#
|
25
|
+
#
|
26
|
+
# Don't forget the nil at the beginning; there's no such thing as a 0th month
|
27
|
+
common_month_names: [~, января, февраля, марта, апреля, мая, июня, июля, августа, сентября, октября, ноября, декабря]
|
28
|
+
standalone_month_names: [~, Январь, Февраль, Март, Апрель, Май, Июнь, Июль, Август, Сентябрь, Октябрь, Ноябрь, Декабрь]
|
29
|
+
common_abbr_month_names: [~, янв, фев, мар, апр, мая, июн, июл, авг, сен, окт, ноя, дек]
|
30
|
+
standalone_abbr_month_names: [~, янв, фев, мар, апр, май, июн, июл, авг, сен, окт, ноя, дек]
|
31
|
+
|
32
|
+
# Порядок компонентов даты для хелперов
|
33
|
+
#
|
34
|
+
#
|
35
|
+
# Used in date_select and datime_select.
|
36
|
+
order:
|
37
|
+
- :day
|
38
|
+
- :month
|
39
|
+
- :year
|
40
|
+
|
41
|
+
time:
|
42
|
+
# Форматы времени
|
43
|
+
formats:
|
44
|
+
default: "%a, %d %b %Y, %H:%M:%S %z"
|
45
|
+
short: "%d %b, %H:%M"
|
46
|
+
long: "%d %B %Y, %H:%M"
|
47
|
+
|
48
|
+
# am/pm решено перевести как "утра/вечера" :)
|
49
|
+
am: "утра"
|
50
|
+
pm: "вечера"
|