Package com.veeva.vault.sdk.api.i18n
Interface TranslationService
- All Superinterfaces:
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 Summary
Modifier and TypeMethodDescriptionformatTranslation
(String messageTemplate, Map<String, String> params) Replaces Message tokens with values.Creates a new instance ofTranslationsReadRequestBuilder
.readTranslations
(TranslationsReadRequest request) Read the Messages in the givenMessagegroup
and language.
-
Method Details
-
newTranslationsReadRequestBuilder
TranslationsReadRequestBuilder newTranslationsReadRequestBuilder()Creates a new instance ofTranslationsReadRequestBuilder
.- Returns:
- a new instance of
TranslationsReadRequestBuilder
-
readTranslations
Read the Messages in the givenMessagegroup
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
Replaces Message tokens with values. If the Message template is null or empty, returned as is. If theparams
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
-