• mina86.com

  • Categories
  • Code
  • Contact
  • Secret command Google doesn’t want you to know

    Posted by Michał ‘mina86’ Nazarewicz on 20th of November 2022

    Or: How to change language of Google website.

    If you’ve travelled abroad, you may have noticed that Google tries to be helpful and uses the language of the region you’re in on its websites. It doesn’t matter if your operating system is set to Spanish, for example; Google Search will still use Portuguese if you happen to be in Brazil.

    Fortunately, there’s a simple way to force Google to use a specific language. All you need to do is append ?hl=lang to the website’s address, replacing lang with a two-letter code for the desired language. For instance, ?hl=es for Spanish, ?hl=ht for Haitian, or ?hl=uk for Ukrainian.

    If the URL already contains a question mark, you need to append &hl=lang instead. Additionally, if it contains a hash symbol, you need to insert the string immediately before the hash symbol. For example:

    • https://www.google.com/?hl=es
    • https://www.google.com/search?q=bread+sandwich&hl=es
    • https://analytics.google.com/analytics/web/?hl=es#/report-home/

    By the way, as a legacy of Facebook having hired many ex-Google employees, the parameter also work on some of the Facebook properties.

    This trick doesn’t work on all Google properties. However, it seems to be effective on pages that try to guess your language preference without giving you the option to override it. For example, while Gmail ignores the parameter, you can change its display language in the settings (accessible via the gear icon near the top right of the page). Similarly, YouTube strips the parameter, but it respects preferences configured in the web browser.

    Anyone familiar with HTTP may wonder why Google doesn’t simply look at the Accept-Language header. Problem is that many users have their browser configured with defaults that send English as the only option, even though they would prefer another language. In those cases, it’s more user-friendly to ignore that header. As it turns out, localisation is hard.