Hi...
Ques: Hello all of you now I have work on a Globalization Please explain What is Globalization? What are the 3 different ways to globalize web applications?What are the steps to follow to get user's culture at run time?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anuja PawarPosted Jan 10, 2012, 3:37 AM
Try this simple code to make your base clear
The System.Globalization namespace contains classes that define culture-related information, including the language, the country/region, the calendars in use, the format patterns for dates, currency, and numbers, and the sort order for strings. These classes are useful for writing globalized (internationalized) applications. We will show you a simple sample about how to write a globalized calendar in ASP.NET 2.0 and C#.
We will show three languages in the calendar, English, Chinese and Janpanse.
First, import the namespace of System.Threading.
using System.Threading;
When we select one language the page will show by the selected language.
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(this.DropDownList1.SelectedValue);
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.DropDownList1.SelectedValue);
The front end Default.aspx page looks something like this:
The flow for the code behind page is as follows.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(this.DropDownList1.SelectedValue);
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.DropDownList1.SelectedValue);
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(this.DropDownList1.SelectedValue);
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.DropDownList1.SelectedValue);
}
}
http://www.dotnetspider.com/resources/793-Globalization-Web-Applications-using-ASP-NET.aspx
Satyapriya NayakPosted Jan 7, 2012, 12:51 AM
Globalization
Globalization includes the process of first internationalizing the application code, followed by localizing the application to other languages and cultures. The internationalization process makes it possible to translate, store, retrieve, and present application content for any locale, preferably using the same application code base. Locale is the combination of both language and cultural environment, including the format of dates, times, currencies, telephone numbers, and so on. This implies isolating locale-dependent from locale-independent content and also preparing code to dynamically format that content according to locale. The end result of application internationalization supports its localization. Localization means adapting your application to other locales by translating and formatting content according to culture, hopefully without touching the code. This localization process should be relatively painless for the development team if internationalization was part of the initial development cycle. However, the first time around this usually unveils any bugs introduced by internationalization, such as accidentally translated file or field names.
3 different ways to globalize web applications
Detect and redirect approach : In this approach we create a separate Web application for each supported culture, and then detect the user's culture and redirect the request to the appropriate application. This approach is best for applications with lots of text content that requires translation and few executable components.
Run-time adjustment approach : In this approach we create a single Web application that detects the user's culture and adjusts output at run time using format specifiers and other tools. This approach is best for simple applications that present limited amounts of content.
Satellite assemblies approach : In this approach we create a single Web application that stores culture-dependent strings in resource files that are compiled into satellite assemblies. At run time, detect the user's culture and load strings from the appropriate assembly. This approach is best for applications that generate content at run time or that have large executable components.
To get the user's culture at run time, follow these steps:
1. Get the Request object's UserLanguages property.
2. Use the returned value with the CultureInfo class to create an object representing the user's current culture.
For example, the following code gets the user's culture and displays the English name and the abbreviated name of the culture in a label the first time the page is displayed:
private void Page_Load(object sender, System.EventArgs e)
{
// Run the first time the page is displayed
if (!IsPostBack)
{
// Get the user's preferred language.
string sLang = Request.UserLanguages[0];
// Create a CultureInfo object from it.
CultureInfo CurrentCulture = new CultureInfo(sLang);
lblCulture.Text = CurrentCulture.EnglishName + ": " +
CurrentCulture.Name;
}
}
Thanks