Skip Navigation

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.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Dražen 1 year, 7 months ago.

Assisted by: Dražen.

Author Posts
September 5, 2023 at 2:51 am #14339589

Kulatuch Suwattanapunkul

Tell us what you are trying to do?
When changing default language from English to Thai, there is no change in site language of the entire site shown on wordpress Settings page

Is there any documentation that you are following?
Tried many forums on wpml website, not successful

Is there a similar example that we can see?

What is the link to your site?
hidden link

Screenshot 2566-09-05 at 09.50.42.png
Screenshot 2566-09-05 at 09.48.11.png
September 5, 2023 at 6:47 am #14340123

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for contacting us and reporting this.

This small cosmetic glitch has already been reported to our team, and we are looking into it.

I will update you when there is more news or fix is released.

Note this does not cause any issue other then cosmetic/visual differences.

Regards,
Drazen

September 5, 2023 at 7:45 am #14340483

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02: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,
Drazen