Pages
For long-form content it can be easier to create an alternate page for a language; to do this append the language identifier before the file extension.
Example
To translate a file about.md
to the French language create a new file and give it the name about.fr.md
and it will be used when rendering the fr
locale.
If the primary language is en
then the about.md
file might be like this:
Assuming we have already configured the project for the French language (see languages) then we could create the about.fr.md
with this content:
Fallback
When we create a translated page the content in the new page is used by default but if the existing content is already localized (using messages) then it is possible to defer to the fallback content but still override the page data using the fallback
flag.
site/locales/en/main.ftl
about-content = About content.
site/locales/fr/main.ftl
about-content = À propos du contenu.
site/about.md
site/about.fr.md
By adding the fallback
flag to the page data we are saying use the content from the fallback language for this page.