[Mono-devel-list] CultureInfo

Paolo Molaro lupus at ximian.com
Wed Apr 16 13:42:00 EDT 2003


On 04/15/03 Lee Mallabone wrote:

Index: CultureInfo.cs
@@ -46,214 +47,9 @@
 		//
 		void InitializeByID (int culture_id, bool use_user_override)
 		{
-			switch (culture_id){
-			case 0x0001: // ar Arabic
-			case 0x0401: // ar-SA Arabic (Saudi Arabia)
-			case 0x0801: // ar-IQ Arabic (Iraq)
-			case 0x0C01: // ar-EG Arabic (Egypt)
-			case 0x1001: // ar-LY Arabic (Libya)
-			case 0x1401: // ar-DZ Arabic (Algeria)
-			case 0x1801: // ar-MA Arabic (Morocco)
-			case 0x1C01: // ar-TN Arabic (Tunisia)
[...]
+		private static Hashtable cultureData;
+
+		static CultureInfo() {
+			// Build a hash called cultureData containing the name, 2iso, 3iso and 3win codes
+			cultureData = new Hashtable(CaseInsensitiveHashCodeProvider.Default,
+						  				CaseInsensitiveComparer.Default);
+
+			cultureData.Add(0x0427, new CultureCodeInfo("lt-LT", "lt", "lit", "LTH")); // Lithuanian (Lithuania)
+			cultureData.Add(0x0011, new CultureCodeInfo("ja", "ja", "jpn", "JPN")); // Japanese
+			cultureData.Add(0x0c07, new CultureCodeInfo("de-AT", "de", "deu", "DEA")); // German (Austria)

This change would make each program running in mono use about 50KB
of memory and it would make the startup of applications much slower.
The initialization needs to be done lazily for each culture when the
info for that specific culture is requested.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list