aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/i18n.md
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source/i18n.md')
-rw-r--r--guides/source/i18n.md18
1 files changed, 9 insertions, 9 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index 339b356a78..f1b6128762 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -829,14 +829,14 @@ For example when you add the following translations:
en:
activerecord:
models:
- user: Dude
+ user: Customer
attributes:
user:
login: "Handle"
# will translate User attribute "login" as "Handle"
```
-Then `User.model_name.human` will return "Dude" and `User.human_attribute_name("login")` will return "Handle".
+Then `User.model_name.human` will return "Customer" and `User.human_attribute_name("login")` will return "Handle".
You can also set a plural form for model names, adding as following:
@@ -845,11 +845,11 @@ en:
activerecord:
models:
user:
- one: Dude
- other: Dudes
+ one: Customer
+ other: Customers
```
-Then `User.model_name.human(count: 2)` will return "Dudes". With `count: 1` or without params will return "Dude".
+Then `User.model_name.human(count: 2)` will return "Customers". With `count: 1` or without params will return "Customer".
In the event you need to access nested attributes within a given model, you should nest these under `model/attribute` at the model level of your translation file:
@@ -857,12 +857,12 @@ In the event you need to access nested attributes within a given model, you shou
en:
activerecord:
attributes:
- user/gender:
- female: "Female"
- male: "Male"
+ user/subscribed_to_newsletter:
+ true: "True"
+ false: "False"
```
-Then `User.human_attribute_name("gender.female")` will return "Female".
+Then `User.human_attribute_name("subscribed_to_newsletter.true")` will return "True".
NOTE: If you are using a class which includes `ActiveModel` and does not inherit from `ActiveRecord::Base`, replace `activerecord` with `activemodel` in the above key paths.