Hello again I would like to translate the emails t...
# support-questions-legacy
r
Hello again I would like to translate the emails that supertokens sends to our customers. I understand that I can change the content as described here: https://supertokens.com/docs/emailpassword/email-delivery/smtp/change-email-content But how do I know into which language I have to translate? I would be happy to get the language that users saw as they register in the browser.
The input to
getContent
contains a user and a userContext. Can I use those? How can I modify them at the registration screen?
j
Hey @romixch maybe @porcellus can help
r
That would be excellent!
p
Hi
This could be a bit more involved: - we don't save the browser language information about the user - modifying the
userContext
on the frontend will not affect the backend.
you can use the user object to access your own database, where you could save the language the user is using during signup
Using the
preAPIHook
on the frontend, you can add this information into the sign up request
r
Ok. The preAPIHook ist what I am looking at right now. So seams to be a good place.
p
Then, on the backend you can override the sign up API to get this information from the request and save it
r
So I could for example set an additional header at the proAPIHook with the language?
Can I save it to the users metadata and get that at the email composition hook?
p
that works 🙂
r
Nice. I will try it this way.
Although I could imagine a simpler interface for translation
Sorry to bother you again. So I've got the header set now in the preAPIHook from EmailPasswordReact.init. I see it traveling over the wire when sending a POST to "signup". But how can I see it at the other end? I don't see where I can access request headers.
@porcellus
p
oh, sorry for the late answer
you can override the sign up API
Yeah, we do not really save information like this about the user by default. The flow of adding extra info like this could be simpler, that's for sure.
r
So that worked well. I am getting now used to the concepts too. I think I have now a good solution for Sign-up, verify, reset password. All translated. I still think supertokens was the right choice.
13 Views