473,379 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Flipping languages with resource files

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,

--
Ryan
Mar 8 '07 #1
5 1199
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

"Ryan" <we****@nospam.nospamwrote in message
news:FC**********************************@microsof t.com...
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,

--
Ryan

Mar 8 '07 #2
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/lib...08(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 (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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

Mar 9 '07 #3
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 (wa****@online.microsoft.com, 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.

Mar 13 '07 #4
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
--
Ryan
"Walter Wang [MSFT]" wrote:
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 (wa****@online.microsoft.com, 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.

Mar 13 '07 #5
Walter,

That works great. Thanks for your help.

--
Ryan
"Walter Wang [MSFT]" wrote:
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 (wa****@online.microsoft.com, 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.

Mar 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Danny Pressley | last post by:
I have a VS.NET 2003 Visual C++ MFC Application Project in which I added a new resource file, I then added an icon to this new resource file and did a rebuild and got the following error: "fatal...
1
by: Namratha Shah \(Nasha\) | last post by:
Hi All, This is a resource file generation tool which converts an xml based resource formats to .net resource file i.e. (.resources) and vice-versa. Today we will see how we will generate ...
0
by: Kleanthis | last post by:
I have a problem, when deploying multilingual applications using cab files on Compact Framework 2.0. It seems that something is going wrong with compact framework 2.0 Below I have a description...
0
by: Magnus | last post by:
Hi, Does anyone know how to get a list of available cultures for an application? In this case I have a default texts.resx file, and some culture specific resource files texts.de.resx and...
1
by: urban.john | last post by:
Here are my steps: create resource files from resx files: <echo message="CREATING RESOURCE FILES FROM RESGEN EN" /> <resgen todir="product\resources_en" verbose="true"> <resources> <include...
1
by: Tom | last post by:
This may seem a little strange, but in all my years of developing Windows Forms apps, I've never really used Resource files; however, I would like to start doing so in order to store icons,...
1
by: yashgt | last post by:
In our ASP .NET 1.1 application, we query the database to obtain a list of categories such as "Agriculture", "Business", etc. and display them to the user, each against a checkbox. The names of...
0
by: VigneshS | last post by:
Hi, I am a newbie to Globalization and Localisation Concepts. I tried almost all the methods of the Globalization concepts. But i cannot be able to embed a text file within a Resource. ...
1
by: TisMe | last post by:
Hi All, I am trying to use resource files to globalize my website application. I had this working fine, working through the API for setting page titles programatically, with the resource files...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.