Sha256: 6bada3c462122eef8fdbc524e54455c29f53d88dde33827169867e0d732c5bdf

Contents?: true

Size: 468 Bytes

Versions: 10

Compression:

Stored size: 468 Bytes

Contents

# 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.
class Object
  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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
recordselect-4.0.1 lib/record_select/extensions/localization.rb
recordselect-4.0.0 lib/record_select/extensions/localization.rb
recordselect-3.10.9 lib/record_select/extensions/localization.rb
recordselect-3.10.8 lib/record_select/extensions/localization.rb
recordselect-3.10.7 lib/record_select/extensions/localization.rb
recordselect-3.10.6 lib/record_select/extensions/localization.rb
recordselect-3.10.5 lib/record_select/extensions/localization.rb
recordselect-3.10.4 lib/record_select/extensions/localization.rb
recordselect-3.10.3 lib/record_select/extensions/localization.rb
recordselect-3.10.2 lib/record_select/extensions/localization.rb