module Rosetta::I18nWithStoredPhrases

Public Instance Methods

translate(*args) click to toggle source
Calls superclass method
# File lib/rosetta/i18n_with_stored_phrases.rb, line 3
def translate(*args)
  output = super
  return output unless Rosetta.enabled?

  keys = normalize_keys('', args.dig(0), args.dig(1, :scope))
  code = keys.join('.')

  Rosetta.add_phrase(keys: keys, phrase: output.to_s) if exists?(code, config.locale)

  output
end