You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd appreciate help understanding generic approach of how to handle the following scenario.
On a multi-lingual website, I have a language selector in the corner, and I'm passing the current locale to the ory/elements components - something like below:
This works great, when user switches to e.g. German, they will see the form in German too.
Now, I want to send the email verification email in German too in this case. I understand from the docs and other discussions that I need to save that locale into user's traits (or metadata) and use it in the email.body.gotmpl like:
Now, if I go with the traits approach (which is preferable if I want the users to change their preferred language of communication), I understand I need to add it to the identity.schema.json, something like:
How to set this trait programmatically? I have locale in my RegistrationPage function, I just need to set it as is to this language trait. The only thought I had was to override components (say a header) and add <input type="hidden"> somehow manually, but this doesn't feel like the intended behavior of using ory/elements?
How to hide the language trait from the form? I don't want the users to see this field in the registration form (TBD about settings form, let's assume it's okay for it to be rendered on settings page, but ideally I want a dropdown that will say "English" and "German" that sets values as "en" and "de").
And if I instead want to go with the metadata approach, it solves the "hiding" aspect, but still, how to set this value programmatically? I need to set it before the verification email is going to be sent.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'd appreciate help understanding generic approach of how to handle the following scenario.
On a multi-lingual website, I have a language selector in the corner, and I'm passing the current locale to the ory/elements components - something like below:
This works great, when user switches to e.g. German, they will see the form in German too.
Now, I want to send the email verification email in German too in this case. I understand from the docs and other discussions that I need to save that
locale
into user's traits (or metadata) and use it in theemail.body.gotmpl
like:Now, if I go with the traits approach (which is preferable if I want the users to change their preferred language of communication), I understand I need to add it to the
identity.schema.json
, something like:Here's what I cannot grasp:
locale
in myRegistrationPage
function, I just need to set it as is to thislanguage
trait. The only thought I had was to overridecomponents
(say a header) and add<input type="hidden">
somehow manually, but this doesn't feel like the intended behavior of using ory/elements?language
trait from the form? I don't want the users to see this field in the registration form (TBD about settings form, let's assume it's okay for it to be rendered on settings page, but ideally I want a dropdown that will say "English" and "German" that sets values as "en" and "de").And if I instead want to go with the metadata approach, it solves the "hiding" aspect, but still, how to set this value programmatically? I need to set it before the verification email is going to be sent.
Many thanks!
Beta Was this translation helpful? Give feedback.
All reactions