Zum Hauptinhalt springen

resolveLabel

resolveLabel(value, data?, language?): string

Resolves a label that is not known at build time - a value read from the database, from a JSON configuration or from a Documents attribute - and may therefore come in any of the three formats Documents itself accepts.

Parameters​

value​

string

A locale key (pf:some.key), an inline bilingual literal (de:Deutsch;en:English) or plain text

data?​

object

Optional data for {{placeholder}} substitution, applied to all three formats

language?​

string

Optional locale (like de); if omitted, the current user's portal language is used

Returns​

string

The resolved string, or an empty string if value is empty

Example​

resolveLabel("pf:filetype.ptpInvoice.label"); // -> "Rechnung"
resolveLabel("de:Rechnung;en:Invoice"); // -> "Rechnung"
resolveLabel(statusCode.successLabel); // -> whatever the customer stored