Method: EffectiveDatatables.language

Defined in:
lib/effective_datatables.rb

.language(locale) ⇒ Object

Locale is coming from view. I think it can be dynamic. We currently support: en, es, nl



55
56
57
58
59
60
61
62
63
64
# File 'lib/effective_datatables.rb', line 55

def self.language(locale)
  @_languages ||= {}

  locale = :en unless AVAILABLE_LOCALES.include?(locale.to_s)

  @_languages[locale] ||= begin
    path = Gem::Specification.find_by_name('effective_datatables').gem_dir + "/app/assets/javascripts/dataTables/locales/#{locale}.lang"
    JSON.parse(File.read(path)).to_json
  end
end