Skip to content

Commit 7b91c8f

Browse files
committed
Relax dot-separated locale keys guideline
1 parent adde07e commit 7b91c8f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

README.adoc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,16 +1364,23 @@ The value for `users.show.title` can be looked up in the template `app/views/use
13641364

13651365
=== Dot-separated Keys [[dot-separated-keys]]
13661366

1367-
Use the dot-separated keys in the controllers and models instead of specifying the `:scope` option.
1368-
The dot-separated call is easier to read and trace the hierarchy.
1367+
Use dot-separated locale keys instead of specifying the `:scope` option with an array or a single symbol.
1368+
Dot-separated notation is easier to read and trace the hierarchy.
13691369

13701370
[source,ruby]
13711371
----
13721372
# bad
13731373
I18n.t :record_invalid, scope: [:activerecord, :errors, :messages]
13741374
13751375
# good
1376+
I18n.t :record_invalid, scope: 'activerecord.errors.messages'
13761377
I18n.t 'activerecord.errors.messages.record_invalid'
1378+
1379+
# bad
1380+
I18n.t :title, scope: :invitation
1381+
1382+
# good
1383+
I18n.t 'title.invitation'
13771384
----
13781385

13791386
=== I18n Guides [[i18n-guides]]

0 commit comments

Comments
 (0)