Versions Compared

Key

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

...

Code Block
languagebash
titleEscaping of double quotes example
#: .submission.workflow.generic.delete-help
msgid ""
"If you would to discard this item, select \"Delete\".  You will then be "
"asked to confirm it."
msgstr ""
"If you would to discard this item, select \"Delete\".  You will then be "
"asked to confirm it."

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.

Code Block
languagebash
titleGeneral gettext / PO example of msgctxt
#: utils/katestyletreewidget.cpp:132
msgctxt "Text style"
msgid "Normal"
msgstr "običan"
⁠
#: utils/kateautoindent.cpp:78
msgctxt "Autoindent mode"
msgid "Normal"
msgstr "obično"

At the time of writing, 2019-06-01, the NGX-Translate implementation of the support of po files that DSpace is relying on, does not actually do anything with the msgctxt directives in the translation files. This means that right now, we can only have a single translation for a single string.


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. 

...

Code Block
languagebash
app/+community-page/delete-community-page/delete-community-page.component.html:5: <h2 id="header" class="border-bottom pb-2">{{ 'community.delete.head' | translate
app/+community-page/delete-community-page/delete-community-page.component.html:7: <p class="pb-2">{{ 'community.delete.text' | translate:{ dso: dso.name } }}</p>
app/+community-page/delete-community-page/delete-community-page.component.html:12: <button class="btn btn-primary" (click)="onCancel(dso)">{{'community.delete.cancel' | translate}}
app/+community-page/edit-community-page/edit-community-page.component.html:4: <h2 id="header" class="border-bottom pb-2">{{ 'community.edit.head' | translate }}</h2>


Future work

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.

Code Block
languagebash
titleGeneral gettext / PO example of msgctxt
#: utils/katestyletreewidget.cpp:132
msgctxt "Text style"
msgid "Normal"
msgstr "običan"
⁠
#: utils/kateautoindent.cpp:78
msgctxt "Autoindent mode"
msgid "Normal"
msgstr "obično"

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.