Messages
Messages are referred to by name, here is an example defining a message and then referencing it using the fluent
helper.
If the file site/locales/fr/main.ftl
contains:
welcome = Bonjour!
Then we can reference the message in our content using this syntax:
If a message does not exist then an unknown localization message is rendered:
Unknown localization missing-key
info
See project fluent for more information on the syntax used in .ftl
files.
Variables
Variables can be passed to messages using the helper hash parameters. For example, if we update the message file to include a variable reference:
welcome = Bonjour { $name }!
We can pass the variable value like this:
Parameters
If you need to pass a multi-line message as a variable there is an alternative block syntax which uses a child fluentparam
block.
For example to pass a greeting
variable: