{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

Translate

With this function you can use the ResourceBundle defined in your i-net Clear Reports configuration with "LanguageResource" which allows you to create multi language reports. Usually i-net Clear Reports will only replace the defined keys (in the language property files) inside text elements. With this function you're now able to translate strings inside formulas as well. If no ResourceBundle can be found for the requested language the default language of the system i-net Clear Reports is running on will be used. If no ResourceBundle can be found the original string passed to this function will be returned.

After translation, if an array is given, the placeholders in the translated string, if any, are replaced one by one by the strings in the array given. The placeholders need to be of the form "{0}", "{1}", that is, 0-based. If there are more placeholders than strings given, the extra placeholders will remain in the string. If there are more values than placeholders, the extra values are ignored.

Usage:

Translate( String )
Translate( String, String Array )

Parameters:

String This is the key of the translated text defined in the language properties files.
String Array (optional) These are the values to replace the placeholders in the string to be translated.

Returns:

String

Examples:

Example 1: Translate static string

  • The value "mypackage.MyLanguageResources" is defined for the property "LanguageResource" in the i-net Clear Reports configuration.
  • The files "MyLanguageResources.properties" (containing the key-value-pair "user_name=User name") and "MyLanguageResources_de.properties" (containing "user_name=Benutzername") has been created.
  • If these two files has been added to the classpath of i-net Clear Reports (using a jar file containing them is the best way) including the package path "mypackage", the formula Translate("user_name") would return "User name" for locale EN and "Benutzername" for locale DE.

Example 2: Translate string with parameter (placeholder)

  • The value "mypackage.MyLanguageResources" is defined for the property "LanguageResource" in the i-net Clear Reports configuration.
  • The files "MyLanguageResources.properties" (containing the key-value-pair "user_name=User name is {0}") and "MyLanguageResources_de.properties" (containing "user_name=Benutzername lautet {0}") has been created.
  • If these two files has been added to the classpath of i-net Clear Reports (using a jar file containing them is the best way) including the package path "mypackage", the formula array name := ['Smith'];

Translate("user_name", name); would return "User name is Smith" for locale EN and "Benutzername lautet Smith" for locale DE.

See Also:

i-net Clear Reports
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - Translate