Tuesday 26 May 2009

Welsh on Windows Server 2003

Beware if you want to use cy-GB locale on Windows Server 2003 - you will need to update to Service Pack 2 - as this locale is not present in the original release or service pack 1.

If you cannot upgrade to service pack 2, I found a useful resource on the University of Wales - Bangor - language technology website.

I have repeated the relevant information here for future reference:

1. Create a cy-gb.ldml with the C# code by running the following code on a windows XP SP2 machine (NB this references the following Sample code for getting ELK cultures on other platforms by Michael Kaplan).

   1: using System;
   2: using System.Globalization;
   3:  
   4: namespace Testing 
   5: {
   6:     class Test 
   7:     {
   8:             [STAThread]
   9:             static void Main(string[] args) {
  10:                 CultureAndRegionInfoBuilder carib = new CultureAndRegionInfoBuilder("cy-GB", CultureAndRegionModifiers.Replacement);
  11:                 carib.LoadDataFromCultureInfo(new CultureInfo("cy-GB", false));
  12:                 carib.LoadDataFromRegionInfo(new RegionInfo("cy-GB"));
  13:                 carib.Save(@"c:\cy-GB.ldml");
  14:             }
  15:         }
  16:     }
  17: }

2. Copy the cy-gb.ldml file to your Windows 2003 (or Windows 2000) machine

3. Open the cy-gb.ldml file in Notepad or any text editor and search for the lines containing :


   1: msLocale:textInfoName type="cy-GB"
   2: msLocale:sortName type="cy-GB"

and change them to


   1: msLocale:textInfoName type="en-GB"
   2: msLocale:sortName type="en-GB"

Then register your new ‘custom locale’ by executing the following code on the Windows 2003 box:

   1: using System;
   2: using System.Globalization;
   3:  
   4: namespace Testing {
   5:       class Test {
   6:           [STAThread]
   7:           static void Main(string[] args) {
   8:               CultureAndRegionInfoBuilder carib = CultureAndRegionInfoBuilder.CreateFromLdml(@"c:\cy-GB.ldml");
   9:               carib.Register();
  10:           }
  11:       }
  12:   }

NB - to compile the code you can use the following:

   1: csc /r:sysglobl.dll welsh.cs

So should all be okay now!!