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 (19)

  1. Garry Trinder says:

    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.

  2. Tamir says:

    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…

  3. sandman says:

    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.

  4. Pazu says:

    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).

  5. sandman you’re backing my point. English is the local language of some country and not at all local or understood in many other countries. So when you are coding in English you are reducing readability for people who do not understand english

    Actually I was joking, as I said developers are forced to learn english so that the code the write are understood by everyone. But for making programming approachable we should try this so that the world of programming is not completely cut-off for non-english speaking folks.

  6. 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)

  7. Actually, for code protection this is better than obfuscation!  =)

  8. Simon says:

    As the most-spoken language, all code should be written in Chinese.

  9. Mario says:

    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…..

  10. Antonio says:

    Is Chinese the most spoken language among programmers?

  11. Daniel Rieck says:

    Some time ago, Microsoft Germany announced G#, a .NET language with german keywords. This was on April Fools Day, though 🙁

  12. Sheva says:

    Simon, you are darn right:-)

    Sheva

  13. Zac says:

    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.

  14. lesbian rape says:

    Best of all people w can talk…

  15. anilnamde says:

    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

  16. GopZ says:

    Could u help me to Come Clearly with keywords & controls

    mail-id : vg.krishnan@hotmail.com

  17. shaan says:

    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

Skip to main content