Skip to content

Messages and Terms

QuickWrite edited this page Sep 22, 2022 · 2 revisions

Messages and Terms are the base building block of every Fluent file as they are encompassing declaration of all of the other building blocks. Messages and Terms can be declared by having the key on the left side and the content on the right side of the =:

{{key}} = {{content}}

The key is the name by which it is being accessed.

hello = World 

This means that when the key hello is being accessed it would return World.

Differences between Messages and Terms

To convert a Message into a Term the key needs to be prepended with a -. This means that when hello should be a term, this should be done:

Placeables

In Fluent, text can interpolate values of other messages, as well as external data passed into the translation from the app. Use the curly braces to start and end interpolating another expression inside of a pattern:

# $title (String) - The title of the bookmark to remove.
remove-bookmark = Are you sure you want to remove { $title }?

Multiline Text

Text can span multiple lines. In such cases, Fluent will calculate the common indent of all indented lines and remove it from the final text value.

multi = Text can also span multiple lines as long as
    each new line is indented by at least one space.
    Because all lines in this message are indented
    by the same amount, all indentation will be
    removed from the final value.

indents =
    Indentation common to all indented lines is removed
    from the final text value.
      This line has 2 spaces in front of it.
Clone this wiki locally