Internationalization in ASP.NET

K

Kiran A K

Hi,

i want my web application to support several languages (like english,
russian, danish etc).
how do i achieve this in ASP.NET?

the application should automatically detect the client's locale and then
display the web pages
in the appropriate language.
is it possible to have separate language files for each language?
in each of these files i would like to specify all the text strings used in
the application.

actually i from Java background and in Struts there is a concept of resource
bundles.
Resource bundles are nothing but separate language files for each language
containing all
the text strings used in the application.

regards,
Kiran
 
M

Maury

Karl Seguin [MVP] ha scritto:
The links provided by John's and Vinu's are great if you want to use the
built-in methods. But any serious multilingual development is going to run
into a number of problems with the basic approach.
I watched at your links but I have a further question for you:
in my simple site I ovverride the method InitializeCulture
of a page I would like to do this
after the user clicks on a button, but the
button_click event raises after the InitializeCulture
event so I have to click twice to view the new language...

Do you know how can I fix this without using URL rewriting
you explain in your article?

Thanks!
M.
 
K

Karl Seguin [MVP]

You've run into a common problem. The timing issue is quite problematic.
There aren't any good ways unfortunetly. One thing you can do is use the
Request.Form[] variable in your initializeCulture. You can use it to
pre-emptively see if the button was clicked, and if so switch the culture -
this is a throw back to how we programmed in classic ASP or how it's done in
PHP - it's quite effective actually.


karl
 
M

Maury

Karl Seguin [MVP] ha scritto:
You've run into a common problem.
fantastic :-(
There aren't any good ways unfortunetly. ....

One thing you can do is ...
I tried to use Javascript: the image (with the flag)
has a javascript function (onclick event, client side)
in this function I write the culture
into an hidden field (with runat=server)
then in InitializeCulture I read the hidden field...
I have some problem with Javascript but I think this
can be a solution (even if there are some drawbacks...
for example if the borwser ha javascript disable)
Do you think that this can be a solution?
Thanks
M.
 
K

Karl Seguin [MVP]

yes, I think it'd be a good one. Just do Request.Form["hiddenFieldName"] to
get your culture and voila :)

Good idea!

Karl
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top