-
Notifications
You must be signed in to change notification settings - Fork 51
Plugin activation switches user-locale partly #746
Description
Describe the bug
copied from GatherPress slack:
🐛 🚨 The plugin is doing something weird with the locale!
When I toggle activation of GatherPress under wp-admin/plugins.php , the half of my UI changes to English, while my current user has set German under wp-admin/profile.php.
Going through the plugin "line by line" has lead me to add_action( 'admin_print_scripts', array( $this, 'add_global_object' ), PHP_INT_MIN ); as the causer.
Ok, wp_timezone_choice at line 100 in class-utility.php is the reason:
$timezones_raw = explode( PHP_EOL, wp_timezone_choice( 'UTC' ) );
GatherPress can fix this by looking at WordPress core at https://github.com/WordPress/wordpress-develop/blob/c3e1d3a8b8c2393ce8d6d50cededbea479516b8e/src/wp-admin/options-general.php#L345-L371
which is a little more accurat on the default timezone string as GatherPress is right now.
Being not that accurate might be a problem in the future.
Steps to Reproduce
- Have English selected in Settings > General as Site language.
- Edit your user profile, choose a different language for your user and save!
- See the main admin menu changed into your users language.
- Go to Plugins and toggle the activation of the plugin on and off.
A. Plugin not activated: Admin Bar is translated into your users language
B. Plugin activated: Admin Bar is NOT translated, shows in English
Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress information
No response
Code of Conduct
- I agree to follow this project's Code of Conduct