1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/controllers/api/translations_controller.rb
Sylvain 0cd841da33 rubocop api controllers
TODO:
 - events controller
 - availabilies controller
 - members controller
 - plans controller
2019-01-16 16:28:25 +01:00

22 lines
551 B
Ruby

# frozen_string_literal: true
# API Controller for managing front-end translations
class API::TranslationsController < API::ApiController
before_action :set_locale
def show
@translations = I18n.t params[:state]
if @translations.class.name == String.name && @translations.start_with?('translation missing')
render json: { error: @translations }, status: :unprocessable_entity
else
render json: @translations, status: :ok
end
end
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
end