mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
replaced MODEL.human_name with MODEL.model_name.human now that .human_name is deprecated
This commit is contained in:
parent
435bf4ca4b
commit
04eaacca96
1 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
h2. Rails Internationalization (I18n) API
|
||||
lh2. Rails Internationalization (I18n) API
|
||||
|
||||
The Ruby I18n (shorthand for _internationalization_) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for *translating your application to a single custom language* other than English or for *providing multi-language support* in your application.
|
||||
|
||||
|
@ -649,7 +649,7 @@ Generally we recommend using YAML as a format for storing translations. There ar
|
|||
|
||||
h4. Translations for Active Record Models
|
||||
|
||||
You can use the methods +Model.human_name+ and +Model.human_attribute_name(attribute)+ to transparently look up translations for your model and attribute names.
|
||||
You can use the methods +Model.model_name.human+ and +Model.human_attribute_name(attribute)+ to transparently look up translations for your model and attribute names.
|
||||
|
||||
For example when you add the following translations:
|
||||
|
||||
|
@ -664,7 +664,7 @@ en:
|
|||
# will translate User attribute "login" as "Handle"
|
||||
</ruby>
|
||||
|
||||
Then +User.human_name+ will return "Dude" and +User.human_attribute_name("login")+ will return "Handle".
|
||||
Then +User.model_name.human+ will return "Dude" and +User.human_attribute_name("login")+ will return "Handle".
|
||||
|
||||
h5. Error Message Scopes
|
||||
|
||||
|
@ -786,9 +786,9 @@ h5. Action View Helper Methods
|
|||
|
||||
h5. Active Record Methods
|
||||
|
||||
* +human_name+ and +human_attribute_name+ use translations for model names and attribute names if available in the "activerecord.models":http://github.com/rails/rails/blob/master/activerecord/lib/active_record/locale/en.yml#L29 scope. They also support translations for inherited class names (e.g. for use with STI) as explained above in "Error message scopes".
|
||||
* +model_name.human+ and +human_attribute_name+ use translations for model names and attribute names if available in the "activerecord.models":http://github.com/rails/rails/blob/master/activerecord/lib/active_record/locale/en.yml#L29 scope. They also support translations for inherited class names (e.g. for use with STI) as explained above in "Error message scopes".
|
||||
|
||||
* +ActiveRecord::Errors#generate_message+ (which is used by Active Record validations but may also be used manually) uses +human_name+ and +human_attribute_name+ (see above). It also translates the error message and supports translations for inherited class names as explained above in "Error message scopes".
|
||||
* +ActiveRecord::Errors#generate_message+ (which is used by Active Record validations but may also be used manually) uses +model_name.human+ and +human_attribute_name+ (see above). It also translates the error message and supports translations for inherited class names as explained above in "Error message scopes".
|
||||
|
||||
*+ ActiveRecord::Errors#full_messages+ prepends the attribute name to the error message using a separator that will be looked up from "activerecord.errors.format.separator":http://github.com/rails/rails/blob/master/actionpack/lib/action_view/locale/en.yml#L91 (and which defaults to +' '+).
|
||||
|
||||
|
|
Loading…
Reference in a new issue