Thursday, September 20, 2007

Project Localizer - An Interesting way to Localize your Project

Code Project - Project Localizer

"Project Localizer is a tool to localize any kind of source file. What does it mean, exactly? The tool does two things:

  1. Replaces all strings in a source file with a specified expression, e.g.
    MessageBox.Show("I like you.");
    becomes
    MessageBox.Show(localizer["ILikeYou"]);  // XML localizer
    or
    MessageBox.Show(localizer.ILikeYou);  // hard-coded localizer

  2. Generates localizer files in any programming language using a predefined template, e.g. an XML file:
    <localizer>
    <language name="English">
    <string id="ILikeYou">I like you.</string>
    </language>
    </localizer>
    or a hard-coded localizer:
    interface ILocalizer
    {
    string ILikeYou { get; }
    }
    class EnglishLocalizer : ILocalizer
    {
    public string ILikeYou get { return "I like you."; }
    }
    ...etc.

Background


Sometimes a small project suddenly becomes a big project and we want to make it more global. If we were not provident enough to use resource files, we could come across tens of source files full of not localized (likely English) strings inside. So, we set our shoulder to the wheel and start to rewrite the whole code... Or we use some smart tool, like Project Localizer.

..."


This looks like a pretty interesting (and easy) way to localize a project. Using the XML localizer, it looks like you could easily add additional translations executed by others...


Now to look into a VB language template... ;)

1 comment:

  1. A VB version of this would be very interesting to see.

    ReplyDelete

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...