With entity translation and socialmedia share, the link that gets shared is not the translation of the page being viewed, but rather a different language. In my case, the link being shared is the Spanish translation, even though the user is viewing the English version of the page. The site default language is English.

For example, on the page

https://www.exposenewsnetwork.com/news/2013/06/05/turkish-protestors-arr...

the Facebook share link produced is

http://www.facebook.com/sharer.php?u=https://www.exposenewsnetwork.com/e...és-de-incitación-al-odio&t=Manifestantes%20turcos%20detenidos%20después%20de

The google share link is

http://www.google.com/bookmarks/mark?op=add&bkmk=https://www.exposenewsn...és-de-incitación-al-odio&title=Manifestantes%20turcos%20detenidos%20después%20de

and so on for all social media share buttons.

CommentFileSizeAuthor
#1 widgets-translation-2015221.patch1.19 KBtitouille
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

titouille’s picture

Issue summary: View changes
FileSize
1.19 KB

On the current dev version : version = "7.x-1.0-rc1+0-dev"

I added langcode key into cache_get / cache_get cids and it seems to work correctly for blocks (tested on follow us block) and share (on nodes content). I think it will works for any situations, but tell me if you see other problems. The main problem is widgets are stored in cache to load it quickly, but without notion of language. So when we clear the cache and show page in english, english version is filled in cache and when we navigate on other languages, english version is retrieved from cache. By adding the langcode into cache ID, the system try to retrieve from cache the version with the current language.

Hope this help.

Ho... I saw a "drupal_alter" call into widgets_build_cache_cid function, but I think it's the role of the widget module to be safe with language version to load, not another custom module, but maybe I'm wrong... ?

Alienpruts’s picture

Status: Active » Needs review

Can confirm this patch works, correct url's are seen when using Social Media share button(s).

Great work :)

stewart.adam’s picture

Status: Needs review » Needs work

I'm not sure which file this patch modifies; the file either no longer exists, or exists outside the socialmedia module. Note @titouille that your patch has a local path in it; patches should be generated from Git so that they apply cleanly.

titouille’s picture

I'm sorry stewart.adam but I simply use the basic way to create a patch from macos. The patch modify the "widget.module" file, like you can see on second line.