OK, it took me most of the day going through multiple tests to realize that the workflow was failing because the WPML setting "Allow translating the login and registration pages" was checked, but must be unchecked, as we are not using the normal WordPress reset password workflows and instead using that coming from Views/Blocks.
Re-instating the patch on your test site, the workflow is now correctly maintained in German throughout the process.
The one remaining problem is that the text of the reset password notification email is in English, even though I can see translations of the texts are available.
I will try and solve that piece of the puzzle tomorrow.
I unchecked that WPML option and re-applied your patch on our dev server.
English PW reset works flawlessly, however clicking the link in the email from the German version of the lost password process, I am still getting that redirect from the German page "passwort-zuruecksetzen" to the English "reset-password" page.
hidden link >> hidden link
HOWEVER, if I copy and paste the link into the browser, I CAN open the German page "Passwort zurücksetzen" (reset password). I can enter a new PW twice there, and am redirected to the PW Change Successful page in German as I would expect. The password is reset and the PW reset successful email confirmation goes out, unfortunately also in English again.
Have you any idea why this redirect is occurring? It's strange that when I paste in the URL it works, but clicking the URL from the email loads the (correct) German page, then redirects.
Quick update. My colleague’s computer’s OS is in German. On her computer it works fine in German so I think it was just my browser redirecting to English because my OS was in English. In fact hers behaves the exact opposite of mine. German works perfectly but clicking the English version of the link gets redirected to the german page.
That worked. So I can now confirm that the process works 100% in English and German and the only remaining issue is why we aren't getting German emails when we do the process is German.
OK, for hopefully the last time (fingers crossed), I have a solution which I've tested on my local copy of your site and which works both for the English and German reset password workflows.
I applied it and it translates the first mail correctly, but the simple confirmation mail that is sent once the password has been changed successfully is still coming in English for the German version. I found two strings in WPML for that email and they are both translated on our site (see screenshot).
That is an admin message sent to the site owner to tell them that someone changed their password, not an email sent to the user who went through the password reset process.
So it is somewhat different, and it is not obvious to me that it should get translated. As an admin notice, I would expect it to be sent in the default language of the site. (Imagine the site had 10 languages; I wouldn't expect the site admin to receive admin notices in 10 different languages.)
Yes, you are right. It is indeed just for us as admins, so it's totally fine that that happens in English only, since our site is set to English UK. In that case, I would say that your patch is working! 😊 ✅