translations_controller.rb 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class TranslationsController < ApplicationController
  3. prepend_before_action -> { authentication_check && authorize! }, except: [:lang]
  4. # GET /translations/lang/:locale
  5. def lang
  6. render json: Translation.lang(params[:locale])
  7. end
  8. # POST /translations/reset
  9. def reset
  10. Translation.reset(params[:locale])
  11. render json: { message: 'ok' }, status: :ok
  12. end
  13. # GET /translations/admin/lang/:locale
  14. def admin
  15. render json: Translation.lang(params[:locale], true)
  16. end
  17. # GET /translations
  18. def index
  19. model_index_render(Translation, params)
  20. end
  21. # GET /translations/1
  22. def show
  23. model_show_render(Translation, params)
  24. end
  25. # POST /translations
  26. def create
  27. model_create_render(Translation, params)
  28. end
  29. # PUT /translations/1
  30. def update
  31. model_update_render(Translation, params)
  32. end
  33. # DELETE /translations/1
  34. def destroy
  35. model_destroy_render(Translation, params)
  36. end
  37. end