Localization
Support multiple languages in your application.
The
passage-auth
, passage-login
, passage-register
, passage-profile
, and passage-passkey-table
elements all support localization to the following languages:- "en" - English
- "es" - Spanish
- "de" - German
- "it" - Italian
- "pl" - Polish
- "pt" - Portuguese
- "zh" - Chinese
To use the localization feature simply add a
lang
attribute to the elements like this:<passage-auth app-id="<Your App ID>" lang="de"/>
If the lang tag is set to a supported language the elements will render all text in that language. If the
lang
attribute is updated at run-time then the elements will adapt to this change and re-render in the newly provided language.The elements also support auto-detecting the current language set by the browser. This is the default behavior of the element, so if no
lang
attribute is provided then the element will attempt to localize to the default browser language setting.If the browser language is not a supported language or an unsupported language is passed to the
lang
attribute, the elements will fallback to the application's default language.
Language settings in Passage Console
If your application uses the default emails and text messages to send the magic link emails, Passage will automatically localize to the supported languages, or the default language if the currently set language is unsupported.
If you have customized the default email or SMS template then you will need to add in support for localized language to your templates.
The currently used language for the link to be sent is provided as a template variable
{{.magic_link.locale}}
and can be used with Go templating syntax to make decisions on what text to render in the custom emails. {{ if (eq .magic_link.locale "de") }}
Dies ist eine deutsche Saite
{{else if (eq .magic_link.locale "it") }}
Questa è una stringa italiana
{{else}}
This is English string
{{end}}
Most of the time when you use embedded links, you will send them using your own email provider and template. However if you do want to send a magic link through Passage using the management API, just include the
language
parameter in the JSON. Have a request for a specific language? Email us at [email protected] and let us know!
Last modified 3mo ago