473,566 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3359
Setting default culture in web.config (question 1)
<globalizatio n culture="auto:e n-US" uiCulture="auto :en"/>

Then, create resource files in theApp_GlobalRe sources 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:Manag e,
EmptyDataTempla te %>">

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.goo glegroups.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:

<anonymousIdent ification enabled="true" />
<profile>
<properties>
<add name="UserCultu re" defaultValue="e n-US" />
<add name="UserUICul ture" defaultValue="e n"/>
</properties>
</profile>

Then I just save the user culture values to profile properties
UserCulture or UserUICulture.
In Global.asax on Application_Sta rt 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)
<globalizatio n culture="auto:e n-US" uiCulture="auto :en"/>

Then, create resource files in theApp_GlobalRe sources 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:Manag e,
EmptyDataTempla te %>">

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.goo glegroups.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.goog legroups.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:

<anonymousIdent ification enabled="true" />
<profile>
<properties>
<add name="UserCultu re" defaultValue="e n-US" />
<add name="UserUICul ture" defaultValue="e n"/>
</properties>
</profile>

Then I just save the user culture values to profile properties
UserCulture or UserUICulture.
In Global.asax on Application_Sta rt 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)
<globalizati on culture="auto:e n-US" uiCulture="auto :en"/>

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

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

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

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
CurrentThrea d 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.go oglegroups.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
599
by: JezB | last post by:
How do I programatically set the culture at session level ?
3
2162
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 the application have the correct culture settings .. I have some questions to better understand this concept .. 1. Is every thread in asp.net...
3
2092
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 If I set my culture programmatically Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs ' Fires at the beginning of...
3
3643
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 ASP.Net/VB. I have a few problems which I hope somebody can help me with: 1. How to set the en-US as the default culture of my entire web site?
0
9155
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 window, i.e. I add a SQLCommand. At that point VS2005 changes my C# file to now load all Selectcommantext data from the resource file instead of the...
9
3908
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
2289
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 numerical data, especially with double values. the numeric data fetched from the database and saved on the machine is in non english culture. i want data...
6
12377
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 way to set the culture information in a property setting so the application will work for them without requiring a code change? This is possible...
1
1534
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 (culture == null) culture = default(CultureInfo); Thread.CurrentThread.CurrentCulture = culture; Thread.CurrentThread.CurrentUICulture = culture;
0
7666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.