[][src]Crate bracket_fluent

Helper for fluent language lookup.

The root data for the template must contain a lang field with the identifier of the current language.

Assuming a fluent language file in locales/en/main.ftl and the lang field is set to en, using the contents:

This example is not tested
welcome = Hello!
greeting = Hello { $name }!
block = { $var1 } { $var2 }

We can resolve the message in a template using the fluent helper like this:

This example is not tested
{{fluent "welcome"}}

Pass variables using the helper hash parameters:

This example is not tested
{{fluent "greeting" name="world"}}

If you need to pass multi-line variables to a message use the fluentparam syntax inside a block call:

This example is not tested
{{#fluent "block"~}}
{{#fluentparam "var1"~}}
This is some multi-line content for 
the first variable parameter named var1.
{{/fluentparam}}

{{#fluentparam "var2"}}
Which is continued in another multi-line 
paragraph using the variable named var2.
{{~/fluentparam~}}
{{/fluent}}

Structs

FluentHelper

Lookup a language string in the underlying loader.

FluentParam

Local helper for {{#fluentparam}} blocks.