janizde/WP-Opening-Hours

Widgets / plugin uses site's locale, not user's locale

ElectricFeet opened this issue · 4 comments

On the back end, the Opening Hours plugin incorrectly uses the site's locale rather than the user's.

For example, I'm designing an Italian site, but Italian is my second language. My mother tongue is English. I work 10 times slower in Italian than I do in English. The site needs to be in Italian, of course. Since WP 4.7, WordPress allows the user to set their own language in the user profile. Mine is set to GB English, but in the context of this bug, I tried both en_US and en_GB: the results are the same.

This is what I see with the Opening Hours widget:

Screenshot 2020-01-05 at 21 08 27

You can see on the left, the choice of WordPress/other plugin's widgets are in English apart from the Opening Hours widget. In addition, the Opening hours widget panel texts are all Italian. (Both with the exception of a few strings that haven't been translated yet.)

It looks like the plugin is picking up the site's locale (which in my case is Italian), not the user's locale.

I'm not sure how to fix the plugin, but the details on user locales are here: https://make.wordpress.org/core/2016/11/07/user-admin-languages-and-locale-switching-in-4-7/

Thanks for the extensive explanation, I will take a look

Fixed in 6f4ab8d will be part of 2.2.1

Thanks for reporting!

Yay! Thanks @janizde !

Hi @janizde . I spoke too soon. I just spotted that the backend panel is still in the site's locale, rather than the user's.

Screenshots:

Screenshot 2020-01-20 at 19 01 25

Screenshot 2020-01-20 at 18 59 13