def update_translation
      @translation = current_user.translation_for @translation_key, session[:lang_to]
      @key_before_status = @translation_key.status(session[:lang_to])
      respond_to do |format|
        # only admin can edit accepted translations
        if (current_user.can_admin_translations? || !@translation.accepted?) && !params[:value].to_s.strip.blank?
          # use yaml.load to handle arrays
          @translation.update(value: YAML.load(params[:value].strip), status: 'pending')
          # translation added by admin is considered the accepted one as it is trusted
          @translation.accept if current_user.can_admin_translations? && CONFIG['accept_admin_translations']
          format.json {render json: { value: @translation.value, status: @translation.key.status(@translation.lang), key_before_status: @key_before_status  } }
        else
          format.any {render nothing: true}
        end 
      end
    end
def update_translation
      @translation = current_user.translation_for @translation_key, session[:lang_to]
      @key_before_status = @translation_key.status(session[:lang_to])
      respond_to do |format|
        # only admin can edit accepted translations
        if (current_user.can_admin_translations? || !@translation.accepted?) && !params[:value].to_s.strip.blank?
          # use yaml.load to handle arrays
          @translation.update(value: YAML.load(params[:value].strip), status: 'pending')
          # translation added by admin is considered the accepted one as it is trusted
          @translation.accept if current_user.can_admin_translations? && CONFIG['accept_admin_translations']
          format.json {render json: { value: @translation.value, status: @translation.key.status(@translation.lang), key_before_status: @key_before_status  } }
        else
          format.any {render nothing: true}
        end 
      end
    end
POST /translation_keys/1/update_translation.js