locked
Multiple Language RRS feed

  • Question

  • User2006853512 posted

    Hi All,

     

    My english is bod so I'm sorry everyone.

     

    i am doing asp.net web page and i am wanting multiple language.

    I am using global resx file and local resx file.

    on the first page, i'm choosing language.  it is work. But i am going  to another page, language value is default. Why?

    Tuesday, June 8, 2010 10:02 AM

All replies

  • User-925286913 posted

    Store the selected language in Session variable and set language every time in InitializeCulture event.

    Protected Overrides Sub InitializeCulture()
    
    End Sub



    Tuesday, June 8, 2010 10:42 AM
  • User-925286913 posted

    Refer:

    http://msdn.microsoft.com/en-us/library/bz9tc508.aspx
    http://net.blogs.webucator.com/2010/04/07/creating-multi-language-hello-world-kiosk-page/
    http://forums.asp.net/p/1535026/3729706.aspx


    Tuesday, June 8, 2010 10:44 AM
  • User2006853512 posted

     yes it is work but i selected next page and i want to take one record in the behind code.

     

    i am using 

     

     [System.Web.Services.WebMethod]
        public static string GetContactName(string username)
        {
            string usName= AnasayfaAction.usernameCheckForRegister(username);
            
            if(usName!=null){
                return HttpContext.GetLocalResourceObject("Register",
                                                       "errorLength") as string;
     
    
            }else{
                return usName;
            }
            
        }

    this code.Always get default language. Why?


     

    Wednesday, June 9, 2010 2:02 AM
  • User-925286913 posted

    Are you setting culture every time in  Protected Overrides Sub InitializeCulture()  ?

    Please check links I posted above. You need to store current culture in session and set application culture each time in

    Protected Overrides Sub InitializeCulture().

    Consider having PageBase class which will be inherited by all pages of you application and handle Protected Overrides Sub InitializeCulture() in PageBase class.

    Wednesday, June 9, 2010 2:27 AM
  • User2006853512 posted

    yes.  Next page my selected language. But this code give the default language value.

    Wednesday, June 9, 2010 7:47 AM
  • User-925286913 posted

    Put breakpoint at you code and check what you get for

    Thread.CurrentThread.CurrentCulture

    Thread.CurrentThread.CurrentUICulture

    You need to set it like:

    Protected Overrides Sub InitializeCulture()

    MyBase.InitializeCulture()
    Dim culCurrentCulture As CultureInfo = CultureInfo.CreateSpecificCulture(Session("CurrentCulture"))
    Thread.CurrentThread.CurrentUICulture = culCurrentCulture
    Thread.CurrentThread.CurrentCulture = culCurrentCulture

    End Sub

    Please follow tutorials on how to store and set culture from links I posted.

    Wednesday, June 9, 2010 8:11 AM
  • User2006853512 posted

    this code is work. Thanks for answersWink

    GetLocalResourceObject("notexistuser.Text").ToString()


    Thursday, June 17, 2010 3:00 AM
  • User-925286913 posted

    Whenever you issue is resolved, please mark post as answe. This will benefit other members in future to find answer quickly.


    Thursday, June 17, 2010 3:33 AM
  • User105505305 posted

    Hi voldamirin,

    if u want to make multiple language website please do visit

    http://www.codeproject.com/KB/aspnet/localizationByVivekTakur.aspx



    Thanks

    Ankit

    Daccit Pvt Ltd

    Friday, July 16, 2010 11:22 AM