Table of Contents | ||||
---|---|---|---|---|
|
Current Status of Internationalization
The University of Patras in Greece have done the initial hard work of separating out text from the JSPs into a dictionary file and linking to it. MARTON Jozsef has build on this by parameterising the UI text.
Since revision 1951 of SVN the i18n multilingualism patch is part of DSpace code base. This enables the DSpace instance to support more than one language.
Language packs now stored and managed in SVN
The language packs (messages files) contributed by the community are available at Sourceforge. The dspace project including the latest language-packs can be checked out through SVN with the following instruction set:
Code Block |
---|
svn co https://dspace.svn.sourceforge.net/svnroot/dspace language-packs |
The language-packs are also available in the download section at SourceForge
Language packs stored and managed in Github
The language packs (messages files) contributed by the community are available on github. They are managed outside of the core DSpace project to allow more regular updates and releases.
Aside from the message catalogs included in these projects, there is a number of other files that can be localized. These include help pages, input forms and email templates. They are currently kept here until they are moved into the message catalogs in the future.
Contributing new Localizations
Thank you!
Please see our general advice on contributing to DSpaceOther language related files, like help pages, input forms, email templates and so on are still kept here.
If you supply new translations, please make sure , that they correspond to a stable release of DSpace and do not contain English tags nor references to your DSpace instance (e.g. name of your Institution). In partially translated Messages_xx.properties, just omit the untranslated tags. Messages.properties will be used as a fallback anyway and untranslated tags are easiear detectable easier to detect with tools like the Ecliplse Eclipse Resource Bundle Editor if omitted.Here is a list of new tags from DSpace
Available translations of Messages.properties for JSP-UI
Language | Locale | initial | 1.3.1 | 1.3.2 | 1.4 | 1.4.1 | 1.4.2 |
---|
...
1.5 |
---|
...
1.5.1 | 1.5.2 | 1.6.0 | 1.6.1 | 1.6.2 | 1.7.0 | 1.7.1 | 1.8.0 | 1.8.1 | 1.8.2 | 3.0 | 3.1 | 3.2 | 4.0 | 4.1 | 4.2 | 5.0 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Basque | eu |
|
|
|
|
|
|
|
| X |
|
|
|
|
|
|
| ||||||||
Bulgarian | bg |
|
|
|
|
|
|
|
|
| X |
| X | X |
| X | X | ||||||||
Catalan | ca |
| x | x |
| X |
|
|
|
|
|
|
|
|
|
| |||||||||
Chinese CN | zh_cn | X |
|
|
|
|
Translation work in progress
If you are in the progress of translating or upgrading existing translations, please communicate your efforts here and in the dspace lists to avoid redundant work and get feedback on your translations. The more hands join in the tedious work of translation the better.
Language | Locale | Version | UI | contact | translation to review | |
---|---|---|---|---|---|---|
Arabic | ar | 1.4.1 | jsp |
| ||
Basque | eu | 1.6.1 | xml | Public University of Navarre |
| |
French | fr | 1.5 | xml | University of Montreal |
| |
Persian | fa_IR | 1.5 | jsp |
|
| |
Polish | pl | 1.6 | xml | University of Silesia | galuszkak( at )gmail.com |
|
Italian | it | 1.5 | xml | valerio.minetti AT gmail.com | ||
Serbian | sb_RS | 1.6 | xml, jsp | Bojan Suzij - National Library for the Blind |
| |
Spanish | es | 1.5 | jsp | gustavo perosillo | ||
Spanish | es | 1.5.1 | jsp | Guillermo Varela | ||
Thai | th | 1.5.2 | jsp | KIDS-D Project, Asian Institute of Technology |
| |
Thai | th | 1.5.2 | xml | KIDS-D Project, Asian Institute of Technology |
|
Available translations of Messages.properties for JSP-UI
Language | Locale | initial | 1.3.1 | 1.3.2 | 1.4 | 1.4.1 | 1.4.2 | 1.5 | 1.5.1 | 1.5.2 | 1.6.0 | 1.6.1 | 1.6.2 | 1.7.0 | 1.7.1 | 1.8.0 | 1.8.1 | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Basque | eu |
|
|
|
|
|
|
|
| X |
|
|
| Bulgarian | bg
|
| ||||||||||||||||||||||
Chinese TW | zh_tw | X |
| X |
| X | X |
| X | X | Catalan | ca |
| x | x |
| X |
|
|
|
|
|
|
|
|
| Chinese CN | zh_cn X | ||||||||||
Czech | cs | X |
|
|
|
|
| Chinese TW | X | ToDo zh_tw | X | X | X |
| X |
|
|
| ||||||||||||||||||||
Czech French | cs fr | X |
| X |
| X |
|
| X | X X |
| X |
| X |
|
| French | fr | X | X | X | |||||||||||||||||
ToDo Galician | gl | X |
|
|
|
| X |
| Galician ToDo | gl | X |
|
|
|
| X |
| |||||||||||||||||||||
German | de | X |
|
| X | X | X | X | X | X | X | X | X | X | X | X | X Greek | el | X | X | ||||||||||||||||||
Greek | el | X |
|
| X |
|
|
|
|
| Hungarian | hu | X |
|
|
|
|
|
|
| ||||||||||||||||||
Indonesian Hungarian | id hu | X |
|
|
|
|
|
|
|
|
|
|
|
|
|
| Italian | it | X | X | X | |||||||||||||||||
Indonesian | id | X |
|
| X |
|
|
|
|
|
|
| Japanese | ja | X |
| X X | X | ||||||||||||||||||||
Italian | it | X |
| X | X |
|
|
| Norwegian | no | X |
| X |
|
| X |
| |||||||||||||||||||||
Polish Japanese | pl ja | X |
| X | X |
|
|
| X |
|
|
|
| X |
|
|
| Portuguese | pt | |||||||||||||||||||
Norwegian | no | X |
| X |
| X | X |
|
|
|
|
|
|
|
| Portuguese PT | pt_PT | X |
| X | X | X | X | |||||||||||||||
Polish | pl | Portuguese BR | X | pt_BR | X | X |
|
|
| X |
|
|
|
|
|
|
|
| Russian | ru | X | X | X | |||||||||||||||
Portuguese | pt |
|
|
|
|
|
| Spanish X | es X X |
|
|
|
| X |
|
| X | |||||||||||||||||||||
Portuguese PT | pt_PT | Swedish | sv | X |
|
| X |
|
| X | X | X |
|
|
|
|
|
|
| Thai | th X | |||||||||||||||||
Portuguese BR | pt_BR | X |
| X |
|
|
| X |
|
|
|
|
|
|
|
|
| Ukrainian | uk ||||||||||||||||||||
Russian | ru | X |
| X | X |
|
|
|
|
|
| x |
|
|
|
| Welsh | cy | ||||||||||||||||||||
Spanish | es | X |
|
|
| X X |
|
| X |
|
|
|
|
|
|
|
|
Available translations of messages.xml for XML-UI
Swedish | sv | X |
|
| X |
|
| X | X |
|
|
|
|
|
|
|
| ||||||||||||||||
Language | Locale | 1.5 | 1.5.1 | 1.5.2 | 1.6.0 | 1.6.1 | 1.6.2 | 1.7.0 | 1.7.1 | 1.8.0 | 1.8.1 | ||||||||||||||||||||||
German | de | x | x | x | x | x | x | x | x | x | x | ||||||||||||||||||||||
Greek | el |
| x | ||||||||||||||||||||||||||||||
Catalan Thai | ca th | x x |
|
|
|
| X |
| X |
|
|
|
| Catalan (Central) |
| ca_ES |
| x | |||||||||||||||
Ukrainian | uk Czech | cs |
|
| x x | X | x |
| x ToDo x |
| x |
| Italian | it |
| x | x | ||||||||||||||||
Japanese Welsh | ja cy |
| x |
|
| X | X | x X x | X |
|
| Portuguese | pt_BR | x |
|
| x |
|
| Spanish | es | x | x | x | x |
Parts of localizations not yet managed at Sourceforge SVN
Messages.properties not corresponding to a valid Locale
Language (code) | Provided by | Status | Files | Comments |
---|---|---|---|---|
Simplified Chinese (chs) | JiehHsiang | open to review and extention | Based on v1.3.1 of Messages.properties | |
Traditional Chinese (cht) | JiehHsiang | open to review and extention | Based on v1.3.1 of Messages.properties |
Other parts of DSpace which can be translated
DSpace 1.6.0
DSpace 1.5.2
DSpace 1.5.1
DSpace 1.4.2
File | French | German | Italian | Russian |
---|---|---|---|---|
all available files | ||||
|
| |||
|
| |||
|
|
| ||
|
| |||
|
|
|
| |
|
| |||
|
| |||
|
| |||
|
|
| ||
|
| |||
|
|
|
| |
|
|
|
| |
|
|
|
| |
|
|
|
| |
|
|
| ||
|
|
| ||
|
|
|
Misc resources not part of DSpace
Language (code) | Provided by | Content | Files | Comments |
---|---|---|---|---|
Russian (ru) | Andrew Barhatov | State rubricator of scientific and technical information |
|
Basic Technical Considerations
The Java Standard Tag Library v1.0 is used.
The Use of Tags and Message Keys
Basic steps for using Tags in a JSP:
- include the Standard Tag Library in the JSP -
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
- define the key you want in
config/Messages.properties
- use the key instead of the text in the JSP, see examples below
The messages may can now be changed in the appropriateconfig/Messages_xx.properties
file. This must be done at build-time, because it is placed in the dspace.war.Example: Basic key use
- Old JSP
Code Block <h1>Search Results</h1>
- New JSP
Code Block <h1><fmt:message key="jsp.search.results.title" /></h1>
- Messages.properties
Code Block jsp.search.results.title = Search Results
Example: Use of parameters
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.
- Old JSP
Code Block <p>Results <%= r.getFirst() %> to <%= r.getLast() %> of <%= r.getTotal() %></p>
- New JSP
Code Block <fmt:message key="jsp.search.results.text"> <fmt:param><%= r.getFirst() %></fmt:param> <fmt:param><%= r.getLast() %></fmt:param> <fmt:param><%= r.getTotal() %></fmt:param> </fmt:message>
- Messages.properties
(Note: JSTL 1.0 does not seem to allow JSPCode Block <p>jsp.search.results.text = Results \{0\}-\{1\} of \{2\}</p>
<%= %>
expressions to be passed in as values of attribute in<fmt:param value=""/>
)
To Do
- In the servlet code:
- In `AuthorizeAdminServlet`, some English is passed for direct display in the title through the attribute `edit_title`. E.g. "Item".
- `config/dstat.map`
- Support for easy customisation of UI without needing to fork language bundles.
- Display dates, numbers etc. according to Locale. (JSTL has tags for this)
- Searching in non-Western languages such as Chinese; Lucene cannot parse/separate words
- Multi-lingual metadata. Submission forms do not include language info for metadata. (The "language" DC field relates to the language of the content, i.e. the bitstreams.)
- HPCLab, University of Patras, has submitted a new patch addressing this issue, against 1.4.2 (including the I18N patch) here. Please test and verify in order to remove from to-do.
- Author and title ordering.
- Browse controls ("Jump to" 0-9, A-Z) – support for other characters
- Use of Collator fixes non-English language sort order problems. Not developed but small. No schema changes. JimDowning
- i18n of non-Web UI – e.g. command line tools like the import/export tools. Currently the dictionaries are only stored in the .war file, so other parts of code won't have access to them.
Useful Tools
Perl Script for unused keys
Here's a useful Perl script that finds all of the dictionary keys in the JSPs and the `Messages.properties` file, and prints out keys that are used in the JSPs but aren't in the dictionary, and vice versa. Missing File: Find-unused-keys.pl Note: slightly out of date, can't detect message keys used in e.g. LocaleSupport.getLocalizedMessage()
You'll need to change the variables at the top of the file to point to your DSpace source dir.
Eclipse Resource Bundle Editor
The Eclipse Resource Bundle Editor is a usefull tool to create and manage Messages.properties files. It is an "Eclipse plugin for editing Java resource bundles. Lets you manage all localized properties files in one screen. Some features: sorted keys, warning icons on missing keys/values, conversion to/from Unicode, hierarchical view of keys, more..."
Original University of Patras I18N set of patches
In case these may be useful to someone, here is the original set of patches that enable I18N support developed at the High Performance Information Systems Laboratory (HPCLab), University of Patras. Please keep in mind that these patches have been tested and work only with DSpace 1.2 version.
...
Available translations of messages.xml for XML-UI
Language | Locale | 1.5 | 1.5.1 | 1.5.2 | 1.6.0 | 1.6.1 | 1.6.2 | 1.7.0 | 1.7.1 | 1.8.0 | 1.8.1 | 1.8.2 | 3.0 | 3.1 | 3.2 | 4.0 | 4.1 | 4.2 | 5.0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
German | de | x | x | x | x | x | x | x | x | x | x | ||||||||
Greek | el |
| x |
|
|
|
|
|
|
|
| ||||||||
Catalan | ca | x | x |
|
|
|
|
|
| x |
| ||||||||
Catalan (Central) | ca_ES |
|
| x |
|
|
|
|
|
|
| ||||||||
Czech | cs |
|
| x | x | x |
| x | x | x |
| ||||||||
Italian | it | x |
| x |
|
|
|
|
|
|
| ||||||||
Japanese | ja |
| x |
|
|
|
| x | x |
|
| ||||||||
Portuguese | pt_BR |
| x |
|
|
| x | x | x | x | x | x | x | x | x | x | x | x | x |
Spanish | es | x | x |
|
|
|
| x | x | x | x | x | x | x | x | x | x | ||
Galician | gl | x |
Localized parts of DSpace not yet managed on Github
Messages.properties not corresponding to a valid Locale
Language (code) | Provided by | Status | Files | Comments |
---|---|---|---|---|
Simplified Chinese (chs) | JiehHsiang | open to review and extention | Based on v1.3.1 of Messages.properties | |
Traditional Chinese (cht) | JiehHsiang | open to review and extention | Based on v1.3.1 of Messages.properties |
Other parts of DSpace which can be translated
DSpace 1.6.0
DSpace 1.5.2
DSpace 1.5.1
DSpace 1.4.2
File | French | German | Italian | Russian |
---|---|---|---|---|
all available files | ||||
|
| |||
|
| |||
|
|
| ||
|
| |||
|
|
|
| |
|
| |||
|
| |||
|
| |||
|
|
| ||
|
| |||
|
|
|
| |
|
|
|
| |
|
|
|
| |
|
|
|
| |
|
|
| ||
|
|
| ||
|
|
|
Misc resources not part of DSpace
Language (code) | Provided by | Content | Files | Comments |
---|---|---|---|---|
Russian (ru) | Andrew Barhatov | State rubricator of scientific and technical information |
|
JSPUI Basic Technical Considerations
The Java Standard Tag Library v1.0 is used.
The Use of Tags and Message Keys
Basic steps for using Tags in a JSP:
- include the Standard Tag Library in the JSP -
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
- define the key you want in
config/Messages.properties
- use the key instead of the text in the JSP, see examples below
The messages may can now be changed in the appropriateconfig/Messages_xx.properties
file. This must be done at build-time, because it is placed in the dspace.war.Example: Basic key use
Old JSP
Code Block <h1>Search Results</h1>
New JSP
Code Block <h1><fmt:message key="jsp.search.results.title" /></h1>
Messages.properties
Code Block jsp.search.results.title = Search Results
Example: Use of parameters
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.
Old JSP
Code Block <p>Results <%= r.getFirst() %> to <%= r.getLast() %> of <%= r.getTotal() %></p>
New JSP
Code Block <fmt:message key="jsp.search.results.text"> <fmt:param><%= r.getFirst() %></fmt:param> <fmt:param><%= r.getLast() %></fmt:param> <fmt:param><%= r.getTotal() %></fmt:param> </fmt:message>
Messages.properties
Code Block <p>jsp.search.results.text = Results \{0\}-\{1\} of \{2\}</p>
(Note: JSTL 1.0 does not seem to allow JSP
<%= %>
expressions to be passed in as values of attribute in<fmt:param value=""/>
)
Configuring stop words for search
The list of stop words is configured in DSAnalyzer.java. Like any other change in the DSpace source code, you are required to rebuild DSpace after modifying the list of stop words.
To Do
- In the servlet code:
- In `AuthorizeAdminServlet`, some English is passed for direct display in the title through the attribute `edit_title`. E.g. "Item".
- `config/dstat.map`
- Support for easy customisation of UI without needing to fork language bundles.
- Display dates, numbers etc. according to Locale. (JSTL has tags for this)
- Searching in non-Western languages such as Chinese; Lucene cannot parse/separate words
- Multi-lingual metadata. Submission forms do not include language info for metadata. (The "language" DC field relates to the language of the content, i.e. the bitstreams.)
- HPCLab, University of Patras, has submitted a new patch addressing this issue, against 1.4.2 (including the I18N patch) here. Please test and verify in order to remove from to-do.
- Author and title ordering.
- Browse controls ("Jump to" 0-9, A-Z) – support for other characters
- Use of Collator fixes non-English language sort order problems. Not developed but small. No schema changes. JimDowning
- i18n of non-Web UI – e.g. command line tools like the import/export tools. Currently the dictionaries are only stored in the .war file, so other parts of code won't have access to them.
Useful Tools
Python script to check for missing/extra strings
Given the English original (messages.xml or Messages.properties) and the corresponding translation file, this script will report both strings missing in the translation file and extra strings that shouldn't be in the translation. Tested on Python 2.7, requires ElementTree (wrapper for libxml2) for checking XML and/or jprops for testing .properties.
Code Block | ||||
---|---|---|---|---|
| ||||
#!/usr/bin/env python
import sys
class MessagesXmlParser():
def __init__(self, filename):
import xml.etree.ElementTree as etree
self.keys = []
tree = etree.parse(filename)
root = tree.getroot()
for message in root:
self.keys.append(message.attrib['key'])
class MessagesPropertiesParser():
def __init__(self, filename):
try:
import jprops
except:
print('Error: jprops module for parsing .properties files is missing. Download and follow installation instructions from http://mgood.github.com/jprops/')
sys.exit(2)
self.keys = []
with open(filename) as fp:
for key, value in jprops.iter_properties(fp):
self.keys.append(key)
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage:")
print(" %s messages.xml messages_XX.xml" % (sys.argv[0]))
print("or")
print(" %s Messages.properties Messages_XX.properties" % (sys.argv[0]))
sys.exit(1)
testfile = open(sys.argv[1], 'rb')
if testfile.readline().find('<?xml') != -1:
# xml file detected, assume messages.xml
messages_tmpl = MessagesXmlParser(sys.argv[1])
messages_in = MessagesXmlParser(sys.argv[2])
else:
# assume Messages.properties
messages_tmpl = MessagesPropertiesParser(sys.argv[1])
messages_in = MessagesPropertiesParser(sys.argv[2])
print "Present in %s but missing in %s:" % (sys.argv[1], sys.argv[2])
for i in set(messages_tmpl.keys) - set(messages_in.keys):
print i
print "\nPresent in %s but missing in %s:" % (sys.argv[2], sys.argv[1])
for i in set(messages_in.keys) - set(messages_tmpl.keys):
print i
|
Newer version of the script which allows comparison and dumping in columnar TSV of several messages files simulatenously: dspace-i10n-check2.py. Usage example:
Code Block | ||||
---|---|---|---|---|
| ||||
./dspace-i10n-check2.py --compare file1 file2
./dspace-i10n-check2.py --dump file1
./dspace-i10n-check2.py --dump-tsv-for-translation /dspace/webapps/xmlui/i18n/messages.xml /dspace/webapps/xmlui/i18n/messages_es.xml /dspace/webapps/xmlui/i18n/messages_it.xml
|
Python script to prepare a list of untranslated XMLUI strings when updating and older translation
A python script to generate a messages_xx.xml file by merging existing translations from an older committed translation to the latest messages.xml file. Thus, you get a file with the latest keys, where you only need to look for the untranslated strings.
https://github.com/evelthon/dspace-xmlui-lang-util
PHP script to check for missing/extra strings
Given the English original (messages.xml and the corresponding translation file, this script will report both strings missing in the translation file and extra strings that shouldn't be in the translation.
Code Block | ||||
---|---|---|---|---|
| ||||
<?php
if ($argc != 3) {
echo "Usage: checkkeys.php <master> <tocheck>\n";
exit(1);
}
$masterKeys = getKeys($argv[1]);
$toCheckKeys = getKeys($argv[2]);
print "IN $argv[1] BUT NOT IN $argv[2]:\n\n";
printMissing($masterKeys, $toCheckKeys);
print "\n\n\nIN $argv[2] BUT NOT IN $argv[1]:\n\n";
printMissing($toCheckKeys, $masterKeys);
function printMissing($reference, $test)
{
foreach ($test as $value) {
if (! in_array($value, $reference)) {
echo "$value \n";
}
}
}
function readFileMessage($path)
{
if (! $fileContent = @file($path)) {
echo "Can't open $path \n";
exit(1);
}
return $fileContent;
}
function getKeys($path)
{
$fileContent = readFileMessage($path);
return readKeys($fileContent);
}
function readKeys($file)
{
$keys = [];
foreach ($file as $key => $line) {
if (strpos($line, '<message key="') === false) {
continue;
}
$key = getKey($line);
$keys[] = $key;
}
return $keys;
}
function getKey($line)
{
$line = trim($line);
$line = substr($line, 14);
$charEnd = strpos($line, '">');
$key = substr($line, 0, $charEnd - strlen($line));
return $key;
} |
Code Block | ||||
---|---|---|---|---|
| ||||
php ./checkkeys.php file1 file2
php ./checkkeys.php /dspace/webapps/xmlui/i18n/messages.xml /dspace/webapps/xmlui/i18n/messages_es.xml /dspace/webapps/xmlui/i18n/messages_it.xml
|
Perl script for unused keys
Here's a useful Perl script that finds all of the dictionary keys in the JSPs and the `Messages.properties` file, and prints out keys that are used in the JSPs but aren't in the dictionary, and vice versa. Missing File: Find-unused-keys.pl Note: slightly out of date, can't detect message keys used in e.g. LocaleSupport.getLocalizedMessage()
You'll need to change the variables at the top of the file to point to your DSpace source dir.
Eclipse Resource Bundle Editor
The Eclipse Resource Bundle Editor is a usefull tool to create and manage Messages.properties files. It is an "Eclipse plugin for editing Java resource bundles. Lets you manage all localized properties files in one screen. Some features: sorted keys, warning icons on missing keys/values, conversion to/from Unicode, hierarchical view of keys, more..."
Contributors
The University of Patras in Greece have done the initial hard work of separating out text from the JSPs into a dictionary file and linking to it. MARTON Jozsef has build on this by parameterising the UI text.
...