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:

Anonymous said...

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