Topic on Project:Support desk

Why is the request language not used

10
Summary by MarkAHershberger
Ken Roy (talkcontribs)

Why does wiki/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php not use the language that the request was created in?


The following at lines 445-446

       $userLanguage = $user->getOption( 'language' );

       $subjectMessage = wfMessage( 'createaccount-title' )->inLanguage( $userLanguage );


but the request approved email is being issued in English only - the wiki's language.

I had a similar issue with the ConfirmAccount email requesting that the user confirm their email until I changed wiki\extensions\ConfirmAccount\includes\backend/ConfirmAccount.class.php

line 1141 to use

       global $wgContLang, $wgLang;

and changed line 114

       $lang = $user->getOption( 'language' );

to

       $lang = $wgLang->getCode();


When I attempt a similar change in

wiki/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php


I get no email at all, so I am likely introducing a fatal error. Why does

$user->getOption( 'language' );

not get the language that the request was created in?


Thanks in advance for any help on this

MarkAHershberger (talkcontribs)
Ken Roy (talkcontribs)

Thanks Mark,

Maybe but I do not have a login there and may not know what your requirements are. May take me a while to figure out what your requirements are on that site.

I am an old IBM assembler programmer and technology planner so I am sure I will eventually figure it out.

Was initially surprised that the account approval email was not coming from the ConfirmAccount extension

MarkAHershberger (talkcontribs)

You can log in with your MediaWiki.org login, so at least there is that.

After that, I would just file a task that has a title like "TemporaryPasswordPrimaryAuthenticationProvider does not use the language that the request was created in."

If you link it here or add me on the task itself, I can help out more.

Ken Roy (talkcontribs)

Thanks Mark,

I created https://phabricator.wikimedia.org/T272659

I forgot to mention that I am willing to test a fix.

I may open another task for the similar problem in the ConfirmAccount/includes/backend/ConfirmAccount.class.php since I am not sure that my change is the correct fix and if it is, it should be incorporated into the Extension:ConfirmAccount

Thanks for your help.

MarkAHershberger (talkcontribs)

Thank YOU!

It's good to have more people looking at these things and pinpointing possible problems. Feel free to create as many tasks/bugs as you need and submit patches to them (if you don't want to worry about getting gerrit access).

Ken Roy (talkcontribs)
Ken Roy (talkcontribs)
Bawolff (talkcontribs)

Well that code is for the user's language not the request language - there are some extensions that set that on user creation but thats not default

Ken Roy (talkcontribs)

Thanks Bawolff,

Your response is a bit too cryptic for me. We are using the LanguageSelector extension so the user can create their Request Account in their native language and avoid misunderstandings like not confirming their email address because the do not read English. With the change I made to the ConfirmAccount code I can now get the requestaccount-email-body message that they confirm their email address issued in the same language they used to request their account. As indicated in https://phabricator.wikimedia.org/T272663 I am not sure that is the correct way to do it. I was an IBM Assembler system software developer not a PHP programmer.

However, I am not able to get the TemporaryPasswordPrimaryAuthenticationProvider.php to issue the createaccount-text from thte correct language json file in languages/i18n/

So how would I change the code in the TemporaryPasswordPrimaryAuthenticationProvider.php to get the createaccount-text message issued in the same language that was used to submit their request for an account?

Reply to "Why is the request language not used"