Home All Groups Group Topic Archive Search About

Localization issue with master page.

Author
29 Jun 2009 12:42 PM
Savvoulidis Iordanis
Starting to practice localization/globalization, I have a master page
containing a autopostback combobox (XML datasource based) with all the
languages my site supports. What should I write (and where, content or
master?) so that when the user selects a language, the current page refreshes
and displays texts in the new language?

All my .resx files are created in advance, for all languages, but I can't
figure out how to active them in the new language. I don't want to depend
only on browser language settings, but let the user select a language he
wants.

In the master page, I tried (VB):

Page.UICulture = combo_language.Value
Page.Culture = combo_language.Value

but i see no changes after refresh.

In the browser settings, I have deleted all languages in the list, but still
no changes after refresh, although language dependent database data are
displayed, using code that gets the selected lang, as a session parameter

TIA

Author
30 Jun 2009 10:27 PM
miher
"Savvoulidis Iordanis" <SavvoulidisIorda***@discussions.microsoft.com> az
alábbiakat írta a következő üzenetben
Show quoteHide quote
news:D2E469BE-5A1A-414B-B614-F9CC3F6A54F5@microsoft.com...
> Starting to practice localization/globalization, I have a master page
> containing a autopostback combobox (XML datasource based) with all the
> languages my site supports. What should I write (and where, content or
> master?) so that when the user selects a language, the current page
> refreshes
> and displays texts in the new language?
>
> All my .resx files are created in advance, for all languages, but I can't
> figure out how to active them in the new language. I don't want to depend
> only on browser language settings, but let the user select a language he
> wants.
>
> In the master page, I tried (VB):
>
> Page.UICulture = combo_language.Value
> Page.Culture = combo_language.Value
>
> but i see no changes after refresh.
>
> In the browser settings, I have deleted all languages in the list, but
> still
> no changes after refresh, although language dependent database data are
> displayed, using code that gets the selected lang, as a session parameter
>
> TIA

Hi,

Scott Stanfield does what You would like with a simple page in this video :
http://www.asp.net/learn/videos/video-40.aspx
It could be used as a good starting point.

Hope You find this useful.
-Zsolt
Are all your drivers up to date? click for free checkup

Author
1 Jul 2009 4:17 PM
Rafael Malheiros
Hi,
To change culture you should override da InitializeCulture Event

protected override void InitializeCulture()

The problem is that the SelectIndexChangedEvent of the DropDownList in the
MasterPage happens after the InitializeCulture of the Content Page. So  you
cannot use the information.

Better then use master pages create a base class that inherits from Page and
overrides da InitiCulture Event and then use it as your base class instead
of Page;

I'll give you a exemple using queryStrings

    protected override void InitializeCulture()
    {

        try
        {
            UICulture = Request.QueryString["cult"];
        }
        catch (Exception)
        {


        }


        base.InitializeCulture();
    }

I hope it helps.

Rafael Malheiros

"Savvoulidis Iordanis" <SavvoulidisIorda***@discussions.microsoft.com>
escreveu na notícia da
mensagem:D2E469BE-5A1A-414B-B614-F9CC3F6A5***@microsoft.com...
Show quoteHide quote
> Starting to practice localization/globalization, I have a master page
> containing a autopostback combobox (XML datasource based) with all the
> languages my site supports. What should I write (and where, content or
> master?) so that when the user selects a language, the current page
> refreshes
> and displays texts in the new language?
>
> All my .resx files are created in advance, for all languages, but I can't
> figure out how to active them in the new language. I don't want to depend
> only on browser language settings, but let the user select a language he
> wants.
>
> In the master page, I tried (VB):
>
> Page.UICulture = combo_language.Value
> Page.Culture = combo_language.Value
>
> but i see no changes after refresh.
>
> In the browser settings, I have deleted all languages in the list, but
> still
> no changes after refresh, although language dependent database data are
> displayed, using code that gets the selected lang, as a session parameter
>
> TIA
>
Author
1 Jul 2009 9:08 PM
Savvoulidis Iordanis
I already did that. I found out what was wrong. For some reason, the name of
the combo in the request.form collection is not just let's say
"combo_language" but "ctl100_combo_language_VI" (I remind I use a
masterpage). I don't know what the "_VI" suffix is, but it worked for me. I
found that out, looking in the request.form.keys collection.
Author
2 Jul 2009 12:23 PM
Alexey Smirnov
On Jul 1, 11:08 pm, Savvoulidis Iordanis
<SavvoulidisIorda***@discussions.microsoft.com> wrote:
> I already did that. I found out what was wrong. For some reason, the name of
> the combo in the request.form collection is not just let's say
> "combo_language" but "ctl100_combo_language_VI" (I remind I use a
> masterpage). I don't know what the "_VI" suffix is, but it worked for me. I
> found that out, looking in the request.form.keys collection.

It's a client id of the nested control.

Bookmark and Share