Module: Godmin::Helpers::Translations

Defined in:
lib/godmin/helpers/translations.rb

Instance Method Summary collapse

Instance Method Details

#translate_scoped(translate, scope: nil, default: nil, **options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# 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