Quick Custom Culture to Change Euro Currency Symbol

I was asked for a quick sample of how to build a culture, so here it is: 

1.) Start an elevated command prompt (have to be elevated to run CultureAndRegionInfoBuilder.Register())  (press windows key, type cmd, press ctrl+shift+enter is one way).
2.) copy the code below to testcc.cs.  (notepad testcc.cs and cut & paste the code).
3.) in cmd, add .net to your path:  path=%path%;%windir%Microsoft.NETFrameworkv4.0.30319  (Please use Microsoft.Net Framework v4 (or whatever’s later if you read this in the future), it has more fields)
4.) csc /r:sysglobl.dll “testcc.cs”
5.) testcc.exe
You’ll have to restart any managed process using the symbol, but intl.cpl should show you the updated results.
This makes an et-EE.nls file in %windir%globalization, and a registry entry.  See http://blogs.msdn.com/b/shawnste/archive/2009/05/14/cheating-to-uninstall-custom-cultures-locales.aspx for how it might be pushed with an admin logon script.  You can remove the “Register” statement, recompile & rerun to remove it.
Remember all the “AS-IS, no warranty, I didn’t bother to test it” stuff that’s in the Terms of Use :)

// testcc.cs

using System;
using System.Globalization;

class Test
    static void Main()
        // Show what we were
        Console.WriteLine(“Old Currency Symbol: ” + new CultureInfo(“et-EE”).NumberFormat.CurrencySymbol);
        Console.WriteLine(“Old Currency Name: ” + new RegionInfo(“et-EE”).CurrencyEnglishName);
        // Build new one
        CultureAndRegionInfoBuilder updated = new CultureAndRegionInfoBuilder(“et-EE”, CultureAndRegionModifiers.Replacement);
        updated.CurrencyEnglishName = “Euro”;
        updated.CurrencyNativeName = “Euro”;
        updated.ISOCurrencySymbol = “EUR”;
        NumberFormatInfo format = updated.NumberFormat;
        format.CurrencySymbol = “€”;
        updated.NumberFormat = format;
        // Get rid of anything there used to be
            // See if there’s an old one to obliterate
            // Should worry about errors, I’m just assuming not registered.
        // Register it
        // Have to re-run to show the new values

Comments (4)

  1. shawnste says:

    This is basically the same if you want to change to the soon-to-be-added-to-Unicode Indian Rupee currency symbol.  Assuming of course that this stays the same:

    "The new rupee sign will be encoded in Unicode 6.0 as U+20B9 INDIAN RUPEE SIGN. Publication of Unicode 6.0 will be briefly delayed until October 11 to allow opportunity for the character to be reviewed first in ISO/IEC JTC1/SC2/WG2."

  2. Melborp says:

    The code kind of works, it does create a custom locale with the modifications however, for the changes to take effect, one needs to reset the format settings. I havent found a way to reset it programmatically.

    Not even restart works, explicit reset is necessary as far as i have tried. I have tried it on Windows 7.

    intl.cpl doesnt shows previous settings until you reset to remove custom settings and then it goes to euros.

  3. shawnste says:

    Ah, yes, sorry, I forgot the tricky part of currency updates.  We store the user overrides, which override the default symbol (that's what they're for).  Unfortunately for legacy reasons they get set all the time, so when a culture's updated we can't tell what's user overridden intentionally and what's just the default.  I missed this because my default locale isn't et-EE, so my sample looked OK for me :)  I did catch that for the rupee :) blogs.msdn.com/…/unicode-6-0-has-a-new-indian-rupee-symbol-how-do-i-get-it.aspx

    You can automate intl.cpl using the info from blogs.msdn.com/…/configuring-international-settings-from-the-command-line.aspx or msdn.microsoft.com/…/bb964650

  4. Neelam says:

    this is not working on windows server 2008. Even after restarting the system… Please help…