vita_app/app/helpers/translation_helper.rb
Nicolas Bally 1d3af87d4c initial
2016-04-28 10:07:08 +02:00

21 lines
441 B
Ruby
Executable File

module TranslationHelper
def qit(slug, content = nil, &block)
content = capture(&block) if block_given?
slug = slug.to_slug
t = Translation.where(:key => slug, :locale => I18n.locale).first
if t
else
t = Translation.create(:key => slug, :locale => "fr", :value => content)
t = Translation.create(:key => slug, :locale => "en", :value => content)
end
t.value
end
end