Skip to content

Localization

Note

For localization of CMS-based content, see the CMS Localization docs.

We use Project Fluent to localize content that is not in the CMS.

Documentation

Quick Reference

Use a string id in a template

{{ ftl('string-id') }}

Check if strings ids are translated

{% if ftl_has_messages('new-title-id', 'new-description-id') %}
if has_messages("new-title-id", "new-description-id", ftl_files="mozorg/about"):

Pass a fallback string id

{{ ftl("primary-string-id", fallback="fallback-string-id") }}

Reference a variable

# Variables:
#   $attrs (string) link to https://example.com
example-read-more = Read more about the <a { $attrs }>example</a>.
{% set attrs='href="https://example.com" rel="external noopener"' %}
<p>{{ ftl('example-read-more', attrs=attrs)}}</p>

Mark a string id obsolete

# Obsolete string (expires: 2020-02-01)
example-old-string = Expires 2 months from now.