Skip to content

Files

Latest commit

 

History

History
26 lines (18 loc) · 735 Bytes

Rails-DotSeparatedKeys.md

File metadata and controls

26 lines (18 loc) · 735 Bytes

Pattern: Missing use of dot-separated locale key

Issue: -

Description

Enforces the use of dot-separated locale keys instead of specifying the :scope option with an array or a single symbol in I18n translation methods. Dot-separated notation is easier to read and trace the hierarchy.

Examples

# bad
I18n.t :record_invalid, scope: [:activerecord, :errors, :messages]
I18n.t :title, scope: :invitation

# good
I18n.t 'activerecord.errors.messages.record_invalid'
I18n.t :record_invalid, scope: 'activerecord.errors.messages'

Further Reading