Skip to content

Placeables

QuickWrite edited this page Sep 22, 2022 · 1 revision

Placeables in Fluent are a way of using special syntax to incorporate small programmable blocks so that the messages can be a lot more versatile. Placeables are denoted with the syntax of having { and } around them. As an example there could be variables that were specified when the message was accessed: { $variableName }.

# Variable $name is being used here and it can be specified when the message is accessed.
greetings = Hello { $name }! How are you?

When the variable $name is being specified with Max it would return the String Hello Max! How are you?

Inclusion of other elements

Other messages and terms can be included as well:

# Term that should be included
-brand-name = Firefox

# Message that is being accessed
installing = Installing { -brand-name }

Using { in messages

When you want to use the { in the messages without creating a placeable you can use a StringLiteral that encompasses it:

curly-braces = This message has: { "{" }

When curly-braces is getting accessed it would return This message has: {.

Clone this wiki locally