Skip to content
Ondřej Košarko edited this page Feb 6, 2018 · 9 revisions

These instructions apply to versions before 2017.04; for 2017.04 and later see also Language localisation

The following sections describe steps that need to be taken in order to provide the repository in a different language. Basically the changes that were done in #459 and 0e1454 minus the work in *.java and *.xsl files which internationalized missed strings.

To jump start the translations it's worth checking whether upstream dspace was translated into the target language. See dspace-xmlui-lang project and/or DSpace I18n support page.

Configuration

Start witch setting supported.locales in local.properties, eg. supported.locales = en, cs.

Translating UI

Most of the UI strings are located in messages.xml file, you'll need to provide your own translation of this file, name it messages_LOC.xml where LOC is the supported locale you've added in the previous step. You can start by copying messages.template into dspace/modules/xmlui/src/main/webapp/i18n

The rest of the UI strings are in javascript files, currently each of the files carries its dictionary. Search for i18n.load and provide your own translation either replace the old ones or add a new i18n.load("LOC"... call the files can be overlaid.

./dspace-xmlui/src/main/webapp/themes/UFAL/lib/js/dragndrop.js
./dspace-xmlui/src/main/webapp/themes/UFAL/lib/js/fileupload.js
./dspace-xmlui/src/main/webapp/themes/UFAL/lib/bootstrap/js/ufal.min.js

If you have changed input-forms.xml you'll need to add message keys into them and put the values into messages.xml and messages_LOC.xml. If there are many changes you might try using this gist that will replace the values in input-forms file you supply and writes a "messages" file, you can then paste the result into your messages.

Translating static content

Put the translations into /dspace-xmlui/src/main/webapp/themes/UFAL/lib/html/LOC check the cs/ dir to see which files need translating or see d9d0ae(basis for the czech translations, bit outdated now). Notice the files come in pairs there is always .xml and .html, the .html needs to be well-formed xml! Notice the dummy.* file in cs/. The logic choosing the correct files is based on url and locale. With url xmlui/page/FILE it first checks whether FILE.xml exists in default location ie. (/dspace-xmlui/src/main/webapp/themes/UFAL/lib/html/FILE.xml), then it checks whether also LOC/FILE.xml exists and includes that if it does, if it does not exist it includes LOC/dummy.xml. Which in our case says something like "sorry, no translation yet. check the english version LINK".

Deposition license

If you haven't set per collection licenses default.license is displayed and stored. When user is viewing the repository with different then english locale, we show (on /xmlui/page/contract) an alternative license (configurable. In the current setup we always store the default one, page/contract explains this to the user. There are few more deatils in #491

Flags

At the moment flags (to switch between languages) are part of lindat common ie. they are expected in /themes/UFAL/lib/lindat/public/img/flags/

Issues

Clone this wiki locally