Skip to content

[login] Adding reset password email translations - #11078

Open
lapadulamichael wants to merge 7 commits into
aces:29.0-releasefrom
lapadulamichael:2026_07_28_Add_lost_password_template_translations
Open

[login] Adding reset password email translations#11078
lapadulamichael wants to merge 7 commits into
aces:29.0-releasefrom
lapadulamichael:2026_07_28_Add_lost_password_template_translations

Conversation

@lapadulamichael

@lapadulamichael lapadulamichael commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Brief summary of changes

  • Added the translations for lost_password.tpl
  • Fixed bug where entering new generated password always returned "Expired password" message

Priority High given the bug blocks users from entering their new generated password successfully.

Testing instructions (if applicable)

  1. Setup your environment to receive emails
  2. Go to login
  3. Change the language
  4. Click on reset password
  5. Ensure you got the email and that it is translated
  6. Ensure that the new generaed password works in login

Link(s) to related issue(s)

  • Resolves 11075 (Reference the issue this fixes, if any.)

@github-actions github-actions Bot added Language: PHP PR or issue that update PHP code Module: login PR or issue related to login module labels Jul 28, 2026
@lapadulamichael lapadulamichael added Multilingual Any tasks related to making LORIS multilingual 29.0.0 - Bugs Issues found during the release testing for 29.0.0 Priority: High PR or issue should be prioritised over others for review and testing labels Jul 28, 2026
@HachemJ

HachemJ commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Could you not use dgettext() in lost_password.tpl, perhaps with the login domain? Since the template is outside the modules, I'm not sure if that will work. Jefferson brought up the same exact issue you're fixing in this PR while reviewing my password reset rework changes (not going in 29.0.0 because too late), so I was wondering if this approach had been considered. I haven’t tried it myself, but I know dgettext() can be used in .tpl files, and it would avoid having multiple versions of the same file.

@driusan

driusan commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

I think this way makes more sense to me because you want to translate the whole email as a unit, and might want to move things around. Using dgettext in individual sections of the template would mean that you can only translate them piecemeal.

The downside of doing it this way is that you can't override a language translation without overriding the module that has the template, but overall I think this approach is better than hacking up templates with dgettext for emails.

@HachemJ

HachemJ commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

I think this way makes more sense to me because you want to translate the whole email as a unit, and might want to move things around. Using dgettext in individual sections of the template would mean that you can only translate them piecemeal.

The downside of doing it this way is that you can't override a language translation without overriding the module that has the template, but overall I think this approach is better than hacking up templates with dgettext for emails.

That makes sense. My initial thought was something like this. It’s definitely less elegant, but it keeps everything in one block. I kind of used that approach in the statistics module when I was dealing with template files.

{sprintf(
dgettext(
'login',
"Subject: Lost Password - %s\n\n%s,\nYour password....."
),
$study,
$realname,
...

@HachemJ

HachemJ commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

I'm okay with both I will just adapt whenever I have to resolve the conflicts on my PR for the rework of the reset password functionality (where I modified this specific template file).

Comment thread modules/login/php/reset.class.inc Outdated
@lapadulamichael
lapadulamichael requested a review from HachemJ July 29, 2026 14:56
@HachemJ

HachemJ commented Jul 29, 2026

Copy link
Copy Markdown
Contributor
image

I followed the testing instructions in all 6 languages. I got no errors during the process and I was able to reset my password successfully 6 times.

One thing to note is that the 'LORIS Demonstration Database' string (which is the study name) is not translated in neither spanish, chinese nor hindi.

This is because the table (ConfigI18n) which holds the db translations for the study name doesn't have the translations in any of these 3 languages mentioned above.

image

If you were to fix it in the same PR, the workflow should be the following:

  • Source a fresh database using make testdata.
  • Translate 'LORIS Demonstration Database' into these three languages, then insert the translations directly into the database using mysql.
  • Once you’re done, run tools/exporters/DB_dump_table_data.php to export the updated table data.
    then git add raisinbread/RB_files/RB_ConfigI18n.sql

If you see many other files after running the script, it’s likely because earlier changes didn’t follow the procedure described in the raisinbread README.md

image

In short: it is not recommended to manually edit the Raisinbread SQL/data files. However, if you were to make the exact same changes, the end result is generally the same. But the exporter is mainly there to ensure the files accurately reflect the database state and are generated in the expected format.

@lapadulamichael
lapadulamichael force-pushed the 2026_07_28_Add_lost_password_template_translations branch from d926d97 to 17fc63d Compare July 29, 2026 16:04
@github-actions github-actions Bot added Language: SQL PR or issue that update SQL code RaisinBread PR or issue introducing/requiring improvements to the Raidinbread dataset labels Jul 29, 2026
@lapadulamichael

Copy link
Copy Markdown
Contributor Author

Added only Chinese and Hindi translations since Spanish is not in RB yet

@HachemJ

HachemJ commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Added only Chinese and Hindi translations since Spanish is not in RB yet

image

Received the emails with the translated study names and successfully reset my password twice.

@HachemJ HachemJ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HachemJ HachemJ added the Passed manual tests PR has been successfully tested by at least one peer label Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

29.0.0 - Bugs Issues found during the release testing for 29.0.0 Language: PHP PR or issue that update PHP code Language: SQL PR or issue that update SQL code Module: login PR or issue related to login module Multilingual Any tasks related to making LORIS multilingual Passed manual tests PR has been successfully tested by at least one peer Priority: High PR or issue should be prioritised over others for review and testing RaisinBread PR or issue introducing/requiring improvements to the Raidinbread dataset

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants