Including your own translations

Last updated:

Formcentric offers the option of adjusting translations at runtime by specifying a custom localisation file to load. This can be done either by setting the attribute data-fc-locales-path="path/to/file.js" on an arbitrary HTML element or by defining the global variable window.formcentric.localesPath.

One or more translation keys can be overwritten in this file. Undefined keys remain unchanged and will continue to use the default translations.

Adding new languages and translation keys

For full details of all of the existing translation keys, please see the file locales.js in the official @formcentric/client library. This file lists all keys together with their default values.

If you want to add your own translations or overwrite existing translations, you can create a custom JavaScript file that contains only the changed or new keys.


Example:

Overwriting the keys ‘formcentric.error.required’ and ‘page’ in German and English (US)