Internationalization is a process of designing a software application so that it can be adapted to various languages and regions without any changes
Localization is a process of adapting internationalized software for a specific region or language by adding local specific components and translating text.
If we want to check whether our application is properly internationalized , then we will manually change the language preferences in the browser itself.But if we want to check the same using WebDriver then we have to change the user language preferences.
Using Firefox Browser :
FirefoxProfile profile = new FirefoxProfile();
//setting the locale french : ‘fr’
profile.setPreference(“intl.accept_languages”,”fr”);
driver = new FirefoxDriver(profile);
driver.get(“http://google.co.in”);
Using Chrome Browser :
System.setProperty(“webdriver.chrome.driver”,”D:/DollarArchive/chromedriver.exe”);
ChromeOptions options = new ChromeOptions();
options.addArguments(“–lang= sl”);
ChromeDriver driver = new ChromeDriver(options);
driver.get(“http://google.co.in”);
Unfortunately it wont work for IE browser, We need to change it manually.
Thanks for the information dude, It helped me a lot.
LikeLike
Great work .realy great job.
Keep it up.
LikeLiked by 1 person
Is there any workaround for Internet Explorer too ? I know that you have mentioned that it is not possible but if you could help I would appreciate.
LikeLike
Hi Charan,
Seems like above code not working for me. Script runs successfully, but language doesn’t seem to change.
Also, I tried manually changing browser language and then running script which had just getting Test URL. But, again during runtime browser defaulted to English.
Any help is appreciated!
LikeLike
which browser are you using? If its firefox, could you check this
1. goto “about:config” page
2. search for “intl.accept_languages”
3. modify value to “fr”
4. browse “google.com” and verify the locale
LikeLike