def switch
      language_action = params[:language_action]
    
      return redirect_to_source if tr8n_current_user_is_guest?
    
      if tr8n_current_user_is_translator? # translator mode
        if language_action == "toggle_inline_mode"
          if tr8n_current_translator.enable_inline_translations?
            language_action = "disable_inline_mode"
          else      
            language_action = "enable_inline_mode"
          end
        end
      
        if language_action == "enable_inline_mode"
          tr8n_current_translator.enable_inline_translations!
        elsif language_action == "disable_inline_mode"
          tr8n_current_translator.disable_inline_translations!
        elsif language_action == "switch_language"
          tr8n_current_translator.switched_language!(Tr8n::Language.find_by_locale(params[:locale]))
        end   
      elsif language_action == "switch_language"  # non-translator mode
        Tr8n::LanguageUser.create_or_touch(tr8n_current_user, Tr8n::Language.find_by_locale(params[:locale]))
      elsif language_action == "become_translator" # non-translator mode
        Tr8n::Translator.register
      elsif language_action == "enable_inline_mode" or language_action == "toggle_inline_mode" # non-translator mode
        Tr8n::Translator.register.enable_inline_translations!
      end
    
      redirect_to_source
    end
def switch
      language_action = params[:language_action]
    
      return redirect_to_source if tr8n_current_user_is_guest?
    
      if tr8n_current_user_is_translator? # translator mode
        if language_action == "toggle_inline_mode"
          if tr8n_current_translator.enable_inline_translations?
            language_action = "disable_inline_mode"
          else      
            language_action = "enable_inline_mode"
          end
        end
      
        if language_action == "enable_inline_mode"
          tr8n_current_translator.enable_inline_translations!
        elsif language_action == "disable_inline_mode"
          tr8n_current_translator.disable_inline_translations!
        elsif language_action == "switch_language"
          tr8n_current_translator.switched_language!(Tr8n::Language.find_by_locale(params[:locale]))
        end   
      elsif language_action == "switch_language"  # non-translator mode
        Tr8n::LanguageUser.create_or_touch(tr8n_current_user, Tr8n::Language.find_by_locale(params[:locale]))
      elsif language_action == "become_translator" # non-translator mode
        Tr8n::Translator.register
      elsif language_action == "enable_inline_mode" or language_action == "toggle_inline_mode" # non-translator mode
        Tr8n::Translator.register.enable_inline_translations!
      end
    
      redirect_to_source
    end
language selector processor