The answer

window.disqus_config = function() {
	this.language = '{{ .Lang }}';
}

Why use window.disqus_config?

According to the Disqus’ help page, we can override the language by adding this.

var disqus_config = function () {
	this.language = "ja";
};

So basically the following JavaScript works.

var disqus_config = function () {
	this.language = '{{ .Lang }}';
};

However, the variable disqus_config doesn’t work with --minify option because Hugo changes the name.

To solve it, you can use a window object instead.

var disqus_config = function () {
	window.disqus_config = '{{ .Lang }}';
};

Reference:

Global object - MDN Web Docs Glossary: Definitions of Web-related terms | MDN
developer.mozilla.org
A global object is an object that always exists in the global scope.

By the way…

Hugo has a Disqus template, and it was using var disqus_config so I sent a pull request. I was happy because it’s my first contribution to OSS.

Change `disqus_config` to `window.disqus_config` by Akimon658 · Pull Request #9550 · gohugoio/hugo
github.com
The variable disqus_config doesn't work if we use hugo --minify because Hugo changes the name. We can use window.disqus_config instead, and it won't be renamed. Reference: https://developer.mozilla...