WordPress.org

Make WordPress Core

Opened 2 weeks ago

Last modified 3 days ago

#54761 new enhancement

Save the prefered language from login page (since WP5.9)

Reported by: sebastienserre Owned by:
Milestone: 6.0 Priority: normal
Severity: normal Version: trunk
Component: Login and Registration Keywords: needs-patch 2nd-opinion
Focuses: administration Cc:

Description

Hello,

On WP5.9 a language switcher is added in the wp-login.php. Here is the dev note by @audrasjb https://make.wordpress.org/core/2021/12/20/introducing-new-language-switcher-on-the-login-screen-in-wp-5-9/

I think it should be great if choosing a language here will update the Language user meta to display the back-office in the same language as previously chosen.

As per 1st test made, this doesn't currently update.

Change History (10)

#1 @swissspidy
2 weeks ago

Interesting idea! Personally, for me as a user that would be a bit unexpected. For example Facebook does not do this either.

It would be good to collect some user feedback on this and compare with other platforms.

#2 @sebastienserre
2 weeks ago

Yes, good idea to collect feedbacks.
In my mind it's logical, I select a language to log in... why once logged in I have another language served ?
That's not because others do something, it's the truth (IMO).

#3 @Webaxones
2 weeks ago

I hadn't seen that this choice was limited to the login page, and I really wonder about the logic behind such a choice: who wants to specify a language for the login page and stay in another on the administration?
This is not a criticism but a question :)
As a user, if I change the language, I want it to be used everywhere. My multilingual clients too. Otherwise I will have to deactivate this option because they will not understand it.

#4 @swissspidy
13 days ago

who wants to specify a language for the login page and stay in another on the administration?

That‘s not the idea behind this.

Let‘s say my user language here on WordPress.org is Spanish.
I want to log in, but the login page is in English, so I change the language there to Spanish so I better understand it.

Now, it could be that I don‘t really want to change the language on the login page since it’s just two form fields that I am familiar with, so I leave it in English.
So I log in regardless.
My user language in the admin should still be Spanish.

I hope this little example shows that this ticket isn‘t as straightforward as one might think.

#5 @sebastienserre
13 days ago

I agree with you @swissspidy.
If the Spanish is set in the user profile, and we chose the Spanish in the login page, we do not change anything.
We'll just change the user profile if the language stored in the meta is different from the language selected on the login page.

#6 @uzumymw
13 days ago

In my opinion, changing the language on the login page should have an impact to back-office too (for the entire session). Otherwise what's the point of this option? Only for translate fields on login page?

#7 @costdev
13 days ago

  • Milestone changed from Awaiting Review to 6.0

We'll just change the user profile if the language stored in the meta is different from the language selected on the login page.

If you mean the usermeta, this won't address @swissspidy's point. See these results.

Instead, we would need to change the user profile if the site's language is different from the language selected on the login page. See these results.

Note: With this implementation, if a user wants to switch back to the site's language, they would need to make the change in their profile.


In general, matching a user's stated preference to their usermeta makes sense to me.

Milestoning for 6.0 and adding needs-unit-tests to prevent regressions once this has been implemented.

#8 @sebastienserre
11 days ago

Hello,

I can try to write a patch for this but in which Core file do you think it should be the more relevant ?

Thank you for your help.

#9 @sebastienserre
4 days ago

Hello,

In my mind, we have 4 cases, but I can miss some...

Site_lang === Profile_lang ===login_lang => return, nothing to do
Site_lang === Profile_lang !==login_lang => update Profile_lang
Site_lang !== Profile_lang ===login_lang => return, nothing to do
(Site_lang !== Profile_lang !==login_lang => update Profile_lang)

Do I miss some cases ?

Last edited 3 days ago by sebastienserre (previous) (diff)

#10 @costdev
4 days ago

Hi @sebastienserre,

The first three cases are accurate, but the fourth is incorrect IMO. We should not update Profile_lang in the fourth case.

See @swissspidy's example case for the expected behaviour and these results for how this can be achieved.

Last edited 4 days ago by costdev (previous) (diff)
Note: See TracTickets for help on using tickets.