Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Appendix A: Tool for comparing property files side-by-side

Translation verification testing involves a language expert actually executing the product in order to correct the previously discussed translation errors. This process is time consuming, sometimes tedious, and error prone. As a means to alleviate some of these costs, improve productivity, and increase the quality of the final result, I wrote a simple view that displays two property files side-by-side, using run-time formatting and parameter substitution. This enables the language expert to quickly validate the initial translation and see the messages formatted in the same fashion as in the running product itself. Download the code for this tool.

More precisely, here are the problems that the Property Files Compare tool addresses:

  • Enables the language expert to quickly validate the initial translation. Remember, the first translation is generally done "in bulk" by translators who have no product experience. They employ translation tools that help assure the consistency of the translation, but this is no substitute for on-site verification. Translation verification testers are aware of the product metaphors and are capable of quickly reviewing translations in a side-by-side fashion in order to catch obvious gaffes.

  • Visualizes the messages formatted in the same fashion as in the running product itself, including parameter substitution. This helps detect common errors like missing or extraneous quotes, missing closing braces, etc. While most of these errors will show up in the source language, others are introduced during translation. Extraneous or missing single quotes are a notorious example, even in English (for example, "The process didnt complete" has a missing apostrophe, "The process didn''t complete" has an extra apostrophe). See One or two quotes? below for more details.

  • Assures that the messages are displayable. As simple as this might sound, encoding/conversion errors are not uncommon (refer to How to Internationalize your Eclipse plug-in for details). A quick display of a properties file in the actual run-time environment is a good "sanity" check.

  • Assures that all the keys defined in the source language exist in the target language property file, and visa-versa. Mismatches occur when keys from source language are added or deleted and the appropriate correction is not propagated to the target language files, as well as when keys are inadvertently deleted from the target language files.

  • Flags untranslated text.

Once its plug-in is installed, open it by selecting Perspectives > Show View > Java > Properties Files Compare. Then enter the name of the directories containing your source and target languages; pressing Enter while the Source Language Directory or Target Language Directory field has the focus will start a search for all *.properties files. Selecting one of the property files on the left will attempt to auto-select its corresponding target on the right by matching the same partial file specification, starting at the last occurrence of "eclipse" in the directory path.

Figure 1Figure 1. Properties file comparison view


For example, if the Eclipse Workbench is installed in x:\eclipse2.0, the Eclipse install root is a subdirectory directly beneath it called, unsurprisingly, eclipse. The view assumes that you (a) maintain native language property files in separate subdirectory trees by language, or that (b) the original language (source) files have no country suffix and the target files have a suffix based on the country code returned by the operating system. For example:

(a) Languages separated by directory
x:\english\eclipse\plugins\org.eclipse.core.jdt\plugin.properties
x:\french\eclipse\plugins\org.eclipse.core.jdt\plugin.properties
x:\german\eclipse\plugins\org.eclipse.core.jdt\plugin.properties

(b) Languages separated by country-specific file suffix
x:\eclipse\plugins\org.eclipse.core.jdt\plugin.properties
x:\eclipse\plugins\org.eclipse.core.jdt\plugin_fr.properties
x:\eclipse\plugins\org.eclipse.core.jdt\plugin_de.properties

So entering x:\english in the first directory field and pressing Enter will initiate a search starting from the English subdirectory. Entering x:\french in the second directory field will initiate a search starting from the French subdirectory. Selecting a properties file found in the list of Source Language list will automatically select the corresponding file in the Target Language list, and display their contents sorted by key.

NOTE

Another tool, called RBManager, is available on IBM's alphaWorks site. According to the description there, "RBManager (Resource Bundle Manager) is a tool that automates many of the tedious tasks associated with creating, updating, and managing resource bundle files; it also prevents most common mistakes from being propagated across bundles. This tool is helpful for development teams working on internationalized applications and Web-based services."

RBManager doesn't include a side-by-side property files view (yet?), however it definitely helps manage the many resource files that are typically involved in a translation. RBManager includes good documentation and a tutorial.

  • + Share This
  • 🔖 Save To Your Account