Java Integration

Java SDK offers many methods and functions that can be used in the Controllers, Views and Models. The following sections will provide a detailed description for every function and its options.

Tml static utility functions

Tml static utility functions

All functions documented under this section have to be called under Tml class e.g. Tml.translate("Hello world").


Translation function available in controllers

translate(String label, String description)

translate(String label, String description, Map<String, Object> tokens)

translate(String label, Map<String, Object> tokens)

translate(String label, Map<String, Object> tokens, Map<String, Object> options)  
Name Type Required Description
label String true The label to translate
description String false Description of the label that acts as a hint to the translator as well as contextualizes the key to be unique for the description
tokens Map<String, Object> false If label uses data or decoration tokens, the token values will be provided using this parameter
options Map<String, Object> false Additional attributes


  • dry - set to no translate this label to current language, display it in original language


Function to switch context to another language

switchLanguage(Language language)  
Name Type Required Description
language Language true The language to which you need to swith


Function to get current language in Session



Function to init new source in Application

initSource(String key)

initSource(String key, String locale)  
Name Type Required Description
key String true The source key to get
locale String false The locale to translate


The function to get current source of current Session



The function to get Application of current Session



The function to start translation block with custom options

beginBlockWithOptions(Map<String, Object> options)  
Name Type Required Description
options Map<String, Object> true The map of options that must be set to block


The function to get options of block



The function to end translation block



The function to get specific option from the block

getBlockOption(String key)  
Name Type Required Description
key String true The key of option that need to be get