Literals (Preview)

Experimental Feature

Introduction

An experimental feature, literals allow you to hard-code values directly into clauses. By default, ESCL only supports referencing existing, pre-defined strings. However, sometimes it may be useful to just include a string directly.

String literals

A string literal is a string that is defined directly inside of a clause. As such, it does not have an identifier and cannot be referenced by other strings.

A string literal can be any string of characters, wrapped in single- or double-quotes.

In this example, the string literal "login" is passed to the LINK function:

hello_message: `Hello!  Please { LINK("login", :linkUrl) } to continue.`

Then, we translate the string, passing in the variable values:

$translate('hello_message', {
    linkUrl: 'profile.php'
});

The result:

Hello!  Please <a href="profile.php">login</a> to continue.

Last updated