1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-03 14:24:23 +01:00
fab-manager/app/controllers/api/translations_controller.rb

19 lines
467 B
Ruby
Raw Normal View History

2016-03-23 18:39:41 +01:00
class API::TranslationsController < API::ApiController
before_action :set_locale
def show
@translations = I18n.t params[:state]
2019-01-07 12:48:22 +01:00
if @translations.class.name == String.name && @translations.start_with?('translation missing')
render json: { error: @translations }, status: :unprocessable_entity
2016-03-23 18:39:41 +01:00
else
render json: @translations, status: :ok
end
end
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
2019-01-07 12:48:22 +01:00
end