Skip to content

Get text

Dynamic Content can be used to get localized text based on subscriber locale, using GetText method.

To use this you need to create data table with name Translations and following structure:

Column nameTypePK
keystring(255)Yes
localestring min. 7 charactersYes
translationtextNo

Method signature:

${GetText(key, locale, fallback, valuepairs)}
  • key of translated value
  • locale is a culture of translation e.g. ‘RU’, ‘PL’, ‘default’
  • fallback is default value which will be returned when there is no translation for provided key and locale and there is no default locale for the key.
  • valuepairs is dictionary of parameters which will be replaced in translated sentence. Note that parameter name needs to be placed between % signs.

Example:

Let’s say that we have following rows in our Translations table:

KeyLocaletranslation
expiration_datedefaultYour %param_account% subscription expires on: %param_date%
expiration_datePLTwoja subskrypcja %param_account% wygasa: %param_date%
<%
var valuepairs = new System.Collections.Generic.Dictionary<string, string>();

valuepairs.Add('param_account','Netflix');
valuepairs.Add('param_date','2020-04-15 00:13:00');
%>

Default: ${GetText('expiration_date')} <br />
Default: ${GetText('expiration_date', 'default', '', valuepairs)} <br />

PL: ${GetText('expiration_date', 'PL', '', valuepairs)} <br />

BR (no translation in table): ${GetText('expiration_date', 'BR', '', valuepairs)} <br />

Output:

Default: Your %param_account% subscription expires on: %param_date%
Default: Your Netflix subscription expires on: 2020-04-15 00:13:00
PL: Twoja subskrypcja Netflix wygasa: 2020-04-15 00:13:00
BR (no translation in table): Your Netflix subscription expires on: 2020-04-15 00:13:00
On this page
To top