Flipping languages with resource files

G

Guest

Hello,

I have what I thought was a simple problem, and perhaps there is still a
simple solution. I have a page that is using local resource files to store
all the necessary control properties on the form. I am using
initializeculture() to retrieve the user's preference from our database and
to set the currentCulture and currentUICulture on the first load. It works
well. However, we must supply a linkbutton named either Français or English
that a user can click to rebuild the page in the opposite language. The
problem is that the onClick event gets inheriently called after the
initializeCulture subroutine. So I am having troubles flipping the language.
Even if I implicitly call initializeCulture from the onClick event I do not
know how to tell the app to reload the resource files for the new language.

I am really trying to avoid having to say Label1.text = ... when I know that
the framework has the ability to load local resource files without code.

Any help would be appreciated,
 
T

ThunderMusic

hi,
when you flip your language (on the onClick of your button), just call

Server.Transfer(this.Request.Path);

It will reload the page with the right resources...

I hope it helps

ThunderMusic
 
W

Walter Wang [MSFT]

Hi Ryan,

The InitializeCulture method is called very early in the page life cycle,
before controls are created or properties are set for the page. Therefore,
to read values that are passed to the page from controls, you must get them
directly from the request using the Form collection.

#How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization
http://msdn2.microsoft.com/en-us/library/bz9tc508(vs.80).aspx

In your case, since you're using a button to flip the culture instead of a
ListBox in above example, you could easily do this by:

protected override void InitializeCulture()
{
if (Request.Form["__EVENTTARGET"] == "LinkButton1")
{
// flip the culture

}
base.InitializeCulture();
}

Hope this helps.


Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Walter Wang [MSFT]

Hi Ryan,

If you see this, would you please reply here so that we can know the status
of this post? Thanks for the trouble.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hey Walter,

Thank-you for getting back to me. I have been away, but I will try your
suggestion and get back to you.

Thanks
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top