Protege Resource Bundles
This articles describes Protege's support for internationalization using Java resource bundles.
The mechanisms described on this page are used to replace "fixed text" in the Protege user interface. Fixed text includes things like menu items, tab names, labels, and dialog titles. This is not a mechanism for authoring ontology and knowledge-base content in multiple languages simultaneously. Such support is entirely separate and documented elsewhere on this wiki.
Most of the fixed English text in the Protege user interface can be replaced with text from other languages. We also provide easy, standard ways for Protege plug-ins to provide internationalization support so that end-users can localize plug-in text. Currently, there are French and Russian resource bundles available for download from our Subversion repository:
If you develop a Protege resource bundle, please consider contributing it back to the Protege user community. We will be happy to host resource bundles in our source code repository.
Protege's support for internalization and localization is directly layered on top of Java's built-in support. Those already familiar with the way this support works will find the scheme described here easy to understand. Those not familiar with this support may wish to browse the Java Internationalization page on the Sun Microsystems web site for additional background information.
What is a resource bundle?
A resource bundle is essentially one or more Java "properties" files.
A Java properties file is just a list of "key-value" pairs. There is a "key" associated with every piece of text that needs to appear in the application. The "value" is the string that appears in the application. Thus, when the program needs a string, it accesses it from this file in a standard way using a key and displays whatever value is returned. Note that the program must be specifically written to access strings in this manner. If a Protege plug-in has not been written to be localizable, then you cannot localize it by providing a resource bundle. Instead you need to make modifications to the source code (or talk the original plug-in developer into doing so).
To follow is an example of a properties file (snippet taken from the actual properties file for the main Protege application):
menubar.file=File menubar.file.mnemonic=F menubar.edit=Edit menubar.edit.mnemonic=E menubar.project=Project menubar.project.mnemonic=P menubar.window=Window menubar.window.mnemonic=W menubar.help=Help menubar.help.mnemonic=H project.new=New Project... project.new.mnemonic=N project.new.shortcut=N project.open=Open... project.open.mnemonic=O project.open.shortcut=O project.open_recent=Open Recent project.open_remote=Open Remote Project... project.open_remote.mnemonic=R project.close=Close Project project.close.mnemonic=C project.save=Save Project project.save.mnemonic=S ...
The main Protege application (and each Protege plug-in) must have separate resource bundles for each language. Files in a resource bundle use the naming convention of <something>.properties. The property resource bundles for the main Protege application are located in the Protege installation directory and are named "protege_text_<language>_<country>.properties". Property resource bundles for Protege plug-ins go in the plug-in's installation directory and are named something like "<plugin_name>_text_<language>_<country>.properties". The exact name for the plug-in's files are chosen by the plug-in author.
These properties files contain the strings used by the Protege application. There can be simultaneous English, French, and German versions of these strings available in the same Protege installation since each file will have its own unique name. There can also be variants of these properties files such as "Canadian French", "Swiss French", "Australian English", etc. When the system starts up, the locale of the application is checked and the closest available set of files are loaded. Thus a user in Geneva might start up the application and strings would be loaded first from the "Swiss French", then from the "French", and then from the "default" properties files. This sort of mechanism decreases maintenance problems because the country specific files, if needed at all, can be quite small, only providing "overrides" where default language provides a value that is undesirable for the language dialect spoken in that country.