Sha256: 2baaeada07a0c16f9302cf38d1b21f7c0e0bd4b393e69403dc84520387218c0a

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

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

  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

1 entries across 1 versions & 1 rubygems

Version Path
lolita-i18n-0.3.0 app/controllers/lolita/i18n_controller.rb