Send confirmation, sign-in link, password reset and other auth e-mails in each user's language, with ready-made translations and your own templates per language.
Auth e-mails can go out in the language of the user who receives them. Add the languages you support, edit each language’s templates or keep the ready-made ones, and every confirmation, sign-in link, password reset, invite, e-mail change and reauthentication e-mail is sent in the user’s language. Users with no language, or one you did not add, get your main language.
#Add languages
- Open Studio › Authentication › Emails and find Languages.
- Choose the main language: the one your current templates are in, and the one users get when theirs is unknown.
- Add more languages. English, German, French, Spanish, Italian, Portuguese and Dutch come with ready-made e-mails in the same design as the defaults; other languages start from the English text for you to translate.
- In E-mail templates, pick a language tab and a template to change its subject or body. Send me a test sends what is in the editor to your own address, with sample values.
Saving restarts the project’s Auth service once, which takes a few seconds. Removing a language deletes its edited templates.
#How the language is chosen
Each e-mail uses the language stored in the user’s metadata, in the first of these fields that is set: locale, language, lang. Only the first two letters count, so de, de-DE and DE all mean German.
- The JavaScript SDK sets
localefrom the browser’s language when a user signs up withsignUporsignInWithOtp, unless you pass one yourself. - The hosted sign-in page stores the language the page was shown in.
- You can set or change it at any time; the next e-mail uses the new value.
// sign-up in a language you choose (otherwise the browser's)
await stitchdb.auth.signUp({ email, password, options: { data: { locale: 'fr' } } })
// a signed-in user switches language in your app's settings
await stitchdb.auth.updateUser({ data: { locale: 'de' } })-- set the language of existing users, e.g. from your own profiles table
update auth.users u
set raw_user_meta_data = coalesce(u.raw_user_meta_data, '{}') || jsonb_build_object('locale', p.language)
from public.profiles p
where p.id = u.id;#Settings in the Management API
The language settings are part of the project’s Auth configuration (PATCH /projects/<ref>/config/auth in the Management API):
| Field | What it is |
|---|---|
email_lang_default | The main language, a two-letter code. Default en. |
email_langs | Up to 10 more languages, such as ["de", "fr"]. |
lang with subjects / templates | Save the subject or body of one more language: {"lang": "de", "subjects": {"recovery": "Neues Passwort"}}. An empty value goes back to the ready-made one. |