Greasy Fork is available in English.

Use preferred language on steamcommunity.com and store.steampowered.com (Steam Store)

When going to steamcommunity.com or store.steampowered.com from search results, they often include the l get parameter, which sets the language to something random that your search engine picked up. This script removes that, so your preferred language, which you set in the browser, is used instead. 9/4/2022, 8:53:53 AM

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Use preferred language on steamcommunity.com and store.steampowered.com (Steam Store)
// @namespace   Violentmonkey Scripts
// @match       https://steamcommunity.com/*
// @match       https://store.steampowered.com/*
// @grant       none
// @version     1.0
// @author      -
// @description When going to steamcommunity.com or store.steampowered.com from search results, they often include the l get parameter, which sets the language to something random that your search engine picked up. This script removes that, so your preferred language, which you set in the browser, is used instead. 9/4/2022, 8:53:53 AM
// ==/UserScript==

// Update a query parameter in a url, or insert it if it's not there already.
// If del is true, delete the parameter.
var updateParam = function(url, key, value, del, URLEncoder) {
  if(key.length == 0) {
    // we can't deal with zero-length keys
    return url
  }
  
  if (URLEncoder === undefined) {
    URLEncoder = encodeURIComponent
  }
  
  key = URLEncoder(key)
  value = URLEncoder(value)

  const urlAndQuery = url.split('?')
  paramFound = false
  paramsNew = []
  if (urlAndQuery.length > 1) {
    // there was a query string (there was a '?' character)
    var params = urlAndQuery[1].split('&') // params looks like ['key1=value1', 'key2=value2', ...]
    let i = 0

    for (; i < params.length; i++) {
      if ((params[i] == "key") && (del == true)) { // for parameters that don't contain a '=' character, which is possible
        continue // do not copy this one over
      }
      
      if (params[i].startsWith(key + '=')) {
        if (del == true) {
          continue // do not copy this one over
        }
        let kv = params[i].split('=') // split "key=value" into ["key", "value"]
        kv[1] = value
        paramsNew.push(kv.join('='))
        paramFound = true
        continue
      }
      
      paramsNew.push(params[i]) // by default, copy everything over
    }
  }

  if ((paramFound == false) && (del !== true)) {
    paramsNew.push([key, value].join('='))
  }

  let newQuery = paramsNew.join('&')
  var newUri = urlAndQuery[0]
  if (newQuery.length > 0) { // there were query parameters, you're free to add a '?' character, so we won't get a dangling '?' at the end
    newUri = [urlAndQuery[0], newQuery].join('?')
  }
  return newUri
}

window.updateParam = updateParam;

location_ = window.location.toString(); // prevent a situation where that changes from under our feet while updateParam is running

if (location_.includes("l=")) { // is the language get parameter set?
  newLocation = updateParam(location_, "l", "", true);
  if (newLocation != location_) {
    window.location.replace(newLocation)
  }
}