One of the truisms of modern software is that the end user is just as likely to be a non-english speaker/reader as they are to be one. As such, a rather large can of worms gets opened up regarding L10n (Localization). L10n is difficult to get right from a development standpoint, but dead-easy to test. All you need is a simple python script and a couple hours to look at all of your screens. Okay, that’s a bit of a simplification, but if you do that then you are most of the way home (L10n in exceptions/logs requires code analysis, but you can modify the script discussed in the developer notes discussion to do that).

Anyhow, back to the topic at hand; testing L10n. There are a few simple items that L10n testing should looking for.

  • completeness – everything that should be flagged as localizable is
  • branding – typically, stuff that are trademarked or are related to a specific brand are not marked as localizable
  • sentence fragments – this is a big one from a contextual standpoint. Every sentence, or better still, should be one “resource”. Building a sentence in fragments in the code then doing something with it almost guarantees that your translators are going to get the context wrong for some part of the sentence

Notice how correctness of information is not there. That is the responsibility of whomever you enlist to translate. But you can certainly help things along by following the last point above.

The way we test L10n is through LOUD, named after the fact that typing in all caps online is interpreted as yelling, which is of course loud. A LOUDed application will look horrific, but clearly points out violations of our rules. ^THIS IS WHAT A SENTENCE LOOKS LIKE LOUDED.$ The ^ marks the beginning of the block, a $ marks the end and the content itself is in uppercase.

So lets LOUD. The class below is taken straight from the java api documentation on resource bundles.


public class MyResources extends ListResourceBundle {
    public Object[][] getContents() {
        return contents;
    }

    static final Object[][] contents = {
        // LOCALIZE THIS
        {"OkKey", "OK"},
        {"CancelKey", "Cancel"},
        // END OF MATERIAL TO LOCALIZE
    };
}

With a bit of python (which can be found here), you get


public class MyResources extends ListResourceBundle {
    public Object[][] getContents() {
         return contents;
    }

    static final Object[][] contents = {
        // LOCALIZE THIS
        {"OkKey", "^OK$"},
        {"CancelKey", "^CANCEL$"},
        // END OF MATERIAL TO LOCALIZE
    };
}

All you need to do then is load this customized message bundle and verify your application. You could even go so far as to have multiple message bundle formats for different locales. German could be LOUD, Japanese could be CrAzY etc. by just tweaking the script a bit to fit your class heirarchy.