Prior to DSpace 7, the DSpace XML and JSP User interfaces had different catalogs of interface messages. Unified on a single user interface, the DSpace community is transitioning to a widely adopted web standard for the translation of interface messages.
The DSpace community is actively seeking contributors to aid in the translation of DSpace interface messages, to ensure that DSpace 7 can benefit from the most extensive localization support in the history of the project.
Contributing to translations requires a Github and a DuraSpace wiki account. Head over to www.github.com to create a free Github account.
Accounts for the DuraSpace wiki are free as well and can be requested in an email to firstname.lastname@example.org, indicating that you wish to contribute to DSpace 7 Translations.
Make yourself familiar with the new .pot catalog of DSpace messages, as well the .po file format with the translations for the catalog.
- 2019-05-20 DRAFT dspace.pot => TODO UPDATE LINK ONCE PR MERGED !!!!!!!!
- In this catalog, all msgstr entries are empty. This is because the catalog is the authoritative place for the original keys, not for any translations.
- 2019-05-20 DRAFT en.po or the older DRAFT de.po => TODO UPDATE LINK ONCE PR MERGED !!!!!!!!
- Both the msgids and the msgstr entries are in English in en.po.
- The msgids are in English, and the msgstr are in German in de.po
- Purely as comment, the old intermediate keys are still referenced in comments
Explore tools that can help you with the management of .pot and .po files. https://poedit.net/ is one widely used desktop application.
2019-05-20 State of development
As part of preview release 1, the developers are still using en.json catalogs. Once Pull Request 366 is accepted, the migration to the new .POT and .PO standard files will be official.
As long as DSpace 7 is still in development, it is expected that the dspace.pot catalog, as well as the different translations, will continue to be extended and evolved.
Together, we aim to release as many, as complete translations as possible, as part of the official DSpace 7.0 release.
Please list your name, email address alongside any of the languages to which you wish to contribute. Also feel free to join the channel #translation on the DuraSpace Slack for assistance and discussion around DSpace 7 translations.
Bram Luyten - email@example.com
Claudia Jürgen - firstname.lastname@example.org - German (de.po)
Translation files (.po)
Comments - #
All lines in the translation files that start with # are comments, either aimed at helping developers or helping translators.
#: at the start of a line is a source reference, aimed at making it clear where in the source code this message IS or WAS used. Because the original po files were migrated from another, json based format, the old JSON keys have been added as source references, to make it clear where the message originally came from in the previous format.
Normal key / msgid examples
For most keys that need to be translated, the English original is part of the DSpace Angular source code. This original is then used as the msgid.
As a translator, you add the translation into the msgstr variable.
As demonstrated in the example below, you are required to wrap your translation in double quotes.
Following multi-line example shows that both the original key, as well as the translation, can be split over multiple lines.
Because double quote is the special character that starts or ends a message, you need to prefix double quotes with \ if you want them to appear in the actual message.
Likewise, as the previous just explained that \ can be used to escape characters, you also need to escape \ itself if you want it to appear in the message.
Dynamic key example
In parts of the DSpace Angular code, a list of very similar objects is being built and displayed in the user interface, for example, the search filters.
These similar objects all need different labels in the user interface:
Contrary to the normal keys that are discussed higher on this page, they keys are dynamically built in the code, meaning that the developer has no opportunity to put the English string into the code, unless he or she would hard-code a static list of those similar objects. If this sounds too abstract, look at the snippet of angular component code that puts these search filters in the page:
So to deal with these kinds of occurences, we are currently still using the (old) en.json key entries for those type of messages, in the en.po file, for example:
Notice how here, that the English translation is also added into the comments, because msgid needs to hold the key in order for the translation to work.
The Angular DSpace 7 message catalog (dspace.pot)
The format of the dspace.pot catalog file, is very similar to the format of the translations.
The main difference is that this file does not contain actual translated strings (msgstr), because it serves as the authoritative catalog of the source messages, without translations.
In Angular files (.html, .ts, ...) you need to escape
- Single quotes (') with \
- Double curly braces
In .po/.pot files you need to escape
- Double quotes (") with \
Locating keys that have not been replaced
If you execute following command in the angular source directory, you get a list of keys that have not yet been replaced.
Sample output looks like:
Message Context - msgctxt
Apart from comments, starting with #, the msgid lines representing the key, and the msgstr lines, representing the translations, an entry can also contain a msgctxt line.
Originally, in linux gettext, they are being used to disambiguate messages. Let's say you have two different places in the application where you are using "Person" in English, you sometimes need the ability to give both of these occurences a different translation in another language.
This is why uniqueness is actually not enforced on the uniqueness of the msgid, but on the uniqueness of the combination between msgid, and another directive, msgctxt.
Here's an example, outside of DSpace, showing that "Normal" requires different grammar in another language, depending on the context in which it is used.
At the time of writing, 2019-06-01, the NGX-Translate implementation of the support of po files that DSpace is relying on, actually prevails the translations from being rendered correctly if a msgctxt is also part of the entry. This means that right now, we can only have a single translation for a single string. This is also why the catalog and the en.po translation file don't contain msgctxt entries.