In production environment, you should never leak your API key. In-context localization must be available only for your translators, developers or other staff but not for the outside world.
Never leak your API key! We strongly recommend against adding API key into git repository.
To prepare your application for production you will need to let Tolgee use exported .json files. You can get these files by exporting your translations from web application. See exporting translations.
To make Tolgee look for json files just remove apiKey property from configuration object. If we continue with our hello world example, production configuration object will look like this:
In production mode,
ui properties are useless as we don't allow anybody to change our translations in
the app accessible from the outside world. We can also remove the
script tag importing tolgee UI.
Next, we should add exported translations into some public path so Tolgee can reach them.
By default, Tolgee looks for the translation files in
To change this, you may provide
filesUrlPrefix property to configuration object but for out example we can stick with
Let's take the exported json files and put them into the i18n directory placed as a sibling of our html file:
That's it! Our app is ready for production. Here is the final HTML page:
Now you maybe wish to add loading overlay to make untranslated texts invisible.