Display localized optionValues instead of enum in Handlebars

Discussions

Ask a Question
Back to All

Display localized optionValues instead of enum in Handlebars

Sorry for being a bit tiresome atm (I am trying to learn...), but here is my next question:

I have the following lines in my schema.json to define a field (Category):

"Category": {
   "type": "string",
   "enum": [ "Telephone", "Fax", "Mobile" ],
   "title": "Category"
},

options.json:

"Category": {
   "type": "select",
   "optionLabels": [ "Telephone", "Fax", "Mobile" ],
   "title": "Category"
},

options.de-AT.json:

"Category": {
   "type": "select",
   "optionLabels": [ "Telefon", "Fax", "Mobiltelefon" ],
   "title": "Kategorie"
},

template.hbs:

<p>{{Category}}</p>

When editing the items, everything works fine, except the labels in the edit form are not localized ("Category" instead of "Kategorie") - the values in the dropdown list are in the correct language.

In the view, the values are displayed in English ("Telephone" instead of "Telefon").

How can I display the localized strings in the view? And how can I display the labels in the correct language?