Steps to create and implement Satellite Assemblies - C#.NET

Explain the steps to create and implement Satellite Assemblies.

Satellite assemblies are resource assemblies specific to language/culture. Different resource files are created for different languages/cultures and then the needed one is loaded based on the user.

1. Create a new web application

2. Drag 2 label controls, a dropdownlist and a button control. Add 2 items to the drop down, en-US and fr-FR.

3. Add a new folder called resources and add 2 resource assembly files in it., e.g.: res1.resx and In res1.resx, add a key “Welcome” and value as “Hello there”. In, add a key called “Welcome” and value as “Bon Journe”.

4. Generate their resource files by using the resgen command for each of these resource files and keep them in the App_GlobalResources folder.

5. On button’s click even at the following code:
Session["language"]=dropdownlist1.SelectedItem .Text ;
Response.Redirect ("Webform2.aspx");

7. Add a label inWebform2.aspx. In page load event of Webform2.aspx.cs add the following code.
System.Resources.ResourceManager resourceManager
=ResourceManager.CreateFileBasedResourceManager("res1",Server.MapPath("Resources")+Path.DirectorySeparatorChar , null);
string getLanguage = Session["language"].ToString ();
CultureInfo cultureInfo=new CultureInfo(getLanguage);
Label1.Text=resourceManager.GetString ("Welcome",cultureInfo);
When you execute the Webform1.aspx, choose one of the English or French option from the dropdownlist and hit the button. It should display welcome message based on the chosen option from the dropdownlist.
Purpose of ResourceManager class - C#.NET
Explain the purpose of ResourceManager class - Use ResourceManager class to retrieve resources that exist in an assembly...
Steps to prepare culture-specific formatting - C#.NET
Steps to prepare culture-specific formatting - The NumberFormatInfo class is used to define how symbols, currencies etc are formatted based on specific cultures...
Steps to implement localizability to the user interface - C#.NET
Steps to implement localizability to the user interface - Implementation consists of basically translating the UI...
Post your comment