Strings

Introduction

The most basic element supported by ESCL is a plain string. A string represents a line of text containing any character supported by the current locale, and may also include clauses to enable dynamic processing.

Naming Convention

String identifiers must be lower case, alphanumeric, begin with a letter, and may include underscores (e.g. my_string_identifier).

Simple strings

In this example, the hello_message identifier represents the string Hello, World!. This string requires no processing or formatting and will be returned verbatim.

hello_message: `Hello, World!`

Compound strings

A compound string is a string that is constructed by combining one or more strings. Using a clause, we can pass in the identifier of another string to insert it in place. Each string is processed independently before being combined.

In this example, tos_message will become Please accept our Terms of Service for en-US and Accepter nos conditions d'utilisation, s'il vous plaît for fr-CA.

en-US.js
tos_name: `Terms of Service`,
tos_message: `Please accept our { tos_name }`
fr-CA.js
tos_name: `conditions d'utilisation`,
tos_message: `Accepter nos { tos_name }, s'il vous plaît`

Notice how the translation of tos_message is rearranged in French? This is possible because the concatenation isn't hard-coded in our application but is instead handled with a compound string.

Aliases

An alias is a string that contains a single clause which references another string without any additions or modifications.

hello_message: `Hello, World!`,
hi_message: `{ hello_message }`

Last updated