Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/active_scaffold/extensions/localize.rb
Instance Method Summary collapse
Instance Method Details
#as_(key, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/active_scaffold/extensions/localize.rb', line 2 def as_(key, = {}) if key.present? scope = [:active_scaffold, *.delete(:scope)] = .reverse_merge(:scope => scope, :default => key.is_a?(String) ? key : key.to_s.titleize) text = I18n.translate(key.to_s, **).html_safe # rubocop:disable Rails/OutputSafety # text = nil if text.include?('translation missing:') end text || key end |