mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-05 16:24:21 +01:00
18 lines
465 B
Ruby
18 lines
465 B
Ruby
class API::TranslationsController < API::ApiController
|
|
before_action :set_locale
|
|
|
|
|
|
def show
|
|
@translations = I18n.t params[:state]
|
|
if @translations.class.name == String.name and @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 |