You must Sign In to post a response.
  • Category: ASP.Net MVC

    Implement globalization in mvc5 with single screen


    I want to implement globalization in my application.
    Before project, I want to create a demo.
    Please help me in doing that.
    I want to create 1 screen with 2 buttons, English and Arabic. (English is fix, but Arabic is dynamic. So that, text for Arabic should be in Arabic language.)
    Then we have 2 labels and 2 text box, 2 validation messages execute using java script.
    If I click on Arabic, both labels text should change to Arabic language.
    Also, orientation of textbox also change.
    How to achieve this. ?
  • #769686
    The generic approach is, you have to create resource files like for arabic you have to create resource file name as with the expected ID value.

    so, programmatic you have to get the culture from the click which you are saying clicking on arabic you want to change it to arabic. with the culture i.e ar-EG you have to set the current culture thread instead of defualt one
    Thread.CurrentThread.CurrentUICulture = New CultureInfo(strCurrentCulture)
    once you set this, load the relevant resource file dynamically like
    resMgr = New ResourceManager("resAssembly", System.Reflection.Assembly.GetExecutingAssembly())

    now, resMgr has all the values of resource file and you just replace where you want the expected strings like for button caption and lable captions.

    B.Ramana Reddy

  • Sign In to post your comments