Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
13867a3f
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
13867a3f
编写于
4月 30, 2010
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use %{} syntax in I18n (faster) instead of {{}}.
上级
efba1d42
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
29 deletion
+29
-29
actionpack/lib/action_view/helpers/form_helper.rb
actionpack/lib/action_view/helpers/form_helper.rb
+3
-3
actionpack/lib/action_view/locale/en.yml
actionpack/lib/action_view/locale/en.yml
+14
-14
activemodel/lib/active_model/errors.rb
activemodel/lib/active_model/errors.rb
+1
-1
activemodel/lib/active_model/locale/en.yml
activemodel/lib/active_model/locale/en.yml
+9
-9
activerecord/lib/active_record/locale/en.yml
activerecord/lib/active_record/locale/en.yml
+2
-2
未找到文件。
actionpack/lib/action_view/helpers/form_helper.rb
浏览文件 @
13867a3f
...
...
@@ -1165,13 +1165,13 @@ def hidden_field(method, options = {})
# submit button label, otherwise, it uses "Update Post".
#
# Those labels can be customized using I18n, under the helpers.submit key and accept
# the
{{model}
} as translation interpolation:
# the
%{model
} as translation interpolation:
#
# en:
# helpers:
# submit:
# create: "Create a
{{model}
}"
# update: "Confirm changes to
{{model}
}"
# create: "Create a
%{model
}"
# update: "Confirm changes to
%{model
}"
#
# It also searches for a key specific for the given object:
#
...
...
actionpack/lib/action_view/locale/en.yml
浏览文件 @
13867a3f
...
...
@@ -102,37 +102,37 @@
half_a_minute
:
"
half
a
minute"
less_than_x_seconds
:
one
:
"
less
than
1
second"
other
:
"
less
than
{{count}
}
seconds"
other
:
"
less
than
%{count
}
seconds"
x_seconds
:
one
:
"
1
second"
other
:
"
{{count}
}
seconds"
other
:
"
%{count
}
seconds"
less_than_x_minutes
:
one
:
"
less
than
a
minute"
other
:
"
less
than
{{count}
}
minutes"
other
:
"
less
than
%{count
}
minutes"
x_minutes
:
one
:
"
1
minute"
other
:
"
{{count}
}
minutes"
other
:
"
%{count
}
minutes"
about_x_hours
:
one
:
"
about
1
hour"
other
:
"
about
{{count}
}
hours"
other
:
"
about
%{count
}
hours"
x_days
:
one
:
"
1
day"
other
:
"
{{count}
}
days"
other
:
"
%{count
}
days"
about_x_months
:
one
:
"
about
1
month"
other
:
"
about
{{count}
}
months"
other
:
"
about
%{count
}
months"
x_months
:
one
:
"
1
month"
other
:
"
{{count}
}
months"
other
:
"
%{count
}
months"
about_x_years
:
one
:
"
about
1
year"
other
:
"
about
{{count}
}
years"
other
:
"
about
%{count
}
years"
over_x_years
:
one
:
"
over
1
year"
other
:
"
over
{{count}
}
years"
other
:
"
over
%{count
}
years"
almost_x_years
:
one
:
"
almost
1
year"
other
:
"
almost
{{count}
}
years"
other
:
"
almost
%{count
}
years"
prompts
:
year
:
"
Year"
month
:
"
Month"
...
...
@@ -148,7 +148,7 @@
# Default translation keys for submit FormHelper
submit
:
create
:
'
Create
{{model}
}'
update
:
'
Update
{{model}
}'
submit
:
'
Save
{{model}
}'
create
:
'
Create
%{model
}'
update
:
'
Update
%{model
}'
submit
:
'
Save
%{model
}'
activemodel/lib/active_model/errors.rb
浏览文件 @
13867a3f
...
...
@@ -223,7 +223,7 @@ def full_messages
else
attr_name
=
attribute
.
to_s
.
gsub
(
'.'
,
'_'
).
humanize
attr_name
=
@base
.
class
.
human_attribute_name
(
attribute
,
:default
=>
attr_name
)
options
=
{
:default
=>
"
{{attribute}} {{message}
}"
,
:attribute
=>
attr_name
}
options
=
{
:default
=>
"
%{attribute} %{message
}"
,
:attribute
=>
attr_name
}
messages
.
each
do
|
m
|
full_messages
<<
I18n
.
t
(
:"errors.format"
,
options
.
merge
(
:message
=>
m
))
...
...
activemodel/lib/active_model/locale/en.yml
浏览文件 @
13867a3f
en
:
errors
:
# The default format use in full error messages.
format
:
"
{{attribute}}
{{message}
}"
format
:
"
%{attribute}
%{message
}"
# The values :model, :attribute and :value are always available for interpolation
# The value :count is available when applicable. Can be used for pluralization.
...
...
@@ -13,15 +13,15 @@ en:
accepted
:
"
must
be
accepted"
empty
:
"
can't
be
empty"
blank
:
"
can't
be
blank"
too_long
:
"
is
too
long
(maximum
is
{{count}
}
characters)"
too_short
:
"
is
too
short
(minimum
is
{{count}
}
characters)"
wrong_length
:
"
is
the
wrong
length
(should
be
{{count}
}
characters)"
too_long
:
"
is
too
long
(maximum
is
%{count
}
characters)"
too_short
:
"
is
too
short
(minimum
is
%{count
}
characters)"
wrong_length
:
"
is
the
wrong
length
(should
be
%{count
}
characters)"
not_a_number
:
"
is
not
a
number"
not_an_integer
:
"
must
be
an
integer"
greater_than
:
"
must
be
greater
than
{{count}
}"
greater_than_or_equal_to
:
"
must
be
greater
than
or
equal
to
{{count}
}"
equal_to
:
"
must
be
equal
to
{{count}
}"
less_than
:
"
must
be
less
than
{{count}
}"
less_than_or_equal_to
:
"
must
be
less
than
or
equal
to
{{count}
}"
greater_than
:
"
must
be
greater
than
%{count
}"
greater_than_or_equal_to
:
"
must
be
greater
than
or
equal
to
%{count
}"
equal_to
:
"
must
be
equal
to
%{count
}"
less_than
:
"
must
be
less
than
%{count
}"
less_than_or_equal_to
:
"
must
be
less
than
or
equal
to
%{count
}"
odd
:
"
must
be
odd"
even
:
"
must
be
even"
activerecord/lib/active_record/locale/en.yml
浏览文件 @
13867a3f
...
...
@@ -9,7 +9,7 @@ en:
errors
:
messages
:
taken
:
"
has
already
been
taken"
record_invalid
:
"
Validation
failed:
{{errors}
}"
record_invalid
:
"
Validation
failed:
%{errors
}"
# Append your own errors here or at the model/attributes scope.
# You can define own errors for models or model attributes.
...
...
@@ -18,7 +18,7 @@ en:
# For example,
# models:
# user:
# blank: "This is a custom blank message for
{{model}}: {{attribute}
}"
# blank: "This is a custom blank message for
%{model}: %{attribute
}"
# attributes:
# login:
# blank: "This is a custom blank message for User login"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录