- 🇦🇺Australia VladimirAus Brisbane, Australia
Drupal 7 is no loner supported.
Marking as outdated. - 🇨🇦Canada mparker17 UTC-4
Unassigning myself, now that this is Closed (outdated).
The contents of a ShareThis block are generated by the sharethis_block_contents()
function in sharethis.module
. This function implements its own cache for the block contents, which is varied per-path (i.e.: URL), but not per-language. However, certain structures in Drupal, (such as Views, Panels, internal paths, and entities (nodes, taxonomy terms, Commerce products, etc.) made multilingual using the
Entity Translation →
module), have the same path (URL) in all languages.
This means that, when accessing one of these structures (whose path/URL is the same in all languages) for the first time after a cache clear, the cached block contains data (e.g.: the HTML m_title
attribute, containing the title of the page in the current language) for whichever language happened to requested at the time.
For example, suppose we have a Drupal site at http://example.com/
with two languages enabled: English and French, and the ShareThis block enabled on all pages of the site. Suppose we add a view at http://example.com/news
, and we set the title to display as "News & Events" in English, and "Nouvelles et evenements" in French. Suppose we clear Drupal caches, and the first person (whom we will call "Person A") to load the view at http://example.com/news
happens to be accessing the site in French. Because we just flushed caches, this results in a cache-miss, and Person A sees a ShareThis block, whose HTML m_title
attribute is set to "Nouvelles et evenements" (which is the expected behavior); and the fully-rendered (French) HTML is saved to the cache with the key sharethis:sharethis_block:news
. Suppose a different user ("Person B") then tries to access the same view at http://example.com/news
in English. This now results in a cache-hit, and the fully-rendered (French) HTML generated from the earlier request is loaded from sharethis:sharethis_block:news
, and Person B sees a ShareThis block, whose HTML m_title
attribute is set to "Nouvelles et evenements" (which is undesired behavior).
Modify the cache key from sharethis:sharethis_block:$path
to sharethis:sharethis_block:$lang:$path
.
Using our example scenario above, loading the view at http://example.com/news
in French would result in a cache-miss, and the fully-rendered (French) HTML being saved to a key named sharethis:sharethis_block:fr:news
. A subsequent request for the same page in English would also result in a in a cache-miss, and the fully-rendered (English) HTML being saved to a key named sharethis:sharethis_block:en:news
. Subsequent requests to the page in either language will result in cache-hits for the appropriate language, until caches are cleared again.
None.
None.
Cache key changes from sharethis:sharethis_block:$path<code> to <code>sharethis:sharethis_block:$lang:$path
.
Closed: outdated
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Drupal 7 is no loner supported.
Marking as outdated.
Unassigning myself, now that this is Closed (outdated).