Difference between revisions of "Internationalization/dotnet locale"

m (Style)
Line 10: Line 10:
  
 
== Listing available locales ==
 
== Listing available locales ==
 +
 
I didn't find a function that returns all the available locale informations, I think because under .NET, they are all avaiable.
 
I didn't find a function that returns all the available locale informations, I think because under .NET, they are all avaiable.
  
Line 16: Line 17:
 
To obtain informations on a specific locale, it suffices to create an instance of CULTURE_INFO. There are basically two ways to do this:
 
To obtain informations on a specific locale, it suffices to create an instance of CULTURE_INFO. There are basically two ways to do this:
  
# Create it with the culture identifier. This identifier maps every culture/language to an integer. It is not very usefull, because I did not find a logic behind the mapping function... You can find a table on [1]
+
# Create it with the culture identifier. This identifier maps every culture/language to an integer. It is not very usefull, because I did not find a logic behind the mapping function... You can find a table on [http://msdn2.microsoft.com/en-us/library/ms172470.aspx here]
 
# Create it with the name (STRING) of the culture. The culture names follow the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166.
 
# Create it with the name (STRING) of the culture. The culture names follow the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166.
  
You can find a detailed description of RFC 1766 on [2]
+
You can find a detailed description of RFC 1766
  
 
The CULTURE_INFO Class has some attibutes useful for the retrieving of the informations about Date, Time and Number formatting, they are:
 
The CULTURE_INFO Class has some attibutes useful for the retrieving of the informations about Date, Time and Number formatting, they are:
  
 
+
* date_time_format: DATE_TIME_FORMAT_INFO ([http://msdn2.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx see here])
* date_time_format: DATE_TIME_FORMAT_INFO (see: [3])
+
 
+
  
 
{| border="1"
 
{| border="1"
Line 58: Line 57:
  
  
* number_format: NUMBER_FORMAT_INFO (see: [4])
+
* number_format: NUMBER_FORMAT_INFO ([http://msdn2.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx see here])
  
  
Line 93: Line 92:
  
 
=== Links ===
 
=== Links ===
 
[1] http://msdn2.microsoft.com/en-us/library/ms172470.aspx
 
 
[2] http://www.faqs.org/rfcs/rfc1766.html
 
 
[3] http://msdn2.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx
 
  
 
[4] http://msdn2.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx
 
[4] http://msdn2.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx
Line 104: Line 97:
 
=== References ===
 
=== References ===
  
ms-help://MS.NETFramework.v20.en/cpref8/html/T_System_Globalization_CultureInfo.htm (*)
+
* ms-help://MS.NETFramework.v20.en/cpref8/html/T_System_Globalization_CultureInfo.htm (ms-help is the .NET documentation)
 
+
* http://msdn2.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx
http://msdn2.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx
+
* http://msdn2.microsoft.com/en-us/library/system.globalization.compareinfo.aspx
 
+
see: http://msdn2.microsoft.com/en-us/library/system.globalization.compareinfo.aspx
+
 
+
(*) : ms-help is the .NET documentation
+

Revision as of 05:54, 1 September 2006


Summary

There is a class named CULTURE_INFO in "mscorlib" in EiffelStudio, which provides information about a specific culture such as:

  • associated language
  • sublanguage
  • country/region
  • calendar
  • cultural conventions

Listing available locales

I didn't find a function that returns all the available locale informations, I think because under .NET, they are all avaiable.

Checking for default locale

Retrieving locale information

To obtain informations on a specific locale, it suffices to create an instance of CULTURE_INFO. There are basically two ways to do this:

  1. Create it with the culture identifier. This identifier maps every culture/language to an integer. It is not very usefull, because I did not find a logic behind the mapping function... You can find a table on here
  2. Create it with the name (STRING) of the culture. The culture names follow the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166.

You can find a detailed description of RFC 1766

The CULTURE_INFO Class has some attibutes useful for the retrieving of the informations about Date, Time and Number formatting, they are:

  • date_time_format: DATE_TIME_FORMAT_INFO (see here)
Some information that is available in DATE_TIME_FORMAT_INFO
Information Result for locale "it-CH"
full_date_time_pattern dddd, d. MMMM yyyy HH:mm:ss
long_date_pattern dddd, d. MMMM yyyy
long_time_pattern HH:mm:ss
month_day_pattern d. MMMM
rfc1123_pattern ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
pm_designator
short_date_pattern dd.MM.yyyy
short_time_pattern HH:mm
sortable_date_time_pattern yyyy'-'MM'-'dd'T'HH':'mm':'ss
time_separator


  • there are also functions that return abbreviations of names of months and day:
    • get_abbreviated_day_name (dayofweek: DAY_OF_WEEK) : SYSTEM_STRING
    • get_abbreviated_month_name (month: INTEGER) : SYSTEM_STRING


  • number_format: NUMBER_FORMAT_INFO (see here)


Some information that is available in NUMBER_FORMAT_INFO
Information Result for locale "it-CH"
currency_group_separator '
currency_symbol SFr.
currency_decimal_digits 2
negative_sign -
number_decimal_digits 2
number_decimal_separator .
number_group_separator '
positive_sign +
negative_sign -
negative_infinity_symbol -Infinito
per_mille_symbol ë
na_n_symbol Non un numero reale

Other information

Links

[4] http://msdn2.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx

References