Share via


localized C#

C# and .NET supports Unicode and it’s super-cool that you can use variables and literals in your own language and get it to build and run. I never tried that out until I read Brad Adams post. I wrote the following program in C# using Hindi to name variables and namespaces.

 using System;using System.Collections.Generic;using System.Text;namespace मेराप्रोग्राम
{
    class प्रोग्राम    {
        static void Main(string[] arg)
        {
            for (int संख्या = 0; संख्या < 10; संख्या++)
            {
                Console.WriteLine("क्रम {0}", संख्या);
            }
        }
    }
}

Michael Kaplan's post prompted me to share this code out. IMO most developers are forced to learn English. The reason is evident from the code above. Even if all documentations are available in localized version, I still need to know what's the meaning of the term "using", "for" and "class".

I always thought that I'd hack the Mono csharp compiler to create a language that'll be truly localized as in have localized keywords and support localized numbers as well. I looked into the mono-sources long back and remember seeing the file cs-tokenizer.cs which looked promising as it contained the list of keywords. Once VSTS is shipped I think I'll have some time to try that out.

Comments

  • Anonymous
    February 12, 2006
    Main issue here - class library is not localized.
    Console.WriteLine will be always in english.

    But this is nice try.
    Forcing everybody to use english is evil. Globalization is evil.

  • Anonymous
    February 12, 2006
    http://dedushka-jo.livejournal.com/35349.html
    See this stuff. It compiles and works.
    Yeah, not the main point is not to tell it to customers...

  • Anonymous
    February 13, 2006
    I'm not convinced this is as good an idea as it sounds.

    I have no problem with the idea of making programming easier by doing this /but/ you reduce the readability of the code to programmers who don't know the locale langauge used in that particular program unit.

  • Anonymous
    February 13, 2006
    There is one reason to use localised variable names: PropertyGridControl - this control shows direct names of a class. If you want just single-languange version and save some work with PropertyGrid you are forced to use this. The same is valid for DataGrid automated generation of columns and for relations in DataSet the same applies (in this case there is even no other way - the name of relation is shown in DataGrid literally without any chance to alias it).

  • Anonymous
    February 13, 2006
    The comment has been removed

  • Anonymous
    February 13, 2006
    IMHO, using localized keywords is nonsense. The IT jargon is english, there is no way around.
    Programming is not just learning some few keywords,
    but understanding technologies.
    (BTW, my native language is [swiss-] german)

  • Anonymous
    February 14, 2006
    Actually, for code protection this is better than obfuscation!  =)

  • Anonymous
    February 14, 2006
    As the most-spoken language, all code should be written in Chinese.

  • Anonymous
    February 14, 2006
    I seem to remember VBA used to be localized like that, with keywords translated. The effect was that macros written in one locale wouldn't work in another. Very handy.....

  • Anonymous
    February 14, 2006
    Is Chinese the most spoken language among programmers?

  • Anonymous
    February 14, 2006
    Here's Hebrew version ( Compiles and works in VS 2003 )http://devintelligence.com/cs/blogs/netadventures/archive/2006/02/14/1152.aspx

  • Anonymous
    February 15, 2006
    Some time ago, Microsoft Germany announced G#, a .NET language with german keywords. This was on April Fools Day, though :(

  • Anonymous
    February 17, 2006
    Simon, you are darn right:-)

    Sheva

  • Anonymous
    June 15, 2006
    I was thinking about that. I had a port of mono c# compiler that could something and solve alot of these problems. It used an xml file to write up aliases for class library names for other langauges and included a tool that would dump class names in their translated form. To many bugs though.

  • Anonymous
    June 23, 2006
    Best of all people w can talk...

  • Anonymous
    January 15, 2008
    Hello could u please tell me in detail how to get hindi identifiers on the C# code like u did in above example. I tried and ended with the english a-Z and all. my mail id anil_snnamde@rediffmail.com

  • Anonymous
    February 18, 2008
    Could u help me to Come Clearly with keywords & controls mail-id : vg.krishnan@hotmail.com

  • Anonymous
    December 31, 2008
    HEY, ITS NICE DONE DEAR. IT IS WORKING.THANKS TO SHOW ME NEW WAY OF C# PROGRAMMING. could u please tell me in detail how to get hindi identifiers on the C# code like u did in above example. I tried and ended with the english a-Z and all. plz... my mail id design4u@webdunia.com