Contido
Fixing CComment and Joomla multilanguage site problems.
Recently I had to install the CComment extension in a perfectly working Joomla multilanguage web site. Apparently, after the installation all was fine and no problems can’t be observed but, a day later, the site owner informs that the web homepage was always showed in English (and the posterior pages as well) no matter what was the language used or defined as default.
Troubleshooting
The first analysis showed that the problem only arose after visiting a page with comments in it, therefore it looked as the culprit was CComment. Also, the homepage link wasn’t including any language specification, i.e. the language was obtained form the correspondent language cookie created by Joomla. The problem showed up with SEF enabled and disabled.
One first look at the language cookie manifested that the language changed to en-GB every time we visited a page with CComment displaying its form, with or without comments, and even after publishing a comment without reloading the page. It seemed that some XHR was changing the cookie language.
Monitoring the URL calls with the browser developer tools showed one XHR to:
https://www.website.com/?option=com_comment&task=comments.getcomments&format=json
&lang=en&contentid=#&component=com_content&start=1
The problem was here most probably.
Debugging and fixing
The file calling that URL was:
https://www.website.com/media/com_comment/js/v6/store/index.min.js
Searching in the code of this file we can see this:
jQuery.ajax(t.baseUrl+"?option=com_comment&task=comments.getcomments&format=json&lang=en&contentid="+n.contentid+"&component="+n.component,
{dataType:"json",data:o}).done(function(o){
jQuery.ajax(t.baseUrl+"?option=com_comment&task=comments.getcomments&format=json&contentid="+n.contentid+"&component="+n.component,
{dataType:"json",data:o}).done(function(o){
And, in fact, after that, all the tests went right. Then, error fixed.
comments powered by Disqus