Skip to content

Commit

Permalink
Mention templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Oct 29, 2023
1 parent 561b60a commit b953315
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion LANGUAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ Numbers are only equal to other numbers that have identical decimal values and e
> TRANSLATION → textopen text textclose LANGUAGE
> LANGUAGE → language name
Text values, unlike in other programming languages, are not a single sequence of Unicode code points. Rather, they are unique in two ways:
Text values, unlike in other programming languages, are not a single sequence of Unicode code points. Rather, they are unique in a few ways:

- They are interpreted as a sequence of graphemes, using a grapheme segmentation algorithm. That means that emojis comprised of multiple Unicode code points are treated as a single symbol when indexing text.
- They can be language tagged, indicating what language and optional region they are written in
Expand All @@ -304,6 +304,15 @@ It's possible to check whether an environment has a particular locale selected w

This will return `` if the locale is in the preferred list, and, `` otherwise.

Text can also be templates, with aribtrary expressions that are automatically converted to text:

```
'hi number \8 + 8\'
'what will you be? \choose(name)\'en
```

These are similar to string templates in other languages, just with a slightly simpler syntax.

#### _evaluation_

Text literals first get the environment's list of preferred locales and then select the first translation in the list of translations that match the exact language and region, and if there isn't one, then the first translation that matches the language, and if there isn't one, then the first translation.
Expand Down

0 comments on commit b953315

Please sign in to comment.