Saturday, 2 January 2016
Thursday, 9 January 2014
THIS IS EXAMPLE SITE LONG TITLE FOR YOUR BLOG
By:
Lucas Harrison
on 18:22
Ini adalah contoh text yang dapat anda gunakan dalam pembuatan dummy sebuah situs. Ada pun tujuan dari pembuatan contoh text dummy ini adalah untuk mempersingkat durasi saat membuat dari sebuah situs.
Ini adalah contoh text yang dapat anda gunakan dalam pembuatan dummy sebuah situs. Ada pun tujuan dari pembuatan contoh text dummy ini adalah untuk mempersingkat durasi saat membuat dari sebuah situs. Ini adalah contoh text yang dapat anda gunakan dalam pembuatan dummy sebuah situs. Ada pun tujuan dari pembuatan contoh text dummy ini adalah untuk mempersingkat durasi saat membuat dari sebuah situs.
Ini adalah contoh text yang dapat anda gunakan dalam pembuatan dummy sebuah situs. Ada pun tujuan dari pembuatan contoh text dummy ini adalah untuk mempersingkat durasi saat membuat dari sebuah situs.
Ini adalah contoh text yang dapat anda gunakan dalam pembuatan dummy sebuah situs. Ada pun tujuan dari pembuatan contoh text dummy ini adalah untuk mempersingkat durasi saat membuat dari sebuah situs. Ini adalah contoh text yang dapat anda gunakan dalam pembuatan dummy sebuah situs. Ada pun tujuan dari pembuatan contoh text dummy ini adalah untuk mempersingkat durasi saat membuat dari sebuah situs.
Ini adalah contoh text yang dapat anda gunakan dalam pembuatan dummy sebuah situs. Ada pun tujuan dari pembuatan contoh text dummy ini adalah untuk mempersingkat durasi saat membuat dari sebuah situs.
Wednesday, 8 January 2014
ASP.NET MVC 5 Internationalization
By:
Lucas Harrison
on 00:20
Introduction
If your website targets users from different parts of the world, these users might like to see your website content in their own language. Creating a multilingual website is not an easy task, but it will certainly allow your site to reach more audience. Fortunately, the .NET Framework already has components that support different languages and cultures.
We will build an ASP.NET MVC 5 web application that contains the following features:
- It can display contents in different languages.
- It autodetects the language from the user's browser.
- It allows the user to override the language of their browser.
Globalization and Localization in ASP.NET
Internationalization involves Globalization and Localization. Globalization is the process of designing applications that support different cultures. Localization is the process of customizing an application for a given culture.
The format for the culture name is "<languagecode2>-<country/regioncode2>", where <languagecode2> is the language code and <country/regioncode2> is the subculture code. Examples include es-CL for Spanish (Chile) and en-US for English (United States).
Anyway, Internationalization is often abbreviated to "I18N". The abbreviation takes the first and last letters and the number of letters between them, so 18 stands for the number of letters between the first "I" and the last "N". The same applies to Globalization (G11N), and Localization (L10N).
ASP.NET keeps track of two culture values, the Culture and UICulture. The culture value determines the results of culture-dependent functions, such as the date, number, and currency formatting. The UICulture determines which resources are to be loaded for the page by the ResourceManager. The ResourceManager simply looks up culture-specific resources that is determined by CurrentUICulture. Every thread in .NET has CurrentCulture and CurrentUICulture objects. So ASP.NET inspects these values when rendering culture-dependent functions. For example, if current thread's culture (CurrentCulture) is set to "en-US" (English, United States), DateTime.Now.ToLongDateString() shows "Saturday, January 08, 2011", but if CurrentCulture is set to "es-CL" (Spanish, Chile) the result will be "sábado, 08 de enero de 2011".
Now, let’s review the terms used so far:
- Globalization (G11N): The process of making an application support different languages and regions.
- Localization (L10N): The process of customizing an application for a given language and region.
- Internationalization (I18N): Describes both globalization and localization.
- Culture: It is a language and, optionally, a region.
- Locale: A locale is the same as a culture.
- Neutral culture: A culture that has a specified language, but not a region. (e.g. "en", "es")
- Specific culture: A culture that has a specified language and region. (e.g. "en-US", "en-GB", "es-CL")
Why do we need a region? Isn’t a language alone enough?
You might not need a region at all. It is true that English in the United States is not the same as English in the United Kingdom but if your application just shows English text readable to people from these English-speaking countries, you will not need a region. The problem arises when you need to deal with numbers, dates, and currencies. For example, compare the following output for two different Spanish-speaking regions (Chile, Mexico):
int value = 5600;
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-CL");
Console.WriteLine(DateTime.Now.ToShortDateString());
Console.WriteLine(value.ToString("c"));
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-MX");
Console.WriteLine(DateTime.Now.ToShortDateString());
Console.WriteLine(value.ToString("c"));
// Output
26-07-2011 // Date in es-CL, Spanish (Chile)
$5.600,00 // Currency in es-CL, Spanish (Chile)
26/07/2011 // Date in es-MX, Spanish (Mexico)
$5,600.00 // Currency in es-MX, Spanish (Mexico)
Subscribe to:
Comments (Atom)





