close

Filter

loading table of contents...

Studio Developer Manual / Version 2207

Table Of Contents

9.21.1.4 Defining and Localizing Validator Messages

CoreMedia Studio ships with predefined validator messages for the built-in validators. The messages are defined in property files, following the idiom described in Section 5.6, “Localization”. However, you might still want to add your own localized messages if you add custom validators or if you want to provide more specific message for individual properties.

To this end, you should start by adding a new set of _properties.ts files containing your localized messages. Make sure to add the base property file and an additional property file for each non-default language.

Augment the central validator property file with your own properties. The central property file is Validators_properties.ts, so that it can be updated as follows:

new CopyResourceBundleProperties({
  destination: resourceManager.getResourceBundle(null, Validators_properties),
  source: resourceManager.getResourceBundle(null, MyValidators_properties),
})

Example 9.109. Configuring validator messages


Now you can add localized message to the base property file and optionally to every language variant, using an appropriate translation.

There are three kinds of keys using the following schemes:

  1. Validator_<IssueCode>_text is used as the generic message for the respective issue code.

  2. PropertyValidator_<PropertyName>_<IssueCode>_text is used when the issue code appears for a property of a specific name.

  3. ContentValidator_<ContentType>_<PropertyName>_<IssueCode>_text is used when the issue code appears for a property of a specific name for a document with the given content type or any subtypes thereof. A localized message for a more specific content type takes precedence.

Generally, more specific settings take precedence over more general settings. For example ContentValidator_* keys take precedence over Validator_* keys, if applicable.

Each localized message may contain the substitution tokens {0}, {1}, and so on. Before being displayed, these tokens are replaced by the corresponding issue argument (counting from 0).

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.