You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$10
For Premium members:
This article describes the globalization and localization concepts in C#.
Introduction Globalization is the process of designing and developing applications that function for multiple cultures. Localization is the process of customizing your application for a given culture and locale. Cultures and Locales The language needs to be associated with the particular region where it is spoken, and this is done by using locale (language + location). For example: fr is the code for French language. fr-FR means French language in France. So, fr specifies only the language whereas fr-FR is the locale. Similarly, fr-CA defines another locale implying French language and culture in Canada. If we use only fr, it implies a neutral culture (i.e., location neutral). Set culture information Application level -In web.config file <configuration> <system.web> <globalization culture="fr-FR" uiCulture="fr-FR"/> </system.web> </configuration>
Resource Files
e.g. A resource file might contain a resource with the key Button1 and the value Submit Resource files in ASP. NET have an .resx extension. At run time, the .resx file is compiled into an assembly. Global Resource Files
Local Resource Files A local resources file is one that applies to only one ASP. NET page or user control (an ASP. NET file that has a file-name extension of .aspx, .ascx, or .master).
Implicit Localization with Local Resources
Explicit Localization
Localizing Static Text
<asp:Localize ID="l1" runat="server" Text="Welcome!" meta:resourcekey="button1" /> Get Resource value programmetically Label3.Text = Resources.Resource.b1; Label3.Text = GetLocalResourceObject("Button1.Text").ToString(); Label3.Text = GetGlobalResourceObject("resource", "color"); Example Create a Multi-Lingual Site with Localization Web page Step 1 Drag a button and Label Step 2 Right click on web site- Add ASP.NET Folder - Add App_Local Resource -Select - Step 3 Right click on Add New item - Resource File - Name (Default.aspx.resx)- Name (Button1.Text)- Ok / Label1.Text-English-Copy the RESX file and Paste it Step 4 Rename it - (Deafult.aspx.fr.resx)- edit it..(Button1.Text)- Namaste / Label1.Text- French. .aspx page <asp:Button meta:resourcekey="button1" /> <asp:Label meta:resourcekey="label1" />
Header <%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" Culture="Auto:en-US" UICulture="Auto" %> Next.. Right cilck on web site- Add ASP.NET Folder - Add App_GlobalResources - Add Resource - Name and Value copy and paste and rename (Resource.fr.resx)- Now drag a new label :- label id(name)-renamecopypaste- expression - text - expression type=resource- expression property=class key=resource Resource key-welcome
FOR LANG TRANSLATION http://code.google.com/intl/fr/apis/language/transliterate/v1/getting_started.html
New Features in C# 6.0