Problem/Motivation
This issues discussion has now changed it's focus to determine the users expectation on what language should the content of recovery email is when multiple language is setup. (email requested from /user/password or /fr/user/password). Currently it uses the language of the viewing page (active langcode) where reset email is requested as seen from the example below, but not the user's preferred langcode.
Current behaviour
The reset link provided will direct user according to the language of viewing /user/password page.
Example:
User A with language preference English
visit /zh/user/password => receive a reset content and link to /zh/user/reset...... that is Chinese.
Expected behaviour
User's preference should be respected. Therefore, we should be expecting email shown in English even when the reset request is sent on Chinese page.
Example:
User A with language preference English
visit /zh/user/password => receive a reset content and link to /en/user/reset. Be it English.
Another related issue upon the language of user's email text content not aligning with content/link from token_replacement is addressed in #2991677: Wrong language in token_options in user_mail function.
Original Problem/Motivation
The "reset password" page that comes up after clicking on a one-time login link uses the default site language instead of the user's language.
To reproduce this, you need the localization module activated, more than one language installed, and a user that has changed the language in their profile.
Hans
Steps to reproduce
- New Drupal install
- Enable language (language), interface translation(locale)
- Add new language French, set path prefix for both languages (en, fr)
- Translate the recovery email content of French without replacing the original tokens.
- Set User Accounts language preference as English.
- Log out, or use Incognito mode to request a reset email from French interface "/fr/user/password"
- Receive email in English with reset link to French page fr/user/reset.
After #2991677: Wrong language in token_options in user_mail function: Wrong language in token_options in user_mail function this will be consistent: email in English and reset link to English page /user/reset
Proposed resolution
1. #60, fix the submitForm of UserPasswordForm.php.
If you take a close look at user_pass_reset_url it already works with a langcode to translate the link. So the "problem" belongs on the Drupal\user\Form\UserPasswordForm::submitForm which use the UI langcode instead of User Preferred Langcode.
2. #78, fix LanguageRequestSubscriber.php of language module.
By taking the request url into part of the argument and determine whether user object should be set or not when visiting /user/password url, further used for the decision of langcode.
Remaining tasks
1. Decide the behaviour of returning language of email should be.
2. Decide the method to fix.
3. Add tests.
4. Review.
User interface changes
1. Language of Recovery Email's content and link will be altered.
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#128 | interdiff_124-128.txt | 3.34 KB | g-brodiei |
#128 | 86287-128.patch | 5.12 KB | g-brodiei |
#124 | interdiff_120-124.txt | 793 bytes | ravi.shankar |
#124 | 86287-124.patch | 6.36 KB | ravi.shankar |
#120 | interdiff_116-120.txt | 1.11 KB | ravi.shankar |
Comments
Comment #1
ricabrantes CreditAttribution: ricabrantes commentedany news about this?
Comment #2
LAsan CreditAttribution: LAsan commentedBumping.
Comment #3
brianV CreditAttribution: brianV commentedPatch attached to go a long way towards fixing this.
The problem is that the user is always anonymous when visiting the page, so the site's default language is always used.
In short, I use the code in the block below to get the user id from the URL, then get that user's preferred language, then pass the language to all calls to t(). This causes all the text to be translated to the user's preferred language.
The only thing that doesn't translate is the title, because you can't pass t('Reset Password') as an argument to drupal_set_title(). The only way I can see to get around that is to write a new function for Locale which, when given a string, returns it's translation in the provided language. Then pass this function the string 'Reset Password', and pass the translation to drupal_set_title().
However, that will need to be part of another patch.
Comment #4
brianV CreditAttribution: brianV commentedAttaching a screenshot to show the output. User requesting his password has 'Dutch' chosen as his profile language. Notice the title remains in English.
Comment #5
brianV CreditAttribution: brianV commentedJust tagging so this can be found in the 'Usability' queue.
Comment #6
brianV CreditAttribution: brianV commentedI've decided to just include drupal_set_title(t('Reset Password', array(), $user_language)), and leave it up to the translators to add a translation for it.
Also, this new patch integrates the small change made in #455630: Remove HTML tags from t() call in user.pages.inc, so if this patch is included, that one can be closed.
Comment #7
brianV CreditAttribution: brianV commentedOops - including patch!
Comment #8
catchThis should start with a capital letter and needs a leading space.
Should we just set global $language instead of all the t() changes?
Comment #9
brianV CreditAttribution: brianV commentedHeh - we don't need that kind of thinking here. :p
I will reroll it with that suggested change. It will make future changes simpler, since people can just use t() without worrying about sending the language parameter.
Comment #10
brianV CreditAttribution: brianV commentedRerolled with suggested changes.
Comment #11
brianV CreditAttribution: brianV commentedFinal revision!
Comment #12
brianV CreditAttribution: brianV commentedFamous last words. Final patch attached, this time without the added space.
Comment #14
brianV CreditAttribution: brianV commentedRerolled for current head.
Comment #15
svendecabooterThe last patch is throwing errors on usage of the 3rd parameter to the t() function.
The 3rd parameter
$user_language
should becomearray('lang_code' => $user_language->language)
Attached is another approach to fix this solution, which doesn't require to add the 3rd parameter to each call of the t() function, but rather changes the full language interface to the preferred language of the user requesting a password reset.
I'm not sure whether that might introduce other problems, but on my testsite it seems to apply fine.
Comment #16
brianV CreditAttribution: brianV commentedDoes the global $user item work here? Wouldn't the user be visiting the password reset page as anonymous?
If you can confirm that the global $user object is properly populated, then I would say this should be RTBC.
Comment #17
svendecabooterThe global $user object is used at that point to verify if a user arriving on the password reset page isn't logged in.
So if the $user object is indeed properly populated at that point, an error message is displayed. See comment at line 87 in user.pages.inc.
If the user is anonymous, the $user object will be the default $user object for anonymous users, with $user->uid being 0.
Comment #18
brianV CreditAttribution: brianV commentedDoh, I misread the patch. For some reason, I thought you were getting the preferred language for the global $user, instead of the one loaded from the URL.
At any rate, I think this is good to go in.
Comment #19
salvisI wanted to try this out, but I was unable to confirm that the 'Reset password' page really did come up in the user's language because I couldn't translate any strings because of #624926: "Translate interface" fails to show untranslated strings.
Thanks for working on it!
Comment #20
webchickI think it makes sense to have test coverage for this.
Can we also expand out the code comment to explain that the reason we're special-casing this page is because the user comes in as anonymous? Also, wrap at 80 chars please. :)
Comment #21
svendecabooterI updated the patch as per webchick's comments.
It's my first core testcase, so feedback is appreciated.
Comment #24
svendecabooter#21: 86287-translate-reset-password-page-global-2.patch queued for re-testing.
Comment #25
krlucas CreditAttribution: krlucas commentedAt some point after the original patch was rolled it seems like the global $language_interface was changed to just $language.
New patch attached.
Comment #26
alexpottPatch in #25 works great. Manual tests and simpletest both work well.
Comment #27
alexpottUpdating to RTBC
Comment #28
Dries CreditAttribution: Dries commentedThanks for getting involved with Drupal core development at the core sprint here at DrupalCon. This is a good start but needs some further work. We'll help/guide you along the way.
This code could actually be moved down into the else-case. We already load the $user object further down in the function so we should avoid loading it twice.
To comply with the guidelines, code comments should start with a capital letter, and end with a point. Various comments in this patch need to be updated.
Comment #29
Dries CreditAttribution: Dries commentedComment #30
krlucas CreditAttribution: krlucas commentedCleaned up the comments in the patch; moved the global language assignment into the if/else.
Comment #31
fending CreditAttribution: fending commentedSome formatting issues; comments given directly to patch author @krlucas.
Comment #32
krlucas CreditAttribution: krlucas commentedremoved spaces preceding line break.
p.s. not the patch author just the patch fixer ;)
Comment #33
krlucas CreditAttribution: krlucas commentedgah. missed one.
Comment #34
fending CreditAttribution: fending commentedThat does it. Did manual testing and the automated .test works dandily. RTBC, thanks for playing.
Comment #35
svendecabooterThanks krlucas for giving this some love :)
Comment #36
Georg CreditAttribution: Georg commented#33: 86287-translate-reset-password-page-global-4.patch queued for re-testing.
Comment #38
dddave CreditAttribution: dddave commentedI guess this needs only a slight update to reflect some changes made to HEAD to get back to RTBC. Please, somebody with the skills to do so fix this patch so that this nasty issue is not included in D7. That would be terrible.
Good karma awaits the person who finishes this!
Comment #39
alexpottRe-rolled patch against latest Drupal cvs head...
dddave perhaps you can test it (for some karma)?
Comment #40
dddave CreditAttribution: dddave commentedI am going to set up my first D7 test install tonight. I'll give it a test right after D7 is up and running.
Comment #41
dddave CreditAttribution: dddave commentedI am currently strunggling to get my mail server going to test this out. I am not the brightest bulp in in this regard so this might take a while...
Comment #42
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedMoved this to 8.x. Re-rolled #39.
Comment #43
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedRe-rolled patch from #42 after #22336: Move all core Drupal files under a /core folder to improve usability and upgrades.
Comment #45
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedRe-roll patch from #43.
Comment #46
valthebald#45: translate-reset-password-with-test-86287-45.patch queued for re-testing.
Comment #48
valthebald#45: translate-reset-password-test-only-86287-45.patch queued for re-testing.
Comment #49
salvisThere's no point in re-testing. The patch needs to be re-rolled.
Comment #50
klonos...perhaps this would help get a few more eyes on this.
Comment #56
lexhoukComment #57
lexhoukComment #58
joachim CreditAttribution: joachim as a volunteer commentedPutting a special case in this service for one path does not seem like a good idea at all.
Can we go back to the patch at #45, which needs a reroll?
Comment #59
wengerkAs suggested by #58, I restart from scratch (as the previous patch was 7 years ago).
To start with this issue, here the test-only so it obviously fail, to demonstrate the issue.
I will work on the necessary following patch on the next days (if nobody already creates the fix before ^^).
Comment #60
wengerkAfter digging on the code of resetPassword, I found a solution to make it work properly, but it will certainly create some "side effects", let's tests them with testbot.
If you take a close look at
user_pass_reset_url
it already works with a langcode to translate the link. So the "problem" belongs on theDrupal\user\Form\UserPasswordForm::submitForm
which use the UI langcode instead of User Preferred Langcode.For now if you "reset your password" using the Spanish (es) langcode, then you will receive the mail in Spanish (es), even when the use has a preferred langcode. We maybe need to update the Issue summary to reflect this - it's not the default site language but UI..
Here is the idea behind my patch:
Use the preferred langcode when the user has one or use the UI langcode if the user never set his preferred langcode.
By doing this, I avoid using the default site language (which would be used if
getPreferredLangcode
returnNULL
) when the user go thought/es/user/password
without having a preferred langcode. So I maintained the default behaviour - using the UI langcode when user has not preferred langcode.Also, should we add some code coverage to asserts the following ?!
- When user has no preferred langcode & use a localised form of Reset Password (Eg. /es/user/password) it will receive a link in Spanish
- When a user has a preferred langcode & use a localised form of Reset Password (Eg. /es/user/password) it will receive a link in his preferred langcode.
Thanks for you review & your suggestions !
Comment #61
wengerkComment #63
salvisThanks for taking on this 12 year old issue, wengerk!
Comment #64
wengerkComment #65
joachim CreditAttribution: joachim as a volunteer commentedI look at this code, and I think: surely there must be something that encapsulates this logic, so we don't have to do it?
Isn't this the job of the language negotiation system? Is this code in LanguageNegotiationUser perhaps not working because on the reset password page the user isn't logged in yet?
Comment #66
Dajka CreditAttribution: Dajka commentedIm using only one language on my site. (not english) I try to overwrite the system emails sent to users when an account gets activated, it is overwitten on both the /admin/config/people/accounts and also the /admin/config/regional/translate admin pages.
The problem is that all the emails gets sent out as the original translaton, and not the overwritten. Only the pending admin approval email gets sent as the one I entered. all the others stay the same.
I hope this is related and helps to figure out the issue.
Comment #67
salvis@Dajka: no, I don't think so, but thank you for looking through the existing issues.
Please create a new issue, and be sure to select the Drupal version that you have.
Comment #68
wengerkHey @joachim, thanks for your message in #65.
Indeed, it can't work because the code in
LanguageNegotiationUser
required the user to be logged in.Do you have any idea how we can continue on this issue - in the case my solution in #60 does not fit ?
Comment #69
alienzed CreditAttribution: alienzed commentedHere's a question, why does "the code in LanguageNegotiationUser required the user to be logged in"? Anonymous users need LanguageNegotiation too.
That's the bug...
Comment #70
wengerk@alienzed I agree with you, but it's another question. That this issue can't resolve whiteout going out-of-scoop. Should we then open a new Issue & add it as blocker for this one ?
Comment #72
salvisThis issue is about a special edge case where we know who the user is (we have to assume we know, for the purpose of sending the password reset email), even though they're not logged in, and they have their preferred language set in their profile.
Is there any justification for not sending the email in their preferred language? I don't think so. I don't think language negotiation should play any role here, but if we really need to have it, would it make sense to temporarily impersonate the user for this purpose?
Comment #73
alienzed CreditAttribution: alienzed commentedAll good questions... Personally I resolved my issue by following the pack and making sure my user has the right language set (although in my case, since I am actually manipulating the user for this request, I set the language the page is in to the profile right before calling _user_mail_notify())
@wengerk's suggestion of opening a new issue and referencing it as blocking is probably the way to go, since, again, why should anonymous users not have LanguageNegotiation? Unfortunately I have no appetite to push on that at this point.
As for this specific issue, what do we think is more appropriate?
a) The language of the page
b) The language in the user profile
Of course the profile is a more authoritative data point, but that is assuming their language preference truly reflects what the user wants and not what was set and forgotten by default during initial registration
Then, what makes more sense for someone who has clearly lost access to their account, perhaps due to a relatively long absence from the site. Can we take anything from the fact they are browsing the site in a specific language? Furthermore, wouldn't it be a bit weird to request the reset in english, and then to get the email in french (or whatever languages are available...)
Think about that as if it were a human to human interaction. You walk into a store you've been to many times, they know you can speak french as you have spoken french in the past (this is your preference as far as they are concerned), you go up to the counter and ask the cashier a question in English. Should the cashier respond in English or in French?
English I think is the intuitive 'human' choice here, because it is immediately obvious that the person speaks English and they've chosen their most up to date language preference by means of speaking in that language.
French is the OCD technical guy's choice, being a configuration setting that should be respected.
So personally I think the page's language is the intuitive authority here, just for conversation's sake :)
Thoughts?
Comment #74
salvisWe probably agree that the domain prefix and path methods of language selection should be respected, if the site supports them. In the absence of these two methods, "the language of the page" for the anonymous user is the default language or the browser language.
I would not change "the language of the page" after the user has entered their email address, because that would confirm that the email address is known on the page, but for the purpose of sending the recovery email, we know what profile to use.
So the question is only relevant between browser language and profile setting, and I guess it depends on which one you prioritize on your site.
You seem to prioritize the browser language before the user profile, so for your users the site's language changes with the browser, and the users have no control through the profile. Let's assume for a moment that your site supports English and Chinese. User A comes in speaking Chinese (having their browser set to Chinese) and enters user B's email address. User B, who doesn't understand Chinese, gets a Chinese email from your site, and they'll be scared.
I prioritize the user profile above the browser, because I believe that people should be allowed to choose their preferred language for my site (maybe different for different sites!) without having to change their browser settings. If they're used to interact with my page in French, they expect to get email in French. It's OK if the login page is in some other language (they're used to that), but it's not OK when they're nervous because they can't log in, and they get recovery instructions in the wrong language.
So, actually, you're in the same camp as I am — why are you reasoning the other way? "just for the conversation's sake"? This doesn't help this 12-year old issue to make progress...
Comment #75
alienzed CreditAttribution: alienzed commentedjust to be clear, by:
I set the language the page is in to the profile right before calling _user_mail_notify())
I meant that ultimately I enforce the language as defined by path prefix. I set That language to the user's profile right before sending the email, so as to override their profile's preference.
I think this really depends on the situation. Maybe it should be a setting...
Comment #76
salvis@alienzed:
If Anonymous comes in with a path prefix or a domain prefix, I'd expect the email to be sent in that language for sure, if that's how you've configured your language detection priorities.
If it isn't then that's a clear bug, but it's not the topic of this thread. This thread is about having the site configured to use the profile language but the profile language being ignored when sending the password recovery email. The OP specifically says "user that has changed the language in their profile."
So, please stop derailing this thread.
Comment #77
alienzed CreditAttribution: alienzed commentedAre the issues not directly related? No one but a user can request a password reset email, and users all have a default language preference set on account creation. Thus there is always a language preference, and password reset emails only work on accounts, which have the preference, thus
is not how it works now. The Profile Preference is taken instead of the page's language as defined by path prefix/domain/whatever. I did not mean to derail the thread at all, I arrived here because I had the same problem and had to fix the user's profile programmatically prior to sending the email, because it was not respecting the page's language.
Comment #78
lexhoukIt's just updated patch from #56 for 8.7.x. I agree that isn't a good solution but it works for my case.
Comment #79
sano CreditAttribution: sano commentedI re-rolled the #39 (Drupal 7) patch for the D 7.67 version. Not sure if it is OK to post it here.
Comment #81
sumithb CreditAttribution: sumithb commentedThe patch #78 is not working in Drupal-8.7.10. An error is appearing.
Comment #82
rohit-rajput-sahab CreditAttribution: rohit-rajput-sahab commentedI'm also facing this issue in Drupal Version 8.7.5.
Please provide a good solution.
Comment #83
rohit-rajput-sahab CreditAttribution: rohit-rajput-sahab commentedDuring the user registration, If the user goes through the 'Arabic' language then he/she will receive all emails in 'Arabic' language. For more information see the below attached file.
Comment #84
rohit-rajput-sahab CreditAttribution: rohit-rajput-sahab commentedAll emails are sent as per the user's preferred language.
For example:-
The user has registered a new account of the german language. In the user profile, german language is set automatically by language module. So, all emails are sent to german language.
Comment #85
alexpott@rohit-drupal I'm not sure about the solution in #78 as @joachim points out #58 putting a special case in the service feels wrong. #60 was taking another approach that looks more correct. Looking the discussion after that patch I think what we need to need is agree what the behaviour should be - and detail what the current behaviour is for what we want to fix - in the issue summary.
Comment #87
jonathanshaw#2991677-13: Wrong language in token_options in user_mail function has a test that is not needed for that issue in the end, but could be useful to this issue.
Comment #89
g-brodieiAfter working on #2991677: Wrong language in token_options in user_mail function, we discovered and fixed the bug to ensure both email content and token content reflects the same $langcode for any email sent by user_mail.
The fix on #60 looks more right with me as well, submitForm() it should not be passing the browsers language to _user_mail_notify() when we're expecting to see the user's preferred language on return.
If we can agree on this direction, I'd be happy to push out a patch base on #60, or we can review it again.
Comment #90
jonathanshawI think #60 is still too complex.
1) We don't infer the user's preferred language from the current language when registering a user, so why do we do it when resetting a password? It seems to be a badly-implemented edge-case feature.
2) #74 makes an excellent point:
I think it best to just remove any code in UserPasswordForm about the current language and leave it to _user_mail_notify() to send email in user's language.
If a site really wants to have emails sent in the browsing language if the user has no preferred language, then they can swap out the User entity class and override the getPreferredLangcode() method. A simple case for contrib/custom.
My bigger concern is with the language of the password reset email. The IS only mentions the language of the page the user visits after clicking on the one-time login url in the email. This is the "token language" that @g-brodiei fixed in #2991677: Wrong language in token_options in user_mail function. But as I understand it, I would have expected the current code to result in the text of the email to be in the language the visitor was browsing in not the user's preferred language. Can someone confirm this is what happens, or point me to a test about this?
Comment #91
g-brodieiUpdate issue summary.
Comment #92
g-brodieiComment #93
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedHere I have just added reroll of patch #78, it still NW as per comment #85.
Comment #94
jonathanshawDiscussed with @pameeela, @g-brodiei and Kristen pol on slack. A few things emerged:
- when a user registers, their browsing language at registation becomes their account preferred language
- this means that the only people without a preferred language are those from before language is enabled. They're a real edge case, and it's not unreasonable to assume they're comfortable in the site default language.
- another scenario related to #74 where using the browsing language as the password reset language is problematic is remote support, where someone other than the user tries to help them by triggering a password reset for them
Given this, I think we should ignore browsing language entirely. It's simpler, safer and will very rarely be a significant problem.
Additionally, the IS says:
But shouldn't it say:
Comment #95
g-brodieiThank you for summarising the discussion on slack @jonathanshaw!
Yeah, it's much clearer the way you rephrase the sentence~ thanks.
Updated the IS.
Comment #96
g-brodieiComment #97
g-brodieiProviding patch base on the approach to:
1. Use the default language instead of browser language when user accounts preferred language is not set.
2. Use the preferred language when it's set, assure the reset URL respects it.
3. Set the langcode correctly from submitForm() in UserPasswordForm.php
Notice:
1.The method $account->getPreferredLangcode() will automatically fallback to the site's default language by it's default. It will only return empty string when the argument passed in is false. therefore, we don't need to set a condition check in submitForm().
Updated IS on task to do.
Comment #98
g-brodieiComment #100
jonathanshawYay! Looking good.
Do we need to do this at all? Can't we leave it to _user_mail_notify() to handle langcode entirely?
There's quite a lot of repetition in this test. It feels like either (a) it should be 3 different tests, with some shared logic in setUp() and some helper methods, or (b) it needs an @dataProvider.
Let's assert what it does contain as well.
Extra spaces at end of line I think
spelling "language"
I find it curious this does not use $resetURL, maybe there's a good reason.
Comment #101
jonathanshawComment #102
g-brodiei1. Removed $langcode from formSubmit() as we do not need it to make use of preferred_langcode from account, it is determined automatically within _user_mail_notify. (Thanks for the suggestion! totally missed that.)
2. Combined repeated code to two helper method to help with assertion.
3. Fixed coding standard, removed empty space.
Comment #103
jonathanshawIt would be so much easier to understand the intention of the test.
I'm not familiar with language testing, but I'm surprised if these lines are needed. The test isolation is usually pretty good even without explicit resetting like this.
spelling: 'language' not 'lanugage'
Comment #104
g-brodieiFinally got this into a dataprovider, just too many variables mixed together LoL!
Gonna cross my finger and see how this one goes!
1. Removed repetitive code from test, and use dataprovider to loop through all assertions.
2. Removed final config reset of language.negotiation and prefixes.
Comment #105
g-brodieiComment #107
paulocsComment #108
paulocsI got:
when applying patch #104 so I'm attaching new patch to fix code standard.
Except that, I think patch fixes the problem and it looks good to me.
Comment #109
g-brodieiAhhhh! Coding standards! The spaces, thanks @paulocs!
Comment #110
jonathanshawNice!
Should preferred langcode really be the string
'null'
? I'd have expectedIn which case there's no need for $actualPreferredLangcode at all, you can simpy do
Comment #111
g-brodieiComment #112
g-brodieiWow, thanks for the suggestion @jonathanshaw ! The code looks much cleaner now
Thanks for pointing out the NULL settings for preferred language. For this, under the suggestion you made to remove $actualPreferredLangcode, I changed the test below for preferred langcode to set as an empty string instead of 'null' string.
1. Made change base on suggestions of #110
2. Update test description in dataprovider to fit each scenario
Comment #113
g-brodieiComment #114
jonathanshawComment #116
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedHere I have fixed failed test of patch #112.
Comment #117
jonathanshawThanks @ravi.shankar
Comment #119
jonathanshawLooks like we need to chase HEAD.
Comment #120
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedFixed failed test of patch #116.
Comment #121
quietone CreditAttribution: quietone as a volunteer commentedI just skimmed the patch and notices a missing doc bloc.
Needs a doc bloc.
Leaving novice tag for this work. If you make this change remember to remove the novice tag. thx.
Comment #122
ayushmishra206 CreditAttribution: ayushmishra206 at OpenSense Labs commentedComment #123
ayushmishra206 CreditAttribution: ayushmishra206 at OpenSense Labs commentedComment #124
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedAddressed comment #121.
Comment #125
jonathanshawThanks!
Comment #126
alexpottThis is the only place in core that passes in a langcode that is not the preferred langcode. This issue seems to suggest that all email should be sent to a user with their preferred langcode - which makes sense to me. We should file a follow-up to discuss deprecating this argument.
This is not necessary. We're rebuilding the container in the next line.
I think adding the assert functions makes it harder to work out what is being tested. Generally we should only add assert functions when they are called multiple times like in a loop and that's not happening here.
Given the two assertSame()s the assertNotSame seems superfluous.
Comment #127
Gábor HojtsyI cannot think of why we decided in #82499: Email text posting in the user's language to send the pw reset email in the page language. The only case would be if new users are not saved with the right (page language) code when they get created. Then you would get the wrong email if we use the user preferred langcode. But I believe that is not the case, so this behaviour change is definitely good.
Comment #128
g-brodieiUpdated test code base on #126, thanks!
Comment #129
jonathanshawI created #3186752: Deprecate langcode argument to _user_mail_notify() for the deprecation.
Comment #130
jonathanshawComment #131
alexpottUpdating credit for reviews that made reviews that affected the patch.
Comment #132
alexpottCommitted and pushed a719eefbf1 to 9.2.x and b2984279e6 to 9.1.x. Thanks!
Comment #136
Utilvideo CreditAttribution: Utilvideo commentedHi, about this patch, we on anonymous always send English mail (EN is default, but page is current language is RO)
Comment #137
jonathanshawThis issue is closed. Please open a new issue if you have a bug to report or feature to request.
Please state clearly (a) what the current behaviour is and (b) what you think the behaviour should be.