Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of how to reuse other values by symbol translation key value on i18n gem.
require 'i18n'
require 'yaml'
I18n.backend.store_translations(
:en,
YAML.load(<<-YAML)
activerecord:
attributes:
user:
status:
active: :common.active
inactive: :common.inactive
common:
active: Active
inactive: Inactive
YAML
)
p I18n.t('activerecord.attributes.user.status.active') #=> "Active"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment