Opened 9 years ago
Closed 7 years ago
#29362 closed enhancement (maybelater)
More development for wp_dropdown_languages()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0 |
Component: | I18N | Keywords: | has-patch needs-refresh |
Focuses: | Cc: |
Description
wp_dropdown_languages() a new function in WordPress 4.0 .. It seems that it needs more development.. a better fallback to the $args array and more options and sure thing a WP filter!
Attachments (3)
Change History (17)
#3
@
9 years ago
- Keywords needs-refresh added
- Version set to 4.0
Patch needs a refresh. I don't think it needs more options, but I'm open for a filter.
#5
follow-up:
↓ 10
@
9 years ago
I'd like to second a filter. I author the "English WordPress Admin"* plugin and the introduction of wp_dropdown_languages() has made it so that if you hook on the locale filter to change locale to "en_US", the dropdown will have English selected when the user visits options-general.php, so when the user saves the options, he will have changed his site language by mistake.
It may not actually be right to filter the locale when using wp_dropdown_languages() at all, due to aformentioned issues with the settings form.
#7
@
9 years ago
- Keywords dev-feedback added; needs-refresh removed
The code has changed around qite a bit since the patch by @alex-ye, so I made another patch:
Changes
wp_dropdown_languages() is used twice, in option-general.php and in /network/settings.php
In network settings.php, the site locale is correctly fetched from the database. In option-general.php, we call get_locale() instead which doesn't check the database. That's why hooking on the locale filter has unintended consequences, which were outlined earlier here:
https://core.trac.wordpress.org/ticket/29362#comment:5
In the patch, I refactored option-general.php to grab the settings from the database just like the network settings. Feedback appreciated.
PS.
I didn't add a filter, this patch is just for fixing inconsistent behaviour.
#8
@
9 years ago
- Keywords needs-refresh added; dev-feedback removed
get_locale()
is used by design in option-general.php
because it includes the locale
filter, $wp_local_package
, WPLANG
, and get_option( 'WPLANG' )
.
#9
@
9 years ago
@ocean90,
Can you explain a bit more about the thought behind this? Why should the locale filter change the "Site Language" dropdown form? Any plugin hooking on the locale filter would possibly change the value of the dropdown.
#10
in reply to:
↑ 5
@
9 years ago
Replying to khromov:
I'd like to second a filter. I author the "English WordPress Admin"* plugin and the introduction of wp_dropdown_languages() has made it so that if you hook on the locale filter to change locale to "en_US", the dropdown will have English selected when the user visits options-general.php, so when the user saves the options, he will have changed his site language by mistake.
Related: #31318
#11
@
9 years ago
The patch posted above by khormov is still functional to solve the issue as described here and in #31318
#12
@
8 years ago
I tested the patch by khormov and it's working.
I just updated it to reflect the current status of the codebase, because it didn't apply smoothly.
G
I had done a start patch.. I hope it helps :)