Localization

Discussion in 'ASP .Net' started by Bruno Alexandre, Mar 24, 2006.

  1. Hi Guys,

    I'm driving crazy here with Localization issue, this is what I have now:

    masterpage.master - with some asp:linkbutton like this:

    <asp:LinkButton PostBackUrl="~/login/Default.aspx" ID="lnkLogout"
    runat="server" Text="<%$ Resources:language, menu_logout %>" />


    Default.aspx - with some labels and Dropdowns for Login propose and in
    the top of the page:
    <%@ Page Language="VB" AutoEventWireup="false"
    CodeFile="Default.aspx.vb" Inherits="login_Default" Culture="auto:en-US"
    UICulture="auto" %>

    in Default.aspx.vb one of other thinks is:

    Protected Overrides Sub InitializeCulture()
    Dim lang As String = Request("ddLanguage")
    If lang IsNot Nothing Or lang <> "" Then
    Thread.CurrentThread.CurrentUICulture = New CultureInfo(lang)
    Thread.CurrentThread.CurrentCulture =
    CultureInfo.CreateSpecificCulture(lang)
    End If
    End Sub


    and it works FINE!
    but the language choose in this DEFAULT.ASPX file is not the same in the
    other pages of the website, it only overrides the CultureInfo in this
    DEFAULT.ASPX file...


    How can I choose a language in the Default.aspx and have THAT language
    across HOLE Webpage?

    I'm USING GlobalResources and a Resource called Language.resx with
    several for other languages like:

    Language.pt.resx
    Language.fr.resx
    Language.da.resx

    etc...


    Anyone Know how can I manage this?

    I already watch this HOW TO...
    > ASP.NET HOW DO I Video Series: Localization
    >

    http://msdn.microsoft.com/asp.net/learning/learn/newtodevelopment/default.aspx


    but this example is just for one page (even using globalResources)


    Thanks in Advance.

    Bruno Alexandre
    "a Portuguese in KĂžbenhavn, Danmark"
     
    Bruno Alexandre, Mar 24, 2006
    #1
    1. Advertising

  2. Bruno Alexandre

    Jules Guest

    As far as I can see, you have two options;

    1) Move the code you have in the InitializeCulture() method to the
    Global.asax Application_BeginRequest(Object obj, EventArgs e)

    2) Create a base-page class of which all your pages inherit from.
    Implement the InitializeCulture() method in this base class. I
    personally chose to use the 2nd option because I can't work with
    cookies and I store this info in the user info in a session. And I
    couldn't find a way to access the Session object from the
    Applicaiton_BeginRequest() method.

    Hope this helps.

    BTW, can anybody tell me if this is a (best/good) practice?

    Kind regards,

    Jules
     
    Jules, Mar 27, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe Glover

    help with localization

    Joe Glover, Jul 8, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    373
    Paul M
    Jul 9, 2003
  2. Replies:
    3
    Views:
    638
  3. Manish Pansiniya
    Replies:
    6
    Views:
    493
    Natty Gur
    Jul 14, 2003
  4. MarkMurphy
    Replies:
    1
    Views:
    474
    Yan-Hong Huang[MSFT]
    Jul 21, 2003
  5. jagdish patel

    Localization Supported control

    jagdish patel, Aug 4, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    365
    jagdish patel
    Aug 4, 2003
Loading...

Share This Page