module Godmin::Helpers::Translations

Public Instance Methods

translate_scoped(translate, scope: nil, default: nil, **options) click to toggle source
# File lib/godmin/helpers/translations.rb, line 4
def translate_scoped(translate, scope: nil, default: nil, **options)
  if @resource_class
    scope ||= @resource_class.to_s.underscore
  end

  defaults = [
    ["godmin", scope, translate].compact.join(".").to_sym,
    ["godmin", translate].compact.join(".").to_sym,
    default
  ]

  t(defaults.shift, default: defaults, **options)
end