Products Downloads


French version


 

This function returns a localized text 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. The file encoding must correspond to the encoding passed as a function parameter.


In a ".properties" file, each line contains the text/key pair following the key = text syntax.


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. "templateName_language code_country or region code _variant.properties" file search,
  2. "templateName_language code _country or region code.properties" file search,
  3. "templateName_language code.properties" file search,
  4. "templateName.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 corresponding to the current template name,
  2. If the key is not found in this file, we perform another search in the file with the name corresponding to the main template name. Note that the ".properties" file encoding of the main template must be the same as the one passed as a function parameter.

Configurable texts can also be entered. 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.


Examples of configurable texts:

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

Stringencoding".properties" file encoding. This must be supported by the JDK used.Mandatory

String / Number / Boolean / Date

params…

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

Optional



Example

 ${ hardisCore.encodedMessage("title", "windows-1254") } <#assign label = hardisCore.encodedMessage("designation", "UTF-8", "123, "FRANCE")/>

↑ Top of page