WordPress.org

Make WordPress Core

Opened 16 months ago

Last modified 7 weeks ago

#43700 new enhancement

Language switcher on the login screen

Reported by: johnbillion Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: I18N Keywords: has-patch needs-testing
Focuses: Cc:

Description (last modified by johnbillion)

Since [41692] it's possible to control the language of the login screen using the wp_lang query variable (eg. wp-login.php?wp_lang=it_IT). This is a hidden feature that's only used by the interim login modal.

A language switcher should be introduced on the login screen that makes use of this so users can use the login screen, the password reset screens, and the registration screen in their own language. The behaviour would be the same as the language choosers that are used elsewhere in core, for example on the General Settings screen and on the Multisite registration screens.

One thing that needs to be considered is how the language persists between screens, how to persist POSTed values such as redirect_to, and whether it should persist in user meta once the user successfully logs in. Suggestions welcome.

Attachments (2)

43700.1.diff (3.1 KB) - added by Nikschavan 16 months ago.
43700.diff (6.2 KB) - added by johnbillion 2 months ago.

Download all attachments as: .zip

Change History (9)

#1 @johnbillion
16 months ago

  • Description modified (diff)

#2 follow-up: @swissspidy
16 months ago

How has this been implemented on WordPress.org?

#3 in reply to: ↑ 2 @netweb
16 months ago

Replying to swissspidy:

How has this been implemented on WordPress.org?

I've not looked at it personally but the code is here: https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login

#4 @Nikschavan
16 months ago

Seems this was the main commit for adding this to WordPress.org - https://meta.trac.wordpress.org/changeset/6677

@Nikschavan
16 months ago

#5 @Nikschavan
16 months ago

  • Keywords has-patch needs-testing added; needs-patch removed

Patch 43700.1.diff is the first pass at adding the language switcher to the login window.

One thing that needs to be considered is how the language persists between screens, how to persist POSTed values such as redirect_to, and whether it should persist in user meta once the user successfully logs in. Suggestions welcome.

This attached patch adds the $_GET parameters to hidden variables so that they are retained after the page is reloaded.
Currently three $_GET parameters are handled interim-login, redirect_to, action.

@johnbillion
2 months ago

#6 @johnbillion
2 months ago

43700.diff is a work in progress patch that continues the work of @Nikschavan. Changes:

  • Ensure the language switcher only appears when there are language choices available
  • Store the selected language in a cookie so it persists between all of the possible login screens and actions
  • Take the cookie into account when determining the user's locale
  • Allow the user to switch to en_US when it's not the site's default language

#7 @swissspidy
7 weeks ago

  • Milestone changed from Awaiting Review to Future Release
Note: See TracTickets for help on using tickets.