I18nSupport

From DSpace Wiki

Jump to: navigation, search

Contents

[edit] 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.

[edit] 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:

svn co https://dspace.svn.sourceforge.net/svnroot/dspace language-packs 

The language-packs are also available in the download section at SourceForge

Other language related files, like help pages, input forms, email templates and so on are still kept here.

If you supply new translations, make sure, 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 with tools like the Ecliplse Resource Bundle Editor if omitted.

Here is a list of new tags from DSpace 1.4.2 to DSpace 1.5 NewTags142To15.txt so you might easily update an existing translation.

[edit] 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
Catalan ca 1.5 xml borillo AT uji.es
Spanish

[edit] 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
Catalan ca x x X
Chinese CN zh_cn X
Chinese TW zh_tw X
Czech cs X X
French fr X X X
Galician gl X X
German de X X X X X
Greek el X X
Hungarian hu X
Indonesian id X
Italian it X X X
Japanese ja X X X
Norwegian no X X X
Polish pl X X X
Portuguese pt X X
Portuguese BR pt_BR X X
Portuguese PT pt_PT X
Russian ru X X X
Spanish es X X
Swedish sv X X
Thai th X
Ukrainian uk X
Welsh cy X X X

[edit] Available translations of messages.xml for XML-UI

Language Locale 1.5
German de x

[edit] Parts of localizations not yet managed at Sourceforge SVN

[edit] Messages.properties not corresponding to a valid Locale

Language (code) Provided by Status Files Comments
Simplified Chinese (chs) JiehHsiang open to review and extention! Messages_chs.properties Based on v1.3.1 of Messages.properties
Traditional Chinese (cht) JiehHsiang open to review and extention! Messages_cht.properties Based on v1.3.1 of Messages.properties

[edit] Other parts of DSpace which can be translated

File French German Italian Russian
all available files French.zip German.zip Italian.zip Russian.zip
dspace/config/emails/change_password change_password_fr change_password_de change_password_ru
dspace/config/emails/feedback feedback_fr feedback_de feedback_ru
dspace/config/emails/internal_error internal_error_de internal_error_ru
dspace/config/emails/registerregister_fr register_de register_ru
dspace/config/emails/registration_notify registration_notify_de
dspace/config/emails/submit_archive submit_archive_fr submit_archive_de submit_archive_ru
dspace/config/emails/submit_reject submit_reject_fr submit_reject_de submit_reject_ru
dspace/config/emails/submit_task submit_task_fr submit_task_de submit_task_ru
dspace/config/emails/subscriptionsubscription_fr subscription_de subscription_ru
dspace/config/emails/suggest suggest_fr suggest_de suggest_ru
dspace/config/input-forms.xml input-forms_de.xml
dspace/config/default.license default_de.license
dspace/config/news-side.html news-side_de.html
dspace/config/news-top.html news-top_de.html
dspace-jspui/src/main/webapp/help/collection-admin.html collection-admin_de.html collection-admin_it.html
dspace-jspui/src/main/webapp/help/index.html index_de.html index_it.html
dspace-jspui/src/main/webapp/help/site-admin.thml site-admin_de.html site-admin_it.html

[edit] Misc resources not part of DSpace

Language (code) Provided by Content Files Comments
Russian (ru) Andrew Barhatov State rubricator of scientific and technical information grnti.zip

[edit] Basic Technical Considerations

The Java Standard Tag Library v1.0 is used.

[edit] 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 appropriate config/Messages_xx.properties file. This must be done at build-time, because it is placed in the dspace.war.

[edit] Example: Basic key use

Old JSP 
<h1>Search Results</h1>
New JSP 
<h1><fmt:message key="jsp.search.results.title" /></h1>
Messages.properties 
jsp.search.results.title = Search Results

[edit] 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 
<p>Results <%= r.getFirst() %> to <%= r.getLast() %> of <%= r.getTotal() %></p>
New JSP 
<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 
<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=""/>)

[edit] 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.

[edit] 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.)
  • 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.

[edit] Useful Tools

[edit] Perl Skript 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. 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.

[edit] 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..."

[edit] 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.

  • multi_patch.txt This is the patch for JSP files, that has been included with 1.3a
  • multi_patch_src.txt This is the patch for source code, that enables more I18N features
  • tld_diff.txt This is the patch for the dspace-tags.tld, needed for multilingual item viewing
  • Messages.properties Original University of Patras Messages.properties (en)
  • months_en.java List resource bundle to be included under dspace src directory
  • README.txt A very basic readme
Personal tools