My website will target UK and US markets, and i need to display a different price/currency for both markets - what is the best way around this?
1) a simple drop down box asking users preference? 2) Using culture class in asp .net to auto detect eg System.Thre开发者_StackOverflow中文版ading.Thread.CurrentThread.CurrentUICulture
...or is there another better way?
thanks
Dim clientLocale as string = Request.UserLanguages(0).ToString.ToLower
This will either be "en_gb" or "en_us" or something else, in which case ask them.
This guys site talks about this issue. http://www.west-wind.com/weblog/posts/334.aspx
Hope this helps.
When a request is made, it has an associated set of languages that are set by the user's browser. This set can be accessed using the UserLanguages property of HttpRequest
.
If you check this set, it will contain the user's language preferences (the same list that is in Tools -> Internet Options -> Languages in IE). You can use this to see the user's preferred culture and automatically switch currency based on that.
This list is dependent upon the "Standards and Formats" setting in Regional Setting in Control Panel.
My regional settings are set to use UK formats, so my languages list is en-gb
. This list can contain more that one value, in which case it shows the user's preferred order.
精彩评论