-2

all! I have to solve this task , and ask your help:

Use JavaScript to change interface language at https://www.google.com/

Expecting result: — JS-script that changes language of the page when you put it in browser console.

1
  • If you were asked to solve this problem, the people asking you to do so may have a reason to believe you capable of solving the problem; may I ask where you got stuck, and what code you came up with? Where did it fail, and in what way? Commented Oct 16, 2022 at 11:10

1 Answer 1

1

Google uses a search parameter named hl to change the language of the site, you can set that manually with window.location.search = 'hl=en-US'. Replace en-US with the language code you want to set.

Sites usually guess your language based on different parameters, such as subdomain, query string (like Google), your location, browser language, cookies, localStorage etc. If you open google.com in an incognito window and change the language on the cookie consent modal, you can see the query string change to the selected language.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.