Basics
Adding and removing locales
To add a new locale, add it to the locales
array in <project0name>.inlang/settings.json
file.
Adding and editing messages
Messages are stored in messages/{locale}.json
as key-value pairs. You can add parameters with curly braces.
Importing messages
After compiling your project, you'll have access to all your messages through the generated messages.js
file:
Using parameters
For messages with parameters, simply pass an object with the parameter values:
Forcing a locale
You can override the locale by passing a locale option as the second parameter:
Setting the locale
To change the current locale, use the setLocale
function:
Getting the current locale
To get the current locale, use the getLocale
function:
Routing
The localizeHref
function can be used to generate URLs with the current locale:
Choosing your strategy
You likely want to use one of the strategies provided by Inlang. Visit the strategy documentation to learn more.