Customizing Emails by Language
When you register a user, you can create meta-data about them.
Creating meta-data with the JS-Client's signUp function
const { data, error } = await supabase.auth.signUp({ email: 'email@some_[email.com](http://email.com/)', password: 'example-password', options: { data: { first_name: 'John', last_name: 'Doe', age: 27, }, },})The above example creates a user entry that includes information about their name and age. The data is stored in the auth.users table in the auth.raw_user_meta_data column. You can view it in the auth schema with the SQL Editor.
It can be accessed in a project's Email Templates. Below is an example:
<h2>Hello, {{ .Data.first_name }} {{ .Data.last_name }}!</h2><p>Follow this link to confirm your account:</p><p><a href="{{ .ConfirmationURL }}">Confirm your account</a></p>If you need to update a user's meta-data, you can do so with the updateUser function.
The meta-data can be used to store a user's language preferences. You could then use "if statements" in the email template to set the response for a specific language:
{{if eq .Data.language "en" }}<h1>Welcome!</h1>{{ else if eq .Data.language "pl" }}<h1>Witamy!</h1>{{ else }}<h1>chuS'ugh, tera' je (Klingon)</h1>{{end}}Supabase uses the Go Templating Language to render emails. It has advanced features for conditions that you may want to explore. For more examples, there is a GitHub discussion that discusses advanced language templates.