Class: NtqTools::TranslationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- NtqTools::TranslationsController
- Defined in:
- app/controllers/ntq_tools/translations_controller.rb
Instance Method Summary collapse
Instance Method Details
#refresh ⇒ Object
23 24 25 |
# File 'app/controllers/ntq_tools/translations_controller.rb', line 23 def refresh system("bundle exec rake react_on_rails:locale") if defined?(ReactOnRails) end |
#show ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/controllers/ntq_tools/translations_controller.rb', line 7 def show return render json: { data: nil }, status: 404 unless I18n.exists?(params[:key].to_s) render json: { data: I18n.t(params[:key]) }, status: 200 end |
#update ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/controllers/ntq_tools/translations_controller.rb', line 15 def update return render json: { status: "NOK", message: "value is missing" }, status: 400 unless params[:value].present? NtqTools::Translations::TranslationTool.modify(params[:key].to_s, { "#{I18n.locale}": params[:value] }) render json: { data: true }, status: 200 end |