Class: Object

Inherits:
BasicObject
Defined in:
lib/record_select/extensions/localization.rb

Overview

Provides a simple pass-through localizer for RecordSelect. If you want to localize RS, you need to override this method and route it to your own system.

Instance Method Summary collapse

Instance Method Details

#rs_(key, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/record_select/extensions/localization.rb', line 5

def rs_(key, options = {})
  unless key.blank?
    text = I18n.translate "#{key}", **{:scope => [:record_select], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)
    # text = nil if text.include?('translation missing:')
  end
  text ||= key
  text
end