module TranslationHelper

  def qit(slug, content = nil, &block)
      
    content = capture(&block) if block_given?
    
    content = slug if !content or content == ""
    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
    
    if @debug_translation
      raw ("[["+slug.to_slug+"]"+t.value.to_s+"]")
    else
      raw t.value
    end
  end

end
