Localization in ASP.NET 2.0
page 1 of 1
Published: 05 May 2006
Unedited - Community Contributed
In this article, Bilal Haidar presents the new localization feature provided by .NET framework 2.0. Throughout the article, the new tools provided by Visual Studio 2005 to support localization will be highlighted and used to show you how easy it is to localize your web applications with ASP.NET 2.0.
by Bilal Haidar
Average Rating: 
Views (Total / Last 10 Days): 29377/ 23


A few years ago we started hearing new terms in economics about globalization and integration of international markets.  This made many large business companies begin thinking of how to attract markets from all over the world and not only from domestic markets.  The first idea that might come to the company is to have a Multilanguage website; clients from a set of targeted countries can localize their website to their own native language.

ASP.NET 2.0 comes with a rich environment that makes localization of web applications a very easy task to perform.  There are two main kinds of localization in ASP.NET 2.0: implicit localization and explicit localization, each of which will be discussed in more detail throughout this article.

Preliminary Steps

When you think of localizing a web application, some preliminary steps should be taken into account.  Those steps can be summarized in two main points:

Globalization: The main strategy of the web application is set in this step.  The web application architect shall ask the following questions: How many countries or languages are targeted in the application?  What sections are to be localized?  Etc.  In addition, gathering of resources for all the predetermined languages should be collected before any implementation starts.

Localization: The actual localization and implementation through code is done in this step.  The resources needed are supplied to the web application and then it is the developer's role to allow the application being worked on to support all the predetermined languages required by their application.

Localization and Visual Studio 2005

Visual Studio 2005 now ships with a new resource editor that allows you to easily add/remove/update any resource key in any ASP.NET resource file (.resx).

In addition, Visual Studio 2005 makes generating resource files an easy step to do by just going to Tools à Generate Local Resource while your WebForm is in the Design view.

Moreover, Visual Studio 2005 provides two ways of localizing a web application.  The first is using Local Resources; a local resource is a resource file attached to a WebForm.  Or you could use   Global Resources in which you can combine all common resource keys used by several ASP.NET web forms into a single resource file.

The above tools and concepts will be revisited throughout this article while creating and manipulating resource files.

Working with Local Resources

In this section we are going to show how easy it is to generate a local resource file for any ASP.NET web form.  By local resource we mean that a single resource file is in a many to 1 relationship with the ASP.NET web form.  In other words, if you have a Label server control and you want to show some text in this label for each culture available in the web application, then you place a resource key in an accompanying resource file for a specific culture.  At run time, the resource key will be looked up in the culture-specific resource file, evaluated and replaced with the proper text translation.  You can have several resource files for the same ASP.NET web form, each representing a specific culture.

To generate a local resource file in Visual Studio 2005, start by creating a new web site.  Open the default.aspx page and add few controls, including the following:

Label Server Control, with an ID of lblName

TextBox Server Control, with an ID of txtName

Button Server Control with an Id of btnSubmit

The figure below shows what the default.aspx page looks like.

Figure 1


Make sure your default.aspx page is in the design view.  Then go to Tools à click on the Generate Local Resource command.

You will notice two changes to your web application and ASP.NET page.  First of all, a new "system" folder has been added in the web application’s root folder called App_LocalResources.  The App_LocalResources folder has been newly added to the ASP.NET 2.0 web application. This folder holds all the resource files for all the ASP.NET web forms.  The ASP.NET runtime uses the .NET framework, ResourceManager, to perform resource key lookups.  The ResourceManager will look at the App_LocalResources folder at all times.  This means that any resource file located outside this folder will be ignored.

You can easily add a new resource file to that folder to represent any additional language for your web application by simply copying the default resource file of an ASP.NET form and pasting it with a new name.  For instance, if you have the default.aspx.resx resource file, which represents the English language, then you have English set as the default language of your machine.  Now you want to add the Arabic-Lebanese language for your web application.  You simply copy the default.aspx.resx and rename it to defaut.aspx.ar-LB.resx.  This way you have added support for a new language.  The only thing left to do is to change the values of every resource key inside the resource file added.

Next, open the source view of the default.aspx page and you will notice new tags have been added to the controls that require localization.

Listing 1

<form id="form1"runat="server">
<asp:Label ID="lblName"runat="server"meta:resourcekey="lblNameResource1"></asp:Label>&nbsp;
<asp:TextBox ID="txtName"runat="server"meta:resourcekey="txtNameResource1"></asp:TextBox><br/>
<br />
<asp:Button ID="btnSubmit"runat="server" Text="Submit"meta:resourcekey="btnSubmitResource1" /></div>

As you can see, a “meta:” tag has been added to every server control together with a resource key that corresponds to the resource key entry in the default.aspx.resx resource file.

The snapshot of the default.aspx.resx is shown below.

Figure 2

For each server control a single resource key has been added with multiple properties of .Text and .ToolTip.

As mentioned above, at runtime the resource key will be evaluated and the corresponding text in the resource file will be displayed.

Now we can add the Text and ToolTip values for every control in the resource file.  However, before we can run this page and see how it is being localized automatically, we have to specify the Culture and UICulture properties in the Page directive.  This way, the ASP.NET runtime will know the culture used and apply the specific resource file for that chosen culture.

To do so, add the following to the Page directive:

Listing 2

Culture="auto:en-US" UICulture="auto"

We have set the Culture to be auto and have a default value of en-US and the UICulture set to auto.  Having an auto property means that the request will automatically detect the culture specified on the client browser.

Run the application and you will see that the server mainly controls the Label and that the Button Text property will be evaluated based on the culture and the resource file of that culture.

To support an additional culture, copy the original resource file as mentioned above and add your translation for the entire resource key and test it in your browser.  To test your application with other cultures, refer to the following: Setting a Preferred Language in Internet Explorer.

Working with Global Resources

As mentioned above, the Local Resources are in a many to 1 relationship with ASP.NET web forms.  In some cases, your ASP.NET web forms in an application might share a set of resource keys.  Instead of having redundant data in your resource files, ASP.NET 2.0 introduces the App_GlobalResources folder which lets you place all the global resources, i.e. resources shared by some ASP.NET web forms, in one location.

To create a new global resource, right click your web application root, add an ASP.NET Folder and choose App_GlobalResources.  Then right click this folder and add a new Resource file.  The structure of this resource file is the same as the structure of the resource files placed inside the App_LocalResources.  However, the name of this file can be any meaningful name and is not limited to the name of the ASP.NET web form.  This file, as mentioned above, will hold shared resource keys for several ASP.NET web forms.

To have the same resource file available for several languages, you need to follow the same steps mentioned while discussing the local resources.  The default global resource file is named resource.resx and the French version is written as resource.fr.resx.

Add a new Label Server control to the default.aspx page as:

Listing 3

<asp:Label ID="lblwelcome" runat="server"/>

Inside the resource.resx and resource.fr.resx files add one resource key called “welcome.”


Key: welcome

Value: Welcome to our website


Key: welcome

Value: Bienvenue à notre site Web

To link the global resource to the above label, we need to do the following:

Right click on the label in Design view, click on properties and then choose Expressions.  A pop-up window is then opened for you so choose from the Bindable properties, Text property and form the Expression Type, Resources.  In the Expression Properties you set the ClassKey to be resource.resx and the ResourceKey to be welcome.

You can see now how the label server control looks.

Listing 4

<asp:Label ID="lblwelcome"runat="server" Text="<%$ Resources:resource, welcome%>"></asp:Label>

Instead of having implicit localization as the case of local resources, the explicit localization in global localization is done by evaluating an expression and giving this expression the original resource name and the resource key in that resource file.

Now, run your application in a browser and try to change the default culture of your browser from English to French and see how the text inside the label changes as specified in the two resource files mentioned above.

CurrentCulture and CurrentUICulture

Before going on with this article, let us stop and discuss the two main properties of concern, mainly the CurrentCulture and CurrentUICulture.

CurrentCulture and CurrentUICulture are both of the type CultureInfo which belongs to the System.Globalization.

CurrentCulture and CurrentUICulture are both properties of the current thread represented by System.Threading.Thread.CurrentThread.CurrentCulture and System.Threading.Thread.CurrentThread.CurrentUICulture

CurrentCulture is used mainly to format the Dates, Currencies, etc.  For that reason, it should be set as specific and not left as neutral.  For instance, you need to set the CurrentCulture as:

Listing 5

System.Threading.Thread.CurrentThread.CurrentCulture= newCultureInfo("ar-LB");

We have set the current culture to be a specific culture, Arabic - Lebanese.  So make sure to always be specific in specifying the CurrentCulture.

CurrentUICulture is mainly used for language/text translations.  The ResourceManager is based upon the CurrentUICulture.  It does not matter whether the culture set here is specific or neutral.  For instance, either ar or ar-lb works fine with the CurrentUICulture.

Listing 6

System.Threading.Thread.CurrentThread.CurrentCulture= newCultureInfo("ar");

Programmatically Setting Culture and UICulture

In the above discussion, we have seen that the Culture and UICulture properties inside the Page directive were set to "auto."  In this section we will learn how to set both properties programmatically inside our Visual Basic .NET or C# code.

Create a new ASP.NET web form and add the following code:

Listing 7

<asp:DropDownList ID="ddlLanguage"runat="server" AutoPostBack="True">
<asp:ListItem Selected="True"Value="auto">Auto</asp:ListItem>
<asp:ListItemValue="en-US">English (US)</asp:ListItem>
<asp:ListItemValue="en-GB">English (UK)</asp:ListItem>

This DropDownList lists a few options to change the default culture.  One of the methods of the Page class is called InitializeCulture().  This method is being executed in the early stages of the page creation.  It is the responsibility of this method to set the Culture and UICulture of the current request.  We will override this method to build our own logic in setting the above two mentioned properties based on the selection from the DropDownList.

Copy this code and paste it inside your code behind class.

Listing 8

protected override void InitializeCulture()
  string lang =Request["DropDownList1"];
  if ((lang != null))
    if (lang != "")
      Thread.CurrentThread.CurrentUICulture =new CultureInfo(lang);
      Thread.CurrentThread.CurrentCulture =CultureInfo.CreateSpecificCulture

In this piece of code, we are first getting the selection from the language DropDownList.  Notice that we did not use the DropDownList properties to access the selected option; this is done on purpose, since the first time the page is visited the DropDownList will not be created.  We use the Request object to access the form's controls.

The CurrentUICulture property is set to the language selected.

The CurrentCulture, as mentioned above, should always be set to a specific culture.  Keeping that in mind, we have to use the static method of CultureInfo object, CreateSpecificCulture().   This takes as an input a parameter specifying the culture and returns a CultureInfo instance having a specific culture set.

Once a culture is chosen from the DropDownList, the current Culture and UICulture will be set accordingly.



We have presented the new localization features in ASP.NET 2.0.  Visual Studio 2005 has been improved to give a better experience in many aspects, mainly the Localization of web applications.  Two new features in ASP.NET 2.0 Localization, Implicit and Explicit localization, have been discussed.  A distinction between CurrentCulture and CurrentUICulture was given showing the similarities/differences and the effect of each of them.  Finally, a programmatic way of setting the CurrentCulture and CurrentUICulture was shown.

Hope you enjoyed this article.

Happy Dot Netting!!

User Comments

Title: Developer   
Name: Manwendra Pandey
Date: 2012-11-28 5:35:23 AM
It was very helpful for me to be familiar with Globalization and localization. ....... Thanks a lot !!!!
Title: Localization of text boxes   
Name: Ashish Dhingra
Date: 2012-05-02 3:12:26 AM
Can i specify culture of text boxes also.I have two text boxes in one page.I want user should be able to enter english only in one text box and hindi in other(default language).is this possible.
Title: software developer   
Name: lsingh
Date: 2011-07-27 11:03:17 AM
How do you deal with date when changing from english to spanish?
Title: software developer   
Name: Shashank
Date: 2011-07-20 7:15:35 AM
Title: web developer   
Name: gaurav tripathi
Date: 2011-05-25 2:53:07 PM
Title: Web Developer   
Name: Mahesh
Date: 2011-05-23 3:41:42 AM
Thank you very much.Its a very useful article.
Title: web developer   
Name: mohamed
Date: 2010-11-28 4:47:27 AM
Programmatically Setting Culture and UICulture working with Localization i hope to respons me or Globalization only
Title: Localization   
Name: Kunal Arora
Date: 2010-07-28 3:25:11 AM
Nice article. But the problem what I am facing is that if I select the one langauge in Default.aspx it will show all the labels in that selected language but when I redirect that page to Default2.aspx, it shows all content in English language. Please help me on the same?
Title: Localization   
Name: Abhishek Shrivastava
Date: 2010-06-17 2:45:13 AM
Nice Article, my concept regarding localization are clear.
Title: about writing the text   
Name: Shailendra
Date: 2010-05-01 2:39:47 PM
It is nice code. But I want to write in the textbox in my local language when select from the dropdownlist.
how to do this?
Title: localization problem when data populating from database   
Name: kranthi kumart
Date: 2010-03-05 10:33:55 PM
hi to all. this is kranthi kumar mathi. i want to implement globalization and localization in my website. i made a dynamic website with all resource files in root directory with appropriate folders. and also its works fine.

The problem i have faced is...i used to get the data only in English [en-US] from database. i need to change data dynamically to current culture. can anybody please help me for this issue. i would greatly appreciate in advance.
Title: Web Developer   
Name: Safa
Date: 2010-02-04 8:02:18 AM
Thanks man Great Job!

it helps me ALOT :)
Title: software engineer   
Name: raghu
Date: 2009-09-26 5:54:23 AM
it is very good example but i have a problem that i have a resources file in that list i have a long list of keys so i went to know how i reduce its size.i don't went different
resources file for each from.So plz help
Title: software engineer   
Name: Mohammed Abdul Wahab
Date: 2009-07-06 8:56:23 AM
its very good example to get an idea but while explaning the globalresources,some confusion is there,ur explaning the example without using resources
Title: Problem in Building the Web Site   
Name: Ravi Shankar
Date: 2009-05-04 1:31:09 AM

This is Ravi Shankar. I had some problem with Globalization and Localization.
I have created one web form with name BillPrint.aspx and it contains labels like BillNo, ConnectionId and so on. I want to globalize the label’s text. I have created resource files for this with names BillPrintResources.en-US.resx, BillPrintResources.hi-IN.resx, BillPrintResources.resx. Which contains BillNumber as Name and “BillNo.” as value and similarly for ConnectionId as Name and “Conn ID” as value.

I had specified BillPrintResources for Classkey and BillNumber for ResourceKey in Expression property of BillNo label. Similarly for BillPrintResources for Classkey and ConnectionId for ResourceKey in Expression property of ConnectionId label.

After this I am building the website which it is showing some errors like

1.The resource object with key 'BillNumber' was not found.
2.The resource object with key 'ConnectionId' was not found.

Like this how many variables I had used the errors are coming for all.

Please help me in finding the solution. If any body knows the solution please mail me at haithisisravi@gmail.com
Thanks & Regards
Ravi Shankar.
Title: Best Localization Plug-in for Visual Studio   
Name: RGreatEx
Date: 2008-12-23 5:41:30 PM
Move strings from code to resx and translate their automatically. Try free.
Title: good article   
Name: Ashok
Date: 2008-12-16 2:08:28 AM
this is a nice article on localization
Title: Pls Help   
Name: Nice
Date: 2008-10-29 2:00:36 AM
Hi All

i am developing a website using asp.net 2.0. It has an arabic version too. But the arabic characters are not showing properly at the production even though it is working locally. I added the resource file for the home page(under local resources). But still the issue remains.pls advise

Thanks in advance
Title: between CurrentCulture and CurrentUICulture was given showing the similarities/differences and the effect of each of them. Finally, a programmatic wa   
Name: between CurrentCulture and CurrentUICulture was given showing the similarities/differences and the effect of each of the
Date: 2008-08-10 10:10:13 AM
to give a better experience in many aspects, mainly the Localization of web applications. Two new features in ASP.NET 2.0 Localization, Implicit and Explicit localization, have been discussed. A distinction between CurrentCulture and CurrentUICulture was given showing the similarities/differences and the effect of each of them. Finally, a programmatic way of setting the CurrentCulture and CurrentUICulture was shown.

Hope you enjoyed this article.

Happy Dot Netting!!
Title: Localization   
Name: Bhargavi Venkatesh
Date: 2008-08-07 1:09:08 AM
Hi, how to localize a user control in vb.net
How to Localize a property used by it
Title: Re: Juanchila   
Name: Bilal Haidar
Date: 2008-08-04 1:54:15 AM
Thank you :)
Title: From es-AR   
Name: Juanchila
Date: 2008-08-03 4:50:27 PM
Like we say here in Argentina.... sos un grosso!
(you are good!)

Title: Thanks   
Name: Vinay Singh
Date: 2008-07-10 5:48:20 PM
It helps me lot....thanks a lot ..........
Title: quest   
Name: ravi kiran varma
Date: 2008-06-24 4:51:32 AM
how to enter values in .resx file.

so please help me
Title: question   
Name: Jenny
Date: 2008-03-02 11:31:11 PM
Hi, Nice article!
Curently, we have three web sites A, B, C.
Web sites B and C can be launched through web site A.

Is it possible to put all the resources of A, B, and C into one strong named individual assembly? Localizing this assembly to support the localization of A, B, and C by reference this assembly?

I tried this. The method GetString(id, cutural) of the resource manager only returns the English value, not the cutural related value.

So, that means we have to localizing each web project individually?

Thank you very much!
Title: Help Needed   
Name: Reddy
Date: 2008-02-18 11:24:55 AM
I am new to Visual Studio 2005, Recently we are upgrading the entire applications to .Net framework 1.1 to 2.0. In globalization or localization of my application is giving problems.
Here is what my application is....

There is one web service for Header and Footer purpose. In that Header (webservice call) we have drop down list for language selection. Once the user selects the language in header my application needs to localize accordingly. My application contains master pages and content pages. I tried with creating base pages, writing seperate class for setting up thread culture in Master Page Pre-render Event but no luck.
When i change the browser default language then entire site is picking the correct localized resource files but when i change the dropdown list from the browser not able to pick localized Resource File.

one more thing whenever i change the dropdownlist of languages from Header it will set the value in cookies.

So How can i solve this issue? Can you please help me on this... How can i localized my static and Dynamic content with master pages??

I'll appreciate if you can help me on this.

Title: Localization not working.. help   
Name: Bernard
Date: 2008-01-09 10:52:00 PM

When my webform is inside a folder, it cannot read the resource file inside the App_LocalResources.

Title: Change language   
Name: Manoj
Date: 2007-12-03 1:18:10 AM
How can I change the language of dropdownlist item where data are bind from database i.e. member list. In database the values are store in English language.
Title: Thanks   
Name: Thanks
Date: 2007-11-19 1:20:09 PM
Thanks, very understandable
Title: custom calendar for a culture   
Name: saeed
Date: 2007-10-25 1:01:28 PM
How can I define new calendar for my custom culture?
Title: DropdownList   
Name: Nair
Date: 2007-10-08 1:11:25 PM
and about dropdownlist and checklist?!?!
how can i do the same?!?!
Title: multia language convetio   
Name: yugender
Date: 2007-08-08 7:08:01 AM
i want multilanguage seting for over all the project
just im setting one language that impact on althe .aspx pages
Title: Javascript   
Name: Cheryl
Date: 2007-07-24 12:55:47 AM
Hi, is there a way to use javascript to pick up on the correct text from the resx files?

I've got it all working for the labels, and in the code, etc but when I have a javascript type message I'd like to be able to do that as well if possible
Title: Asp.Net Localization   
Name: Nitin Sharma (.Net Technologies)
Date: 2007-06-18 2:59:37 AM
The article is no doubt informative....but it is not explained in details..It would have been very good if it have some examples/Demos..anyways..Keep it UP.....!!!!!
Title: Asp.Net Localization   
Name: Puneet Sharma
Date: 2007-06-15 9:06:49 AM
Really good stuff..!!!!
It is explained so beautifully..really i admire and even i look all articles from aspalliance..

keep it up..
Title: Fantastic   
Name: Narayan K
Date: 2007-06-14 4:53:08 AM
Really good article to begin with. Can i have something on satellite assemblies?
Title: Excelent Article   
Name: Anjum Rizwi
Date: 2007-06-13 4:24:02 AM
Before reading this artice, I read around 5 articles on this topic, But this is very very very good article, It is very clear and step by step narrated.
Title: localization   
Name: yuvraj raj
Date: 2007-05-28 7:55:52 AM
artical is very helpful. but i want to ask how we can corelate localization with satellite assembly.
Title: Master Page Work Around   
Name: Go Sens Go - Anonymous
Date: 2007-05-10 4:20:58 PM
Wonderful article. Thank you so much - there needs to be better resources about localization on the web with regards to asp.net.

Regarding localization and Master Pages - had major problems getting the following line of code to work:

[Listing 8]
string lang =Request["DropDownList1"];

One way to solve the problem is to use the Query String to pass the culture/language value.

For example we used:

string lang = Request.QueryString["lang"]; with the url : search.aspx?lang=fr

Good Luck. Thanks Again. Go Sens Go.
Title: Technique does not work with master pages   
Name: Robert Dufour
Date: 2007-04-26 3:22:03 PM
Otherwise excellent articles for a simple page but now use the same code and make a master page. Then just take your original code and use it in a content page that you place inside a contentplaceholder.

The code line string lang =Request["DropDownList1"];
will now always return nothing
So this does not work when you're using master pages on your site. I know I been trying for over three days to find a workaround.
Hope someone can figure it out. By the way I Use VB if anyone would be kind enough to send me a code snippet.
Title: wrong   
Name: berny
Date: 2007-04-24 9:59:20 AM
Well, your website is wrong at the end :

in french we write
"Bienvenue sur notre site Web"
and not
"Bienvenue à notre site Web"


Nice job.
Title: How to update Resx files automatically   
Name: Gurka Tomat
Date: 2007-04-21 12:44:35 PM
Thanks for the page. It all sounds nice to be able to automatically generate .resx files with a command, but is there some way to automatically update the .resx files if controls are added/deleted (happens all the time as we all know)? Reports on the net seem to indicate that there are not. If so, using this method to localize your application puts a completely unnecessary burden on the programmer, as this is something Visual Studio should do. You need to update your article with info on this.
Title: Javascript Popup Localization   
Name: Sanjay
Date: 2007-04-19 2:51:48 AM
You would agree, in most of the application there are Javascript popups, If you could add about, how to localize the Javascript Popup messages too, that would be great
Title: Localization   
Name: Parimal
Date: 2007-04-09 2:41:41 AM
Really, This one is very good article. Properly mentioned. But i think need to mentioned some more in detail with some major option.

Title: good one   
Name: Abdulla Hussein
Date: 2007-04-06 8:29:13 AM
it is a good artical , I start to learn localization 2.0 from this artical then I wide my knowledge from athor resources , but this artical is very good thanks :D
Title: Very good work   
Name: Venkatreddy
Date: 2007-02-10 12:44:27 AM
I Would like to thank Bilal.
Title: How to add programmatically localisation ressource   
Name: Hakim
Date: 2007-02-02 10:59:34 AM

first thank you for this good article.

so i have a questiona about how can i put a new trabslations to ressources files, because i need that the administrators add new datas to the site, which must be translated in all my site languages.


Title: Re: Kurdish Language   
Name: Bilal Hadiar [MVP]
Date: 2006-11-27 6:06:55 AM
Check this link that lists all the ISO Language Codes for the countries!!


Hope this helps,
Title: nice but I have a Question   
Name: Abdul
Date: 2006-11-27 5:25:01 AM
it is a very usefull artical but i am asking about adding
or supporting new Culutre like Kurdish languge! how can i use Kurdish Culture in Globalization ?
Title: it is detail enough, thanks   
Name: icy
Date: 2006-11-15 4:39:52 PM
thanks for this article, explains alot. thanks!
Title: Nice work   
Name: Imran Baig
Date: 2006-11-08 2:42:27 PM
Excellent artile, it helped me with my current assignment.
Title: Great Narration   
Name: Rakesh Tiwari
Date: 2006-11-02 3:07:08 AM
Thanks Man, Your narrated things quite nicely. This article helped me understand localization feature in VS2005, and this feature in VS2005 saves a huge amount of time to code when compared to VS2003. There is nothing to do for localization in VS2005, it's all done.

Thanks a bunch!!!!
Title: Fantastic   
Name: Prakash Mohan
Date: 2006-10-31 5:05:56 AM
Fantastic article. Thanks.
Title: One question   
Name: Rajeev Rai
Date: 2006-09-04 2:26:15 AM
Thats a really good article u have there...but will you be able to type from a keyboard in arabic or french in the textbox that u have created without using language bar of windows...please mail me at mailrjri@hotmail.com if you have any idea
Title: Can't get it to work?   
Name: JS
Date: 2006-08-18 9:40:56 AM
I seem to be stumped with this. I just keep getting this error: "The resource object with key 'welcome' was not found."
My resource file is resource.resx. Containing 'welcome' with value as 'Welcome English'. Default.aspx has culture and UIculture set to 'Auto'. The Label1 expressions classkey is set to 'resource' and resourcekey as 'welcome'.
Any ideas??
Title: Very good article   
Name: Dan V
Date: 2006-08-13 7:43:59 AM
Thanks for this article, is very good in this moments when there are no many ASP 2.0 books.
Title: how do we do it in code behind!   
Name: Vai
Date: 2006-07-31 5:16:08 AM
I could achieve this in aspx pages, but it wasn't working through code behind pages. I am doing something like
Control.text = ResourceFileName.Keyname
Am i doing something wrong? Please can u help me out.

thanks in advance.
Title: Output Caching   
Name: Chau Nguyen
Date: 2006-07-01 7:19:41 AM
What about output caching? won't it cache the first language? how to optimize the website with localization? more than one server and/or adding a querystring with the language? varybyparam work ok with dropdownlist? i guess so eh?
Title: Great   
Name: Armen
Date: 2006-05-31 11:15:14 AM
Very propmt and clear introduction. I tried and get into that technique within several minutes. The article is exactly what I want.

Title: Re:   
Name: Bilal Haidar [MVP]
Date: 2006-05-26 1:45:00 PM
The Resource Manager would load all the resources to the AppDomain and they stay there as long as the AppDomain is running! The instance of the Resource Manager which is now created automatically by the framework will be cached for later usage!

Title: feeback   
Name: neil
Date: 2006-05-26 1:39:59 PM
1. visual studio creates one App_LocalResources folder PER folder, not just for the root folder of your application. If you have ~/Stuff/default.aspx, and you localize it, it will create ~/Stuff/App_LocalResources as well

2. what about caching? does asp.net cache local resources?
Title: joop   
Name: joop
Date: 2006-05-24 7:36:30 AM
so you go of comparing object references of lang and ""
Title: Thanks!   
Name: Yossi Bressler
Date: 2006-05-22 11:33:07 AM
Very good article.

I think that Listing 7 should be changed to:
asp:DropDownList ID="ddlLanguage" runat="server" AutoPostBack="True"
asp:ListItem Value="en-US" English (US) asp:ListItem
asp:ListItem Value="en-GB" English (UK) asp:ListItem
asp:ListItem Value="ar" Arabic asp:ListItem
asp:ListItem Value="fr" French asp:ListItem
asp:ListItem Value="he" Hebrew asp:ListItem

And in Listing 8 it should added:
using System.Threading;
using System.Globalization;

Thanks again
Title: Re: stej   
Name: Bilal Hadiar [MVP]
Date: 2006-05-22 1:58:58 AM
You are right about the DropDownList name, I must have changed it in the last minute :).

Title: one more question   
Name: stej
Date: 2006-05-22 1:52:48 AM
Hello, thank you for your post.

I'm wondering if .NET 2.0 provides the possibility to change the translations by client. It means: we release an app with default translations and the client would like to alter some of them. From what I know it would be possible only by means of recompilation of the assembly with resources. Is there any other way?

Thank you, stej

Is string lang =Request["DropDownList1"]; right? should it be
string lang =Request["ddlLanguage"];
Anyway, I don't know how it might work, I have thought client gets the ClientID, what may be "..ctl1__ctl0_.._ddlLanguage". And this should be the key into the collection. Am I wrong?
Title: Re: Dave   
Name: Bilal Haidar [MVP]
Date: 2006-05-21 3:38:50 PM
Hello Dave:
That is something great! I just checked the blog post, and I find it a cool thing to do!

Thanks for your comments.

Title: Custom ExpressionBuilders   
Name: Dave Reed
Date: 2006-05-21 3:14:00 PM
I love the new <%$ %> syntax that uses ExpressionBuilders. For complex scenarios, perhaps ones where the localized string isn't stored as a resource, you could build your own expression builder. Or, you can write one that can call any code you want... like GetLocalizedString(), which could get it from a database, config file, or what have you. I made a CodeExpressionBuilder to facilitate this in my blog, check it out :)
Title: Thanx   
Name: Jean Renier
Date: 2006-05-20 10:08:31 AM
I was wondering how it worked. After reading your excellent article i got it working in 5 minutes. Now waiting for those translations... :)
Title: Good Work Bilal   
Name: Mohannad Y. Salam
Date: 2006-05-05 4:56:28 AM
I would like to thank Bilal for sharing his excellent knowlege with us.

As Bilal said, localization is no more an add on feature it became a necessity to compete in market and gain worldwide customers.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-07-23 1:57:11 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search