This document details the following aspects of a Multi-Language Page:
English is the default language.
If there is a
You can also set the language in
You can check and set the language to switch using the following code:
To use the
We will use the page translation key in two languages in this example to demonstrate the mechanism.
app/translations/en.yml
app/translations/pl.yml
Having these two files enables you to use the
For example, opening
/multilanguage
/multilanguage?language=pl
Inside YAML, it is possible to include any data structure that is usable in JSON, including arrays.
Visit json2yaml to learn how YAML will convert to JSON or vice-versa if you feel more comfortable in JSON.
You can use this feature alongside other filters to store collections in a readable form.
app/translations/en.yml
app/translations/jp.yml
/multilanguage?language=en
/multilanguage?language=jp
Sometimes you'll need to translate parts of a sentence but keep others (e.g. names). In these cases, some of the content should be parameterised.
The
app/translations/en.yml
app/translations/pl.yml
/multilanguage?language=en&name=John&url=https://docs.growthgardens.com
/multilanguage?language=pl&name=Pawel&url=https://growthgardens.io
In many languages — including English — there are only two forms: singular and plural for a given string, e.g. "1 message" and "2 messages". Other languages (Arabic, Japanese, Russian and many more) have different grammar with additional or fewer plural forms. Thus, the
The
If you set this to your language file:
Then:
The output rendered is:
Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.