locked
Display in diffenrent languages without changing the culture settings RRS feed

  • Question

  • User-1739958574 posted

    Hi,

    I am working on an ASP.net web application, the application need to display text in English, Chinese and Japanese based on the parameters passed, however the culture settings such as currency symbol, time and number format should remain as en-US locale.

    My understanding about ASP.Net localization is a package deal, am I wrong? If I am right, the only way to do this is to roll my own solution?

    TIA 

    Tuesday, July 13, 2010 8:57 PM

Answers

  • User579345625 posted

    Although it depends on your requirement but I see a danger in hardcoding the Culture, if in future you need to show different date format as per the culture selected by the user then it would be a bit difficult to manage the scenario.

    I would have still taken the currency string from  something like web.config and have a central location from where the currency string is taken. So that if in future I want to show the culture specific currency then I can have that changed just at that one place.


    Thanks,

    Anup Daware 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 16, 2010 9:45 PM

All replies

  • User579345625 posted

    Hi,


    It is possible to use the ASP.Net localization framework only for resource string keeping the currency and date format out of it.

    All you need to do is hardcode the currency string or pick it up from web.config file and  use it. Same for date formatting just apply same formatting for all dates.


    Very much possible without a lot of hassle!


    Hope this helps,

    Anup Daware

    Tuesday, July 13, 2010 11:12 PM
  • User326230061 posted

    Hello Ed,

    All you would have to do in this case is make sure to set the culture to "en-US" and only change the UICulture to your language you want to display.

    It would be something like the following:

    Culture = "en-US"
    UICulture = strLanguage
    
    Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US")
    Thread.CurrentThread.CurrentUICulture = New CultureInfo(strLanguage)

    As pointed out on MSDN (Don't have the link handy and I'm lazy :P), Culture takes care of dates, currency, etc... whereas UICulture takes care of the display language.

    Hope this helps! :)
     

    Friday, July 16, 2010 3:37 PM
  • User579345625 posted

    Although it depends on your requirement but I see a danger in hardcoding the Culture, if in future you need to show different date format as per the culture selected by the user then it would be a bit difficult to manage the scenario.

    I would have still taken the currency string from  something like web.config and have a central location from where the currency string is taken. So that if in future I want to show the culture specific currency then I can have that changed just at that one place.


    Thanks,

    Anup Daware 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 16, 2010 9:45 PM
  • Sunday, July 18, 2010 1:32 PM