<@U04UQ68083H> can I translate the email subject o...
# ory-copilot
f
@chilly-king-10285 can I translate the email subject of the email templates?
c
A message from kapa.ai
Yes, you can translate the email subject of the email templates in Ory. The documentation provides examples of how to use nested templates to render
email.subject.gotmpl
,
email.body.gotmpl
and
email.body.plaintext.gotmpl
templates based on user settings, such as their chosen language. To enable this, you need to customize the identity schema to include the user's preferred communication language. This identity trait can then be used inside the template to render a section conditionally. Here is an example of a custom Identity Schema with user language:
Copy code
json {     // ...     "properties": {       "traits": {         "type": "object",         "properties": {           // ...           "lang": {             "type": "string",             "title": "Your preferred language"         },         "required": [           "email"         ],         "additionalProperties": false,       }     }   }
You can then use this
lang
trait in your templates to render different versions based on the user's preferred language. For more details, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#translated-templates-i18n).