string - What is the most efficient method using Request.UserLanguages to render a page based on the browser language?? -


i making page pulls user's browser preferred language, via request.userlanguages....which returns 2 letter code (ex. "en") or detailed code (ex. "en-gb") .

i string of user languages (they in order of preference) , store them in string array. use loop check if language code in first position of string array of codes language (another string array hard coded in).

is there better way this? i'm noticing increased load time , worried additional languages further slow page load...

 if (!ispostback)      {   //holds possible user languages preferences check client machine against         string[] compjapaneselang = { "ja-jp","ja","jp","jpn","euc","shift-jis" };     }   //get client machines langugage preferences                         string[] userlang = request.userlanguages;  //loop through variation of preferences possible user langugaes          (int = 0; < compjapaneselang.length; i++)         {                  //if japanese             if (userlang.getvalue(0).tostring().tolowerinvariant().equals(compjapaneselang.getvalue(i).tostring().tolowerinvariant()))                   cc.japeneseobject();         } 

thanks!

storing them in list turned out best, not else 1 can do....


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -