Search code examples
htmltranslationmediawikitableofcontents

MediaWiki Table of content wrong language bug


<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
    <div id="toc" class="toc">
        <div id="toctitle">
            <h2>Inhaltsverzeichnis</h2>
        </div>
        <ul>
            <li class="toclevel-1 tocsection-1">
                <a href="#Special_features">
                    <span class="tocnumber">1</span>
                    <span class="toctext">Special features</span>
                </a>
            </li>
            <li class="toclevel-1 tocsection-2">
                <a href="#Importance_for_search_engine_optimization">
                    <span class="tocnumber">2</span>
                    <span class="toctext">Importance for search engine optimization</span>
                </a>
            </li>
            <li class="toclevel-1 tocsection-3">
                <a href="#Web_links">
                    <span class="tocnumber">3</span>
                    <span class="toctext">Web links</span>
                </a>
            </li>
        </ul>
    </div>
</div>

My table of contents seems to have a weird problem. Whenever I am logged in to my English wiki, it displays correctly as "content". As soon as I am logged out, it displays as "Inhaltsverzeichnis" which is German. It seems to get that info from my browser.

Languages are saved in my wiki/languages/i18n/ files.

Has anyone got a clue why this is happening?


Solution

  • IIRC, the most common cause is that the system message containing the translation of the TOC title is cached in the wrong language. Ensure you configured the caches correctly: https://www.mediawiki.org/wiki/Manual:Cache

    To find out where the problem lies, use eval.php to query with \Cdb\Reader::open and MessageCache, as in https://phabricator.wikimedia.org/T131981#2186195