Module: Polyglot::Helper

Defined in:
lib/polyglot/helper.rb

Instance Method Summary collapse

Instance Method Details

#to_polyglotObject



3
4
5
6
7
8
9
10
# File 'lib/polyglot/helper.rb', line 3

def to_polyglot
  file = YAML::load(File.open("config/locales/#{controller_name}.#{locale}.yml"))
  trs  = file["#{locale}"]['polyglot'].to_json

  content_for(:polyglot) do
    javascript_tag("var polyglot = new Polyglot({ phrases: #{trs} });")
  end
end