Before values are substituted, parameters of primitive types are automatically converted to strings.
For complex types, including those built into the TS SDK, you must manually convert them to a primitive type.
Before values are substituted, parameters of primitive types are automatically converted to strings.
For complex types, including those built into the TS SDK, you must manually convert them to a primitive type.
Object to work with translations
Used for the localization of strings.
Hierarchy
Methods
T
The method returns the string translation based on the provided locale.
// Get company's locale const lang = await System.company. getLanguage(); const locale = lang.code; // Translate string const res = SR.T('hello', locale);Parameters
str: string
Returns string
Translation of the string.
The method returns the string translation based on the provided locale.
// Get company's locale const lang = await System.company. getLanguage(); const locale = lang.code; // Translate string const res = SR.T('hello', locale);Parameters
str: string
locale: string
Returns Promise<string>
Translation of the string.
TF
Returns a function for translating a template string with parameter values inserted into it.
The specified locale is used for translation. Translations for it are loaded before application if needed.
const translated = await SR.TF ('en-US')`Remaining ${ number_of_hours } hours, ${ number_of_minutes } minutes`;Before values are substituted, parameters of primitive types are automatically converted to strings. For complex types, including those built into the TS SDK, you must manually convert them to a primitive type.
SR.TF('en-US')`Remaining ${ Context.data.duration.hours() } hours`; SR.TF('en-US')`Welcome, ${ Context.data.fio.lastname + ' ' + Context.data.fio.firstname }`; SR.TF('en-US')`Due date: ${ Context.data.date.format() }`;Returns function
Function for translating a template string.
Parameters
strings: TemplateStringsArray
Rest ...params: any[]
Returns string
Returns a function for translating a template string with parameter values inserted into it.
The specified locale is used for translation. Translations for it are loaded before application if needed.
const translated = await SR.TF ('en-US')`Remaining ${ number_of_hours } hours, ${ number_of_minutes } minutes`;Before values are substituted, parameters of primitive types are automatically converted to strings. For complex types, including those built into the TS SDK, you must manually convert them to a primitive type.
SR.TF('en-US')`Remaining ${ Context.data.duration.hours() } hours`; SR.TF('en-US')`Welcome, ${ Context.data.fio.lastname + ' ' + Context.data.fio.firstname }`; SR.TF('en-US')`Due date: ${ Context.data.date.format() }`;Parameters
locale: string
Returns function
Function for translating a template string.
Parameters
strings: TemplateStringsArray
Rest ...params: any[]
Returns Promise<string>