Versions Compared

Key

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

...

On top of this, in the next case of Dynamic keys, msgctxt is currently being used to have the actual English source text.

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:

  • search.filters.filter.author.head
  • search.filters.filter.dateissued.head
  • ...

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:

Code Block
languagexml
<h5 class="d-inline-block mb-0">{{'search.filters.filter.' + filter.name + '.head'| translate}}</h5>

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:

Code Block
languagebash
#: .search.filters.filter.author.head
msgctxt "Author"
msgid "search.filters.filter.author.head"
msgstr "Auteur"

Notice how here, the msgctxt directive is used to share with the translator what the original message in English is, because msgid needs to hold the key in order for the translation to work.

The Angular DSpace 7 message catalog (dspace.pot)

...