Interface TranslationService

All Superinterfaces:
Service

public interface TranslationService extends Service
Provides methods to retrieve translated Messages in a Messagegroup and to replace Message tokens with values. Learn more about translating messages in the Developer Portal.
  • Method Details

    • newTranslationsReadRequestBuilder

      TranslationsReadRequestBuilder newTranslationsReadRequestBuilder()
      Creates a new instance of TranslationsReadRequestBuilder.
      Returns:
      a new instance of TranslationsReadRequestBuilder
    • readTranslations

      Read the Messages in the given Messagegroup and language.
      Parameters:
      request - not null, specify the Messages to read
      Returns:
      TranslationsReadResponse containing Messages in the given language, never null
      Throws:
      IllegalArgumentException - if request is null
    • formatTranslation

      String formatTranslation(String messageTemplate, Map<String,String> params)
      Replaces Message tokens with values. If the Message template is null or empty, returned as is. If the params map does not contain a token in the Message template, the token remains intact. The token is in the format of ${token_name}, where "token_name" is a string starting with a letter and followed by zero or more letters and underscores.
      Parameters:
      messageTemplate - string with optional tokens in the format of ${token_name}. For example, "Weight cannot exceed ${weight_limit} kgs."
      params - not null or empty, values of tokens in the Message template if the Message has tokens. The map is keyed by the token name
      Returns:
      the Message with tokens replaced