Class: I18nAdminUtils::TranslationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- I18nAdminUtils::TranslationController
- Defined in:
- app/controllers/i18n_admin_utils/translation_controller.rb
Instance Method Summary collapse
- #edit ⇒ Object
- #i18n_redirect(message, success = true) ⇒ Object
- #index ⇒ Object
-
#missing_list ⇒ Object
Return a list of all the missing translation.
- #show ⇒ Object
Instance Method Details
permalink #edit ⇒ Object
[View source]
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/i18n_admin_utils/translation_controller.rb', line 6 def edit if params[:key].nil? i18n_redirect('No key specified') else key = params[:key] locale = params[:locale] translation = params[:value] if locale.nil? if key.include? '.' split = key.split('.', 2) locale = split[0] key = split[1] else i18n_redirect('No locale specified', false) return end end I18nAdminUtils::Backend::Manager.save_translation(locale, key, translation) i18n_redirect('Translation edited with success') end end |
permalink #i18n_redirect(message, success = true) ⇒ Object
[View source]
40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/i18n_admin_utils/translation_controller.rb', line 40 def i18n_redirect(, success = true) if request.xhr? render :json => {:success => success, :message => } else if success redirect_to :back, :notice => else redirect_to :back, :alert => end end end |
permalink #index ⇒ Object
[View source]
3 4 |
# File 'app/controllers/i18n_admin_utils/translation_controller.rb', line 3 def index end |
permalink #missing_list ⇒ Object
Return a list of all the missing translation
35 36 37 38 |
# File 'app/controllers/i18n_admin_utils/translation_controller.rb', line 35 def missing_list translations = I18nAdminUtils::SearchTranslation.search render :partial => 'missing_list', :layouts => false, :locals => {:translations => translations} end |
permalink #show ⇒ Object
[View source]
28 29 30 31 32 |
# File 'app/controllers/i18n_admin_utils/translation_controller.rb', line 28 def show unless params[:translation].nil? render :partial => 'show', :locals => {:translation => params[:translation]} end end |