1

I have project which has been deployed globally. SO in every country there is different language.

I have requirement in our project to run automation in different browser language culture e.g germany,Uk,canada,US etcs.

I wanted to set browser related setting before launching application in automation.

How can I set it using c# code and how can i get all browser information?

1 Answers1

0

Assuming you're using Internet Explorer and Windows 7 or 8 the default language can be set through command line after applying one or more language packs to the Windows image. Running command line in C# was answered in a previous question.

System.Diagnostics.Process.Start("PathToEXE\intlcfg.exe –genlangini –dist:C:\windows_distribution -image:C:\wim_mount –defaultlang:en-US -f");
Community
  • 1
  • 1
lloyd
  • 1,683
  • 2
  • 19
  • 23
  • Yes i am using windows 7 and IE 11 – prakash pandramise Apr 14 '15 at 08:52
  • Current browser language, culture, regional setting, date format, – prakash pandramise Apr 14 '15 at 10:45
  • Can we set any browser language using above code ...what you have given ---System.Diagnostics.Process.Start("PathToEXE\intlcfg.exe –genlangini –dist:C:\windows_distribution -image:C:\wim_mount –defaultlang:en-US -f")................................I did not get what does this code do with browser .... can you explain me ..please – prakash pandramise Apr 14 '15 at 10:51
  • The above code sets the default language. It is based on the assumption you've already added the language files. English US would probably be installed by default. – lloyd Apr 14 '15 at 12:56
  • [Culture](http://stackoverflow.com/questions/479300/detect-os-language-from-c-sharp), [Region](http://stackoverflow.com/questions/9530350/changing-the-region-and-language-os-setting-programmatically), I don't know what you mean by date format. have you tried googling these as they appear to be answered on stakeoverflow already? – lloyd Apr 14 '15 at 13:11
  • I have used below code to set browser language but did not working for me................. CultureInfo ci = new CultureInfo("fr-ca"); DateTimeFormatInfo dateformat = new DateTimeFormatInfo(); dateformat.FullDateTimePattern = "dddd, mmmm dd, yyyy h:mm:ss tt";// Date format of en-us ci.DateTimeFormat = dateformat; CultureAndRegionInfoBuilder obj = new CultureAndRegionInfoBuilder("fr-ca", CultureAndRegionModifiers.Replacement); obj.LoadDataFromCultureInfo(ci); obj.Register(); – prakash pandramise Apr 14 '15 at 14:03
  • What i want to achieve is ...i have to set different browser language using c# ..e.g. sometime ..english us, swedish, france like that ...will it possible using code ... – prakash pandramise Apr 14 '15 at 14:05
  • Assuming your OS has the language files installed, yes. – lloyd Apr 14 '15 at 14:06
  • which language file ...frankly i dont know language file, i guess it is installed in OS ....do we need to install it??....as i am using windows 7 ...and IE 11....i can set manually browser language and regional setting ... – prakash pandramise Apr 14 '15 at 14:11
  • I'm not sure where the language file is located. I think your questions regarding language files would be best answered in a new stackoverflow question. Have a look at the edits I did to this question including sample code. – lloyd Apr 16 '15 at 01:40