Problem/Motivation
Hello,
Localization support does not work in disqus. This bug is super old and has never fixed. There is another issue similar opened 7 years ago for another disqus version with another solution (but similar).
Localization support does not work with some languages, like spanish.
Steps to reproduce
Just install disqus in a webpage with content in english and spanish (for example). In spanish, the browser will through an error (F12):
“https://c.disquscdn.com/next/current/embed/lang/es.js” does not exist.
Proposed resolution
modify /modules/disqus/src/Element/Disqus.php
// Provide alternate language support if desired.
if ($disqus_settings->get('behavior.disqus_localization')) {
$disqus['language'] = \Drupal::languageManager()->getCurrentLanguage()->getId();
+ if($disqus['language']=='es') {
+ $disqus['language']='es_ES';
+ }
Or, maybe we can talk to Disqus and ask to copy https://c.disquscdn.com/next/current/embed/lang/es_ES.js to https://c.disquscdn.com/next/current/embed/lang/es.js
Thanks for your time and support.
Luis
Comments
Comment #2
gaurav.kapoor commented@luison Thanks for reporting this issue. As per https://help.disqus.com/en/articles/1717203-multi-lingual-websites, Disqus only support languages which are mentioned on https://www.transifex.com/disqus/disqus/ and it doesn't have any support for 'es' language code. I don't know how we can suggest to Disqus to include support for more languages but we can modify the logic here in Drupal to always pass correct language code to the Disqus JS file.
Maybe we can create a configuration where user can provide the language code they want to set for all the enabled languages in the website. But that might be too much of work here. I am thinking of updating documentation or providing a way of altering the language code so that we don't get 404 errors.
Comment #3
gaurav.kapoor commented