Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Message catalog

The Java Standard Tag Library v1.0 is used to specify messages in the JSPs like this:

Code Block
<H1><fmt:message key="jsp.search.results.title"/></H1>

This message can be changed using the Messages.properties file. This must be done at build-time: Messages.properties is placed in the dspace Web application folder/archive.

Code Block
jsp.search.results.title = Search Results

Phrases may have parameters to be passed in, to make the job of translating easier, reduce the number of 'keys' and to allow translators to make the translated text flow more appropriately for the target language. Here is an example of a phrase in which two parameters are passed in:

Code Block
jsp.search.results.text = Results {0}-{1} of {2} 

Multiple Messages.properties can be created for different languages. See ResourceBundle. e.g. you can add German and Canadian French translations:

Code Block
Messages_de.properties
Messages_fr_CA.properties

The end user's browser settings determine which language is used by default. The user can change the language by clicking a link in the UI. These links are visible if more than one language is configured in DSpace. The English language file Messages.properties (or the default server locale) will be used as a fallback if there's no language bundle for the end user's preferred language. Note that the English file is not called Messages_en.properties. This is because it is always available as a fallback, regardless of server configuration.

Where to find the message catalog

The latest English message catalog is part of the main DSpace distribution and can be found at:

Code Block
titleLocation of the JSPUI message catalog in the DSpace source tree
[dspace-source]/dspace-api/src/main/resources/Messages.properties

The different translations for this message catalog are being managed separately from the DSpace core project, in order to release updates for these files more frequently than the DSpace software itself. Visit the dspace-api-lang project on Github.

Where to edit

In some cases you may want to add additional keys to the message catalog or changing the particular wording of DSpace concepts. For example, you may want to change "Communities" into "Departments". These kind of changes may get automatically overwritten again when you upgrade to the newest version of DSpace. It is therefore advised to keep such changes isolated in the following location:

Code Block
titleRecommended location for i18n customizations
[dspace-source]/dspace/modules/jspui/src/main/resources/

After rebuilding DSpace, any messages files placed in this directory will be automatically included in the JSPUI web application. Files of the same name will override any default files. By default, this full directory path may not exist or may be empty. If it does not exist, you can simply create it. You can place any number of translation catalogues in this directory. To add additional translations, just add another copy of the Messages.properties file translated into the specific language and country variant you need. 

After building and deploying, DSpace will finally read the files from the dspace-api-5_x.jar file in your [tomcat]\webapps\jspui\WEB-INF\lib directory.

Again, note that you will need to rebuild DSpace for these changes to take effect in your installed JSPUI web application!

For more information about the [dspace-source]/dspace/modules/ directory, and how it may be used to "overlay" (or customize) the default JSPUI interface, classes and files, please see: Advanced Customisation

Localization of input-forms.xml and license.default

The display labels for input-forms.xml and the text in the default submission license (license.default) are currently not managed in the messages catalogs. To localize these files, you can create versions of these files in the same folders, appending _LANGUAGE or _LANGUAGE_COUNTRY at the end of the filename, before the extension. For example, input-forms_de.xml can be used to translate the submission form labels in German.

Community translations for input-forms.xml and email messages

Even though they are currently not managed on Github yet, some community translations are available for other files, such as emails and the input-forms.xml.

Click here to access an overview of community translations (DSpace wiki)