system.i18n.translate
This function is used in Python Scripting.
Description​
Translates a list of terms in bulk using the Translation Manager. To translate a single term, see system.util.translate.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
tip
This function accepts keyword arguments.
system.i18n.translate(terms, [locale], [strict])
Parameters​
| Type | Parameter | Description |
|---|---|---|
| List | terms | The terms to translate. |
| Locale or String | locale | The locale to translate the terms to, such as "it" or "en-IE". Accepts a Java Locale object, a BCP-47 language tag, or a Java locale identifier. If omitted, the function attempts to use the default locale of the current context, such as the Perspective Session or the Gateway. [optional] |
| Boolean | strict | If True, a term without a defined translation returns None. If False, the original term is returned. [optional] |
Returns​
List - The translated terms.
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Code Snippet
# Translate several terms to Italian in a single call.
terms = ["Hello", "Goodbye", "Tank"]
translations = system.i18n.translate(terms, locale="it")
print translations
Code Snippet - Strict Mode
# With strict=True, any term without an Italian translation is returned as None.
translations = system.i18n.translate(["Hello", "Untranslated Term"], strict=True, locale="it")
print translations