Translations

Setting up translations

Create translation definition files

For Includable, translation files are simple JSON files which contain objects with a name of the translation string as key, and the value in the specific language as the object value. These are usually placed in the web/locales directory, and have filenames that correspond with the specific locale (i.e. nl_NL.json and en_US.json).

Example:web/locales/en_US.json

{
"example.hello": "Hey!",
"example.hellouser": "Hey, {user}!"
}

The naming convention for the translation keys are a general prefix that corresponds with the name of the module (in this case example.). Anything else is up to the developer, but it might be smart to group translations by period-seperated prefixes: example.menu.pages or example.pages.edit. Note though that translation keys are case insensitive!

Referencing translation files in module.json

Includable needs to be aware of what translations exist, so they need to be added to webOptions.translations: