Products Downloads


French version


 

 

This function returns a text which is located according to an alphanumeric key and the template execution locale.

 

The texts must be stored in a ".properties" file. The file name must correspond to a template name.

 

In a ".properties" file, each line contains the text/key pair by following the syntax key = text. A ".properties" file must be encoded in ISO-8859-1 (Latin 1). The Unicode characters contained in the text must be entered in escape form (\uHHHH).

 

A ".properties" file needs to be created for each execution locale supported by the template. The file name must satisfy the following syntax: "nameTemplate_language code_country or region code_variant.properties".

 

According to a locale value, the file search is performed as follows:

  1. "nameTemplate_language code_country or region code _variant.properties" file search,
  2. "nameTemplate_language code _country or region code.properties" file search,
  3. "nameTemplate_language code.properties" file search,
  4. "nameTemplate.properties" file search.

 

If the message function is called from a template which is not the main template (imported or included template), the search is performed as follows:

  1. Search for the ".properties" file (according to the locale) with the name that corresponds to the current template name,
  2. If the key is not found in this file, we search the file with the name that corresponds to the main template name.

 

It is also possible to enter configurable texts. Each parameter is identified in the text by the syntax {N} or N corresponding to the parameter sequence number (N starts at 0) when calling the message. The parameters must be String, Number, Boolean or Date type.

 

Example of configurable text:

myTemplate_en.properties file

welcomePhrase=Welcome dear {0} {1}!

Template myTemplate.ftlx executed with the English (en) locale

${message(welcomePhrase, customerName, customerLastName) }

 


Parameters

String

msgKey

Unique key associated with the text to return

Mandatory

String/Number/Boolean/Date

params?

List of parameters (one or more) which will be inserted into the text to return

Optional

 


For example

${ hardisCore.message("title") }
<#assign label = hardisCore.message("designation", 123, "FRANCE")/>

↑ Top of page