r60888 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60887‎ | r60888 | r60889 >
Date:10:40, 10 January 2010
Author:raymond
Status:ok (Comments)
Tags:
Comment:
* Send new password e-mail in users preference language
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -727,10 +727,10 @@
728728 $np = $u->randomPassword();
729729 $u->setNewpassword( $np, $throttle );
730730 $u->saveSettings();
731 -
732 - $m = wfMsgExt( $emailText, array( 'parsemag' ), $ip, $u->getName(), $np,
 731+ $userLanguage = $u->getOption( 'language' );
 732+ $m = wfMsgExt( $emailText, array( 'parsemag', 'language' => $userLanguage ), $ip, $u->getName(), $np,
733733 $wgServer . $wgScript, round( $wgNewPasswordExpiry / 86400 ) );
734 - $result = $u->sendMail( wfMsg( $emailTitle ), $m );
 734+ $result = $u->sendMail( wfMsgExt( $emailTitle, array( 'parsemag', 'language' => $userLanguage ) ), $m );
735735
736736 return $result;
737737 }
Index: trunk/phase3/RELEASE-NOTES
@@ -295,6 +295,7 @@
296296 equivalents.
297297 * (bug 22051) Returing false in SpecialContributionsBeforeMainOutput hook now
298298 stops normal output
 299+* Send new password e-mail in users preference language
299300
300301 === Bug fixes in 1.16 ===
301302

Comments

#Comment by Nikerabbit (talk | contribs)   15:16, 10 January 2010

From wfMsgExt documentation:

*   language: Language object or language code to fetch message for
*       (overriden by content), its behaviour with parser, parseinline
*       and parsemag is undefined.

Which one is wrong, the wfMsgExt code or documentation?

#Comment by Raymond (talk | contribs)   15:20, 10 January 2010

Hmmm. At least the combination works on my local testwiki as I expected: The e-mail is sent in users pref language and MediaWiki in the e-mail subject is parsed.

#Comment by Raymond (talk | contribs)   15:21, 10 January 2010

Sorry, should read:

Hmmm. At least the combination works on my local testwiki as I expected: The e-mail is sent in users pref language and {{SITENAME}} in the e-mail subject is parsed.

#Comment by Nikerabbit (talk | contribs)   15:25, 10 January 2010

The important thing here is to test whether GRAMMAR and PLURAL work and use the correct language.

#Comment by Raymond (talk | contribs)   17:22, 10 January 2010

GRAMMAR and PLURAL tested. They work and use the correct language.

#Comment by Bryan (talk | contribs)   20:48, 10 January 2010

If the behaviour is undefined, it might as well change in the future, breaking this stuff.

#Comment by Raymond (talk | contribs)   21:13, 10 January 2010

I read the code of GlobalFunctions::wfMsgExt now (again) and I cannot see why the behaviour should be undefined. Line 838

	$string = wfMsgGetKey( $key, /*DB*/true, $langCode, /*Transform*/false );

is executed unconditioned.

Could someone pls elaborate why the combination of 'language' with 'parse', 'parseinline' or 'parsemag' should fail?

#Comment by Nikerabbit (talk | contribs)   21:18, 10 January 2010

For parsemag it can work (should update the documentation for that), but for parse and parseinline it doesn't work.

Status & tagging log