Sha256: 1dab70b772ea327624a7c8dbf2e9b4a5badb3d906063cee7af13ca779860240d
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
class Lolita::I18nController < ApplicationController include Lolita::ControllerAdditions before_filter :authenticate_lolita_user!, :set_current_locale layout "lolita/application" def index @translation_keys=Lolita.i18n.flatten_keys end def update respond_to do |format| format.json do render :nothing => true, :json => {error: !Lolita::I18n::Backend.set(params[:id],params[:translation])} end end end def translate_untranslated respond_to do |format| format.json do google_translate = Lolita::I18n::GoogleTranslate.new @active_locale google_translate.run render :nothing => true, :status => 200, :json => {errors: google_translate.errors, :translated => google_translate.untranslated} end end end private def is_lolita_resource? true end def next_locale ::I18n::available_locales.collect{|locale| locale if locale != ::I18n.default_locale}.compact.first end def set_current_locale @active_locale = (params[:active_locale] || next_locale).to_sym end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lolita-i18n-0.1.18 | app/controllers/lolita/i18n_controller.rb |
lolita-i18n-0.2.0 | app/controllers/lolita/i18n_controller.rb |