ESCL
EJS String Composition Language (ESCL)
Introduction
The EJS String Composition Language provides a powerful, flexible, and platform agnostic method for composing complex strings and translations. From simple string definitions to complex clauses comprised of custom variables, static terms, compound strings, aliases, functions, embedded links, and custom formatting -- ESCL can handle it all.
ESCL is designed for everyone, including developers, translators, copy writers, etc. This empowers non-developers to work effectively without any programming background.
Concepts
Working with ESCL is a breeze once you understand a few key concepts.
Strings
The most basic element supported by ESCL is a plain string. In this example, the hello_message
identifier represents the string Hello, World!
.
This string requires no processing or formatting and will be returned verbatim.
Clauses
A clause in ESCL represents a dynamic part of a string that will be processed. You represent a clause in a string using brace brackets.
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
in English and Veuillez accepter nos conditions d'utilisation
in French.
Variables
A variable is a part of a string that will be replaced by values provided by the application. Values may be passed using the $translate instance method or the v-i18n directive.
In this example, the application is expected to provide values for the firstName
and lastName
variables.
Aliases
An alias is a string that contains a single clause which references another string without any additions or modifications.
Last updated