TemplatePublicService
Name | TemplatePublicService |
Class Path |
|
Versions | 9 10 11 |
Overview
The TemplatePublicService
provides a service to process templates based on a given template code, locale, and variables. By using this service, implementers can dynamically generate content from IDHUB pre-defined templates.
Available Functions
processTemplate(String templateCode, String locale, Map<String,Object> variables)
Description
Processes a template identified by its code, applying a specific locale and substituting variables into the template.
Parameters
templateCode
(String): The unique identifier of the template to be processed.locale
(String): The locale (language and region) in which the template should be processed. It is expected to be in standard locale format (e.g., "en", "fr", "de").variables
(Map<String, Object>): A map containing key-value pairs that will be injected into the template.
Returns
(String): The processed template with the applied locale and variables.
(null): If the template does not exist or cannot be retrieved.
Notes
If the provided
templateCode
does not match an existing template, the function returnsnull
.The locale is converted into a
Locale
object before processing.Ensure that the
TemplateService
is correctly configured and contains the necessary templates.