translation

Playtech.API. translation

Methods

# (static) translate(Key,, replacementsopt, defaultValueopt)

Retrieves a value of a translation key if it was currently loaded on a page. Value corresponds to currently selected locale.
Parameters:
Name Type Attributes Default Description
Key, string without `playtech.mobile.` prefix.
replacements Array.<string> <optional>
[] Array of replacements that will substitute {i} in the string, where i -- index in the array.
defaultValue string <optional>
'' Default value in case translation does not exists.
Examples
// 'playtech.mobile.system.my.tk'
Playtech.API.translation.translate('system.my.tk');
// 'bar'
Playtech.API.translation.translate('system.my.foo');
// 'bar'
Playtech.API.translation.translate('playtech.mobile.system.my.foo');
// 'foo with bar inside value'
Playtech.API.translation.translate('playtech.mobile.foo', ['bar']);
// 'playtech.mobile.system.my.tk' value contains {0} {1}
Playtech.API.translation.translate('my.tk', [replaceStr1, replaceStr2]);
// 'default value'
Playtech.API.translation.translate('my.non-exist.tk', [replaceStr1, replaceStr2], 'default value');