Translation Codes
  • 07 Apr 2024
  • 3 minute read
  • Dark
    Light
  • PDF

Translation Codes

  • Dark
    Light
  • PDF

Article summary

Overview

Translation Codes change a text value to a different text value. They can be used on a field, such as to translate a short code into a longer code. Great use cases for Translation Codes involve Merge Fields, Liquid Markup, and Content Blocks.

Common values that are translated include:

  • Changing a Program Name to an Application Deadline

  • Changing a Major to a College 

  • Grouping or converting GPAs

Common areas where Translation Codes are leveraged include:

  • Subject Lines in Mailings

  • Scheduled Exports via Queries

  • Discount Codes in Forms

Creating a Translation Code

To create a Translation Code:

  1. Create a Key - Keys are used for describing and grouping Translation Codes together. Translation Codes that shares the same key must have the same Value Type. Here, each key must be lower case and include no spaces.

  2. Select a Value Type - There are five to choose from.

    1. String - any text string of characters

    2. Real Number - numbers that include decimals

    3. Integer - whole numbers without decimals

    4. Date - a date value

    5. DateTime - a timestamp that includes date and time

  3. Create a Code - Codes are used to define the various values that a field value can be translated to.

    1. Value - the field value in its original form

    2. Export Values - the values that the field value will be translated to

Examples

A good example involves translating date ranges to an Export Value:

When creating a code, String values must match exactly for a Translation Code to function, whereas the other types can be defined via a Range, with a minimum and maximum value. Each Translation Code can have one to five Export Values configured, meaning the same Translation Code can be used for multiple processes. Additionally, the Translation Code Import source format is available in the Source Format Library for use importing Translation Codes in batch.

Below is another example of a Translation Code. Here, the values are inclusive, which means that if you have a Real Number translation code, and you enter 1.5 as the Minimum Value and 3.49 as the Maximum Value, any value starting at and including 1.5 up to and including 3.49 will use that Translation Code.

In this example, a Default Export Value is setup to capture values that do not fall into the range. Similarly, if a String is used, a Default Export Value can also be setup.

Use in Query

To apply a Translation Code in a query, visit the Export Values setting within an Export. There, select Translation Export Value and select the Translation Code Key.

🔔 Important!

Null Values: If you do not have a Default Value configured for the Translation Code Key, the result will be Null (Blank) if the value does not match any of the Translation Codes with that Key. You can configure a Null Value on the export to provide a Default Value for just that export. If a Default Value is configured for the Translation Code Key, then the value will never be Null.

Use in Forms

Translation Codes are available to use in form fields with calculations. Here, Translation Codes are hidden on the form because they provide a label for the Translation Code. To create this, select the Translation element within the Form Builder and configure it. Field properties include:

  • Label - provide an intuitive name for internal-use

  • Script Key - the unique key created here will be referenced by a calculated field elsewhere on the form

  • Translation - select the Translation Code

  • Translation Export - select the Export Value

A form can have multiple Translation Code elements. If the same Translation Code and Export Value will be used more than once, you can reference the same translation form element multiple times. Multiple Translation elements must be included in the form when using different Export Values for a single Translation Code. For example, Export Value 1 for one translation and Export Value 2 for another.

To use the Translation Code on the form, add a form field and a calculation formula. The calculation formula is translate("key", @export) Here, the key is replaced with the Script Key and the Export is replaced with the Export Key of the form field being translated.

  • If a string value is being translated, append the export key in the calculation formula with "_text", like this example: translate("key", @export_text)

  • For translating form fields with the export key, such as reader_rating, the calculation formula should contain that key, like this example: translate("rating_number", @reader_rating)

  • Translation codes can also be included in math calculations, like this example: 5 * (translate("rating_number", @reader_rating) + @extra_rating)


Was this article helpful?