qtranslate-xt icon indicating copy to clipboard operation
qtranslate-xt copied to clipboard

Yoast Title and description show both languages (admin)

Open netgfx opened this issue 4 years ago • 14 comments

Hello, not sure if this is the same with https://github.com/qtranslate/qtranslate-xt/issues/850 but I'm seeing this: image (18) Since I upgrated to Yoast 14.8 (and the same remains on 14.8.1)

Is there a solution or should I downgrade until this is fixed? (will it be fixed?)

Thanks.

netgfx avatar Aug 27 '20 12:08 netgfx

Hello,

I have same problem in Yoast 14.8.1.

Libik2019 avatar Aug 29 '20 14:08 Libik2019

it seems that Yoast 14.9 has somewhat improved the issue, title is good now and the language indicators {en} don't show in the edit section, the only thing remaining is the preview that is still busted but it doesn't affect the SEO calculation so I guess this is much better now and we don't have to downgrade

netgfx avatar Sep 03 '20 08:09 netgfx

See also discussions in #794.

herrvigg avatar Sep 05 '20 10:09 herrvigg

	function yoast_seo_qtrans() {
		if(defined('WPSEO_VERSION')) {
			add_filter('wpseo_metadesc', function($str) {
				return __($str);
			}, 10, 1);

			add_filter('wpseo_opengraph_title', function($str) {
				return __($str);
			}, 10, 1);

			add_filter('wpseo_opengraph_desc', function($str) {
				return __($str);
			}, 10, 1);
		}
	}

	add_action('init', 'yoast_seo_qtrans', 1, 10);

	function wpseo_breadcrumb_add_woo_shop_link($links) {
		$newList = array();
		foreach($links as $link) {
			$link['text'] = __($link['text']);
			$newList[]    = $link;
		}

		return $newList;
	}

	add_filter('wpseo_breadcrumb_links', 'wpseo_breadcrumb_add_woo_shop_link');

Tusko avatar Sep 06 '20 09:09 Tusko

what are those? do we need to edit the plugin files or these will go to next release?

netgfx avatar Sep 06 '20 10:09 netgfx

@netgfx it's a hotfix for Yoast SEO for v14+ you can add it to functions.php on your theme

I think developers should add it to the next release

Tusko avatar Sep 06 '20 10:09 Tusko

@Tusko Thank you this fix my Problem!

d-schaffer avatar Sep 10 '20 08:09 d-schaffer

It's a bit difficult for me to follow the Yoast topics, this fix seems to solve a few things but we should handle it better.

The first thing, we should not use __( xx ), this is only meant for static translations of fixed string labels in WordPress (mo/po files). It turns out we have a qTranslate hook linked to this function so you will get a qTranslate call as a bonus, but this is quite an indirect effect. In qTranslate we should use the proper function directly which is qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage (yes the name is very verbose but this might be renamed in the future).

Now in the Yoast module (which certainly requires a lot of work with the new API) we used to have such filters, but they were commented, certainly because they were obsolete or the names have changed. Please check this part: https://github.com/qtranslate/qtranslate-xt/blob/91c51acbf1e77e7eb818738fd771b867036b2e7d/modules/wp-seo/qwpseo-admin.php#L87-L96

It would be nice to fix this properly in this module. Is that enough to change the edit.php section? I don't really know! Could someone take a better look and send a PR?

herrvigg avatar Sep 12 '20 12:09 herrvigg

Let's also sync this with #947.

herrvigg avatar Feb 08 '21 00:02 herrvigg

Indeed the admin part is behaving differently with the last versions of Yoast. The title is translated the first time the page is displayed but it changes as soon as the mouse hovers the text (!). This part requires more work with Javascript for sure, i don't know how to deal with this yet and i won't have time for this.

herrvigg avatar Feb 20 '21 11:02 herrvigg

As a reminder the Yoast module is completely rewritten from scratch (#947) after removing the old one (#794). I don't think the old code would help for this part, but maybe. Currently the admin part is almost empty.

herrvigg avatar Feb 20 '21 11:02 herrvigg

As a reminder the Yoast module is completely rewritten from scratch (#947) after removing the old one (#794). I don't think the old code would help for this part, but maybe. Currently the admin part is almost empty.

i've installed the last version with Yoast module, but i see the 2 language in the preview. it occur also in production or only in the admin part ? and also there is a little guide to setup yoast with qtranslate-xt ?

Thanks in advance.

hacaro76 avatar Feb 22 '21 13:02 hacaro76

On the latest Qtranslate-xt and latest yoast this is still happening.

netgfx avatar May 28 '21 12:05 netgfx

On the latest Qtranslate-xt and latest yoast this is still happening.

I have same issue

moonikun9z avatar Jun 21 '21 15:06 moonikun9z