languages_controller.rb 443 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. class Api::V1::Instances::LanguagesController < Api::V1::Instances::BaseController
  3. skip_around_action :set_locale
  4. before_action :set_languages
  5. def show
  6. cache_even_if_authenticated!
  7. render json: @languages, each_serializer: REST::LanguageSerializer
  8. end
  9. private
  10. def set_languages
  11. @languages = LanguagesHelper::SUPPORTED_LOCALES.keys.map { |code| LanguagePresenter.new(code) }
  12. end
  13. end