473,398 Members | 2,368 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,398 software developers and data experts.

Culture

Hello,

I am working on a multilanguage Asp.Net 2.0 web site.

I need to do the following:
1. Set a default culture in Web.Config File.
2. Create a function which changes culture when pressed.
Remember the choosen culture next time the visitor comes to the web
site.
3. Retrieve the current culture.

How can I do this?

Thanks,
Miguel

Sep 15 '06 #1
3 3340
Setting default culture in web.config (question 1)
<globalization culture="auto:en-US" uiCulture="auto:en"/>

Then, create resource files in theApp_GlobalResources section. For mine, one
example, I have:

Address.resx - english (default)
Address.es.resx - spanish
Address.fr.resx - french

To set labels to different languages, you do it like this:
<asp:Label ID="NoDataLabel" runat="server" Text="<%$ Resources:Manage,
EmptyDataTemplate %>">

Changing Culture: First, let the user default to his native browser choice,
which is what globalization will do natively. If a user has not chosen a
different language, leave it unset.

To change culture, you simply set the culture to the main thread. Grab the
CurrentThread and set the culture on that thread.

Does this cover your questions?

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"shapper" <md*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hello,

I am working on a multilanguage Asp.Net 2.0 web site.

I need to do the following:
1. Set a default culture in Web.Config File.
2. Create a function which changes culture when pressed.
Remember the choosen culture next time the visitor comes to the web
site.
3. Retrieve the current culture.

How can I do this?

Thanks,
Miguel

Sep 15 '06 #2
Hi,

Got a litle bit lost.

1. When I set the culture in web.config globalization doesn't that mean
that it everytime he visits the web site he will have those values?
What does the "auto" before "en-US"

2. To store the user choosen culture I was thinking in using the
profile as follows:

<anonymousIdentification enabled="true" />
<profile>
<properties>
<add name="UserCulture" defaultValue="en-US" />
<add name="UserUICulture" defaultValue="en"/>
</properties>
</profile>

Then I just save the user culture values to profile properties
UserCulture or UserUICulture.
In Global.asax on Application_Start I set the Culture and UICulture
equal to these profile values.

What do you think?

Thanks,

Miguel

P.S: I am full aware of the resources part and my project is allready
prepared for it.
Cowboy (Gregory A. Beamer) wrote:
Setting default culture in web.config (question 1)
<globalization culture="auto:en-US" uiCulture="auto:en"/>

Then, create resource files in theApp_GlobalResources section. For mine, one
example, I have:

Address.resx - english (default)
Address.es.resx - spanish
Address.fr.resx - french

To set labels to different languages, you do it like this:
<asp:Label ID="NoDataLabel" runat="server" Text="<%$ Resources:Manage,
EmptyDataTemplate %>">

Changing Culture: First, let the user default to his native browser choice,
which is what globalization will do natively. If a user has not chosen a
different language, leave it unset.

To change culture, you simply set the culture to the main thread. Grab the
CurrentThread and set the culture on that thread.

Does this cover your questions?

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"shapper" <md*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hello,

I am working on a multilanguage Asp.Net 2.0 web site.

I need to do the following:
1. Set a default culture in Web.Config File.
2. Create a function which changes culture when pressed.
Remember the choosen culture next time the visitor comes to the web
site.
3. Retrieve the current culture.

How can I do this?

Thanks,
Miguel
Sep 15 '06 #3
In globalization, the default language is set. Everything will have that
language unless a culture is chosen. you can use the profile as you are
stating. It is realtively easy to pull the Profile object at runtime.

Here is a blog link that contains a video on profiles and localization. It
should help a lot:
http://weblogs.asp.net/scottgu/archi...os-Online.aspx

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"shapper" <md*****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi,

Got a litle bit lost.

1. When I set the culture in web.config globalization doesn't that mean
that it everytime he visits the web site he will have those values?
What does the "auto" before "en-US"

2. To store the user choosen culture I was thinking in using the
profile as follows:

<anonymousIdentification enabled="true" />
<profile>
<properties>
<add name="UserCulture" defaultValue="en-US" />
<add name="UserUICulture" defaultValue="en"/>
</properties>
</profile>

Then I just save the user culture values to profile properties
UserCulture or UserUICulture.
In Global.asax on Application_Start I set the Culture and UICulture
equal to these profile values.

What do you think?

Thanks,

Miguel

P.S: I am full aware of the resources part and my project is allready
prepared for it.
Cowboy (Gregory A. Beamer) wrote:
>Setting default culture in web.config (question 1)
<globalization culture="auto:en-US" uiCulture="auto:en"/>

Then, create resource files in theApp_GlobalResources section. For mine,
one
example, I have:

Address.resx - english (default)
Address.es.resx - spanish
Address.fr.resx - french

To set labels to different languages, you do it like this:
<asp:Label ID="NoDataLabel" runat="server" Text="<%$ Resources:Manage,
EmptyDataTemplate %>">

Changing Culture: First, let the user default to his native browser
choice,
which is what globalization will do natively. If a user has not chosen a
different language, leave it unset.

To change culture, you simply set the culture to the main thread. Grab
the
CurrentThread and set the culture on that thread.

Does this cover your questions?

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************** **
Think outside of the box!
*********************************************** **
"shapper" <md*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googleg roups.com...
Hello,

I am working on a multilanguage Asp.Net 2.0 web site.

I need to do the following:
1. Set a default culture in Web.Config File.
2. Create a function which changes culture when pressed.
Remember the choosen culture next time the visitor comes to the web
site.
3. Retrieve the current culture.

How can I do this?

Thanks,
Miguel

Sep 15 '06 #4

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

Similar topics

2
by: JezB | last post by:
How do I programatically set the culture at session level ?
3
by: Ashish | last post by:
I have a application in which culture settings are customizable, they dont depend on the machine settings on which the application is running, I need to make sure that all the threads running in...
3
by: Ian O'Rourke | last post by:
Okay, I have a problem with the en-GB culture object My computer is set to the UK and for UK date formats, etc If I set my culture to en-GB in the web.config everything works fine with UK dates...
3
by: Shapper | last post by:
Hello, I am working on a multi-language web site. After a lot of searching and reading I was able to define a way to do this. However, I need some help to put this on. I am working on...
0
by: Rob Dob | last post by:
Hi, I have a VS2003 C# asp.net project that has been converted into a VS2005 project. Everything seemed to work well until I make a modification to anything within the Component Designer...
9
by: Edge | last post by:
hi, I am saving the user selected culture in a session variable so I can apply it back to all pages when refreshed and then load the proper .resx values. For that I am using global.asax
2
by: Lucky | last post by:
hi guys! i've got one interesting problem. one of my utility is generating data machine specific, i mean the data is generated in the culture that the machine has. my problem is with the...
6
by: Yofnik | last post by:
Hello, A C# desktop application is failing for an international customer because dates are being parsed incorrectly. I need to set the culture to "en-US" so the dates parse correctly. Is there any...
1
by: shapper | last post by:
Hello, I am initializing the culture of a page as follows: protected override void InitializeCulture() { base.InitializeCulture(); CultureInfo culture = Profile.Get().Visitor.Culture; if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.