Last Updated: Oct 14, 2024
Overview
When clicking on the link received on the Password Reset Email, the Password Reset page it redirects to is not correctly localized. How to specify the language from this Password Reset Page?
Cause
While it is possible to use ui_locales to set the language in the initial login/forgot password page, and add user metadata to customize the Email Template, passing the ui_locales parameter in the URL link to the /u/reset-password page is not possible out of the box. This is due to the URL ending with a hash mark (#). Everything added onto the end of the URL would be considered a fragment, and not a query string parameter which results in the language of the /u/reset-password page defaulting to whatever is set in the browser’s Accept-Language
header.
Solution
Follow the steps or video below:
Using built-in methods of Liquid Syntax, it is possible to remove and add characters from a string. The code below removes the trailing hash-mark and appends the ui_locales parameter onto the URL, setting the language of the /u/reset-password page to the same language used in the email template.
<a href="{{ url | remove: "#" }}&ui_locales=fr-FR">Click here</a>
By adding this code, on the Password Reset Email Template, the user will see a Click here link that will redirect to the reset password page, properly localized thanks to the ui_locales parameter appended before.