Translations Java API (Available to Groovy)
You retrieve existing translations from the Max platform by using the com.intalio.core.translation.TranslationFactory Java API.
Methods
Retrieve Translated Message for Specified Full Identifier and Language
Arguments are optional, and if specified, are used to replace translation placeholders.
public static String getByFullIdentifierAndLanguage(String fullIdentifier, String language, String... parameters)
Retrieve Translated Message for Specified Key
The authenticated user’s language is used. Optional arguments are supported.
public static String getByFullIdentifier(String fullIdentifier, String... parameters)
Retrieve Translations Associated With Metadata
Gets the translated field for a specified record of an object. Required parameters are the object’s full identifier, the record’s UUID, and the field’s full identifier. Language is optional, and if not specified, the authenticated user’s language is used.
public static String getTranslatedMetadata(String objectFullIdentifier, UUID recordUUID, String fieldFullIdentifier)
Examples
To work with the examples in this section, import the following Java class.
import com.intalio.core.translation.TranslationFactory
Return “Page not found for path abc/def” if Authenticated User’s Language is English
TranslationFactory.getByFullIdentifier("io_page_not_found_for_path", "abc/def")
Return “Page non trouvée pour le chemin abc/def” if Authenticated User’s Language is French
TranslationFactory.getByFullIdentifierAndLanguage("io_page_not_found_for_path", "fr", "abc/def")
Translate Name Field of Account Object to Authenticated User’s Language
TranslationFactory.getTranslatedMetadata("io_object", UUID.fromString("bf35c30e-c6e5-11e0-be1e-001ec93afa2c"), "io_name")
Translate Name Field of Account Object to French
TranslationFactory.getTranslatedMetadata("io_object", UUID.fromString("bf35c30e-c6e5-11e0-be1e-001ec93afa2c"), "io_name", "fr")
For more information: