This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic is split from https://wpml.org/forums/topic/localization-mismatch-when-updating-with-infinitewp-wp-management-software/
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - |
- | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | - |
Supporter timezone: Europe/Zagreb (GMT+01:00)
Tagged: Bug
This topic contains 15 replies, has 2 voices.
Last updated by Dražen Duvnjak 1 year, 2 months ago.
Assisted by: Dražen Duvnjak.
Author | Posts |
---|---|
September 4, 2023 at 8:43 am #14334581 | |
John-Pierre Cornelissen |
Yes please escalate, because that absolutely doesn't make any sense at all. The WP settings language is the default SITE language for everything on the front end and there is onlye one such setting. The WP user settings are for everything on the backend, depending on the language in which each user prefers to work with WP. There could be 5 different users in WP all having a different language. So that clashes with the single wp site language setting. There is a single WPML default site language and a single WP defailt site language and they should be mapped to each other. User languages shouldn't have anything to do with that at all. I am in the Netherlands, so default WP Site language is always Dutch. However, I prefer to work with WP in US English, because the standard language of themes and plugins is usually English, to get support you need their English terminology and they are often automatically (and badly) translated to Dutch. So, I work in English, but the default site language has to stay in Dutch, it should never change to my user language. |
September 4, 2023 at 8:55 am #14334631 | |
Dražen Duvnjak Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+01:00) |
Hello, I have now escalated this ticket to our 2nd tier support for further check and advice. I will update you as soon as I have some news. Regards, |
September 4, 2023 at 9:32 am #14334959 | |
John-Pierre Cornelissen |
Ok thank you for your help. To be clear about this, the underlaying problem with the issue mentioned in this new ticket is that when the WP site language doesn't match with the WPML local, you get an error "Localization mismatch" when you update WordPress by using WP management software such as infiniteWP (when you google for that error you also find it for ManageWP). |
September 4, 2023 at 9:55 am #14335131 | |
Dražen Duvnjak Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+01:00) |
Hello, thanks, As for the settings our 2nd tier confirmed that is expected, but the error you get is not, and it could be a compatibility issue with the mentioned plugin. I am trying to reproduce this with ManageWP, so I can escalate this to our compatibility team, but it works fine for me. - I have a user profile (WP Settings) in Dutch and WPML default language to Spanish I am providing a test site, please set it up and try to reproduce the issue and share step by step guide so we can confirm it also. - hidden link Thanks, |
September 4, 2023 at 11:00 am #14336009 | |
John-Pierre Cornelissen |
What do you mean the settings is as expected? It is not expected from a user perspective. What a user expects, is that the WP site language is the same as the default language set in WPML. For one, because if you use WPML, you can't change the site language in the WP settings, there is a link that directs you to the WPML language settings. And if you change it there, it is not changed accordingly in the WP settings, as you would expect. What you certainly do not expect is that it's changed when you change the user language. So like I said before, it has nothing to do with the language in the user profile. Now as for the issue, this is what I had So I had en_US in the WP settings and en_GB in the WPML languages table (where you edit the languages). The problem was solved after changing en_GB to en_US and clearing the cache. I don't know if it can be reproduce with ManageWP, what I said is that when I Googled for that error I came across a piece of code that contains that error. See attached. If I am not mistaken, it's WP that returns that error for some reason, and I believe the above is why. I found this from manageWP And this from InfiniteWP |
September 4, 2023 at 12:07 pm #14336443 | |
Dražen Duvnjak Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+01:00) |
Hello, I am trying to say that the option is disabled and does not affect locale or WP settings in any way. Nor does that setting affect or cause that error. I have tested and tried to reproduce the issue on my side to further proceed on this, but I can not, as the same doesn't happen. Locale stays the same as the WPML default language. On why it happens, on your side I can not say, it could related to some other plugin or custom code. So, the only way for us to proceed and help you out here is if you can help us out-reproduce the issue so I can escalate it to our compatibility devs, and then will be glad to help out if we can or contact the author to work with us on solving the issue with mentioned plugin. Hope you understand. Regards, |
September 4, 2023 at 12:38 pm #14336801 | |
John-Pierre Cornelissen |
Here is a screen recording of how to reproduce: hidden link 1. Go to WP Settings, you see the Site default = English US Not changing it in the WP Settings might work for WPML and the published page, but other software has issues with that as it somehow causes a mismatch in the settings somewhere, resulting in the error as mentioned in the other topic. Don't ask me how, I am a user and I don't know anything about the inner workings of WP and WPML. |
September 4, 2023 at 12:53 pm #14336973 | |
Dražen Duvnjak Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+01:00) |
Hello, thanks for getting back. I understand that part, but I am trying to say that this option is false positive, it does not change anything or any WP settings in reality. If you check the DB value, WP lang stays the same as it is set from the WPML default language so that part doesn't affect your language setting in such way you described. Nor it can cause issue in a change in the locale, which is also why it works fine with ManageWP when I checked and it is not reproduced. You are free to check the option table and WPLANG value. Hope this makes it more clear. Regards, |
September 4, 2023 at 1:18 pm #14337117 | |
John-Pierre Cornelissen |
The problem IS that WPLANG stays the same. It should NOT stay the same it should change to the one you set as default in WPML, to ensure both have the same value. Please focus on the issue in this ticket. Forget about the issue from the other ticket and forget about ManageWP. If you change the default in WPML settings, it should change it accordingly in the WP settings. That's what you would expect. Both are about the default language and it's confusing to have different values there. It can and should be a one on one relationship. Besides that, it absolutely doesn't make any sense to change WPLANG based on the user language. WP doesn't do that not should WPML. |
September 5, 2023 at 6:05 am #14339965 | |
Dražen Duvnjak Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+01:00) |
Hello, that is what I am trying to say WPLANG stays the same as the one set in the WPML default language, and changes also depending on that. As said I have tested and confirmed this on the test site. The option you see in WP Settings > Language is disabled and has no effect on WP Lang, no matter what it says there, the WP Lang value is still the same in DB, and always the same as the WPML default language. Hope this makes it clear, From our side I can check with our team if can fix this UI visual bug and maybe further hide or set for value to show the correct one from WP Lang DB. Regards, |
September 5, 2023 at 6:50 am #14340131 | |
Dražen Duvnjak Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+01:00) |
Hello, just to update you, I had further discussion with our team, and we are escalating this cosmetic issue for further debugging. I will update you soon when I have more news. Regards, |
September 5, 2023 at 7:45 am #14340485 | |
Dražen Duvnjak Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+01:00) |
Hello, this issue has been escalated to our devs team and will be fixed in one of the next versions. In the meantime you can use the next workaround: in \wp-content\plugins\sitepress-multilingual-cms\classes\utilities\class-wpml-locale.php change public function locale() method to: public function locale() { //if ( ! $this->locale_cache ) { add_filter( 'language_attributes', array( $this, '_language_attributes' ) ); $wp_api = $this->sitepress->get_wp_api(); $is_ajax = $wp_api->is_ajax(); if ( $is_ajax && isset( $_REQUEST['action'], $_REQUEST['lang'] ) ) { $locale_lang_code = $_REQUEST['lang']; } elseif ( $wp_api->is_admin() && ( ! $is_ajax || $this->sitepress->check_if_admin_action_from_referer() ) ) { $locale_lang_code = $this->sitepress->user_lang_by_authcookie(); $debug = debug_backtrace(); foreach ($debug as $frame){ if($frame["function"] == "get_locale" && str_ends_with($frame["file"],"options-general.php")) { $locale_lang_code = apply_filters('wpml_default_language', NULL ); } } } else { $locale_lang_code = $this->sitepress->get_current_language(); } $locale = $this->get_locale( $locale_lang_code ); if ( did_action( 'plugins_loaded' ) ) { $this->locale_cache = $locale; // } return $locale; } return $this->locale_cache; } Regards, |
September 5, 2023 at 8:27 am #14341033 | |
John-Pierre Cornelissen |
Thank you, I has a look in the database at WPLANG and WPML doesn't do anything with it. If I change the language in WPML, it doesn't change WPLANG. The visual aspect of the language in WP settings is that it takes the user language, looks up that local in the WPML language table and then uses that to display it in the WP settings. Meaning, the WP settings show the local of the current user in stead of the actual site default language. I recorded a video to show you what I found: hidden link What should happen in my opinion: 1) When you change the default language in WPML, it should update WPLANG accordingly. Thanks |
September 5, 2023 at 8:58 am #14341589 | |
Dražen Duvnjak Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+01:00) |
Hello JP, I am not sure if you have missed my latest few replies. Let me try to clear things up here and keep this ticket on topic. The cosmetic issue you reported has been escalated to our devs. 1) I have escalated that issue and shared a workaround. WP Settings now shows the same settings as in the WPML default language. Video: hidden link 2) WPLANG does change when the WPML default language is changed - hidden link 3) If you experience a different behavior, I would advise checking this in minimal (WP Default theme and only WPML plugins) and trying to reproduce it on a fresh install. If you still have the same issue, then we would need to further debug this. You can open a new ticket for this or I can open one for you and we will proceed to help further there, since this one is already escalated and connected to a related issue with WP settings, which we provided a workaround for. Regards, |
September 5, 2023 at 12:43 pm #14344365 | |
John-Pierre Cornelissen |
Thanks, yes I did receive your replies shortly after I posted mine. So I checked the WPLANG in my test site with the default theme and all plugins except WPML disabled. WPLANG doesn't change, here is a video: hidden link I checked a few other sites. Most do change WPLANG like you said and I found one live site where it doesn't change either. Now I am not so sure anymore if this issue is relates to the "Localization mismatch" issue. 😳 Lets keep this ticket for the visual issue, and I'll wait to see what happens with the next WP update. Thank you for your help. |