Verifying that Messages Come from Locale-specific Message FilesThe purpose of this type of testing is to verify that all appropriate strings have been internationalized and that innapropriate ones have not. This applies to button and menu labels, footer and other window text messages, and command line messages. Simply checking the source code is not sufficient. In some cases it is unclear that a string should be messaged until a problem arises when the program is run. Even when a string in the source code is wrapped with the correct message call, the string must access the correct message class file. ApproachA good approach is to bracket each message with a prefix and suffix, then create a modified message class file and install it in another locale. For multibyte locales, at least part of the prefix and suffix should contain multibyte characters. Assume that the original message files are text files with lines of the form key=value. We assume that the message file is made into a .java file, then compiled to a .class file. When:
For example, given a message file named xx.messages, after translation a script converts it to a file named MyClass.java. Then MyClass.java is compiled--assuming it will be installed in the ja locale--into MyClass_ja.class. This class file is then installed in the appropriate location so that the product can find it. The prefix and suffix can be long enough to make the total message length up to 200% larger than the original message. These longer messages can also show that various widgets are able to resize to handle longer strings. How to Test
Sample ProgramsNOTE: These tools and scripts are customized for testing the messages in a certain product. These tools and scripts are working versions and will probably need customization for your product. There are other approaches one could take to implement what these tools and scripts do. In the examples below, message files and non-message files, both localizable and non-localizable, are all placed in two .java files. They are then compiled into a .<locale>.class file and installed. The locale-specific .class file is named XX_YY.class, where XX is the classname and YY is the suffix of the locale, such as fr or ja.
| ||||||||
|
| ||||||||||||