Update to 3.0: Second language templates not updated

  • Affected App
    WoltLab Suite Core


    first thanks for the nice release, the look&feel improved a lot.

    I'm not sure if my problem can be classified as bug, as it is really hard to reproduce. But I am leaving it here if others are running into the same issue.

    monitoring-portal.org did have German and English languages installed with WBB 4.1 (WCF 2.1). The upgrade to Woltlab Suite Core 3.0 and Forum 5.0 went smooth but it seems that it did not fully upgrade the English language files.

    4.1.12 WCFSetup/install/lang/en.xml includes the {literal} tags.

            <!-- variables for dynamic javascript datetime -->
            <item name="wcf.date.relative.now"><![CDATA[A moment ago]]></item>
            <item name="wcf.date.relative.minutes"><![CDATA[{literal}{if $minutes > 1}{#$minutes} minutes{else}A minute{/if} ago{/literal}]]></item>
            <item name="wcf.date.relative.hours"><![CDATA[{literal}{if $hours > 1}{#$hours} hours{else}An hour{/if} ago{/literal}]]></item>
            <item name="wcf.date.relative.pastDays"><![CDATA[{literal}{if $days > 1}{$day}{else}Yesterday{/if}, {$time}{/literal}]]></item>

    5.0.0 WCFSetup/install/lang/en.xml omits the tags.

            <!-- variables for relative datetime -->
            <item name="wcf.date.relative.now"><![CDATA[A moment ago]]></item>
            <item name="wcf.date.relative.minutes"><![CDATA[{if $minutes > 1}{#$minutes} minutes{else}A minute{/if} ago]]></item>
            <item name="wcf.date.relative.hours"><![CDATA[{if $hours > 1}{#$hours} hours{else}An hour{/if} ago]]></item>
            <item name="wcf.date.relative.pastDays"><![CDATA[{if $days > 1}{$day}{else}Yesterday{/if}, {$time}]]></item>

    During the upgrade, the old values were kept. In the first place it looked pretty strange. The values have just been read from the database, but not been compiled with the already computed timestamp values.

    So I went deeper into the source code, DateUtil::getRelativeTime() would generate the HTML output above. This ones evaluates the timestamp and allows to use the specific relative timestamp formatting fetched from the template.

    return WCF::getLanguage()->getDynamicVariable('wcf.date.relative.minutes', ['minutes' => $minutes]);

    This goes further down into

    return WCF::getTPL()->fetchString($this->dynamicItems[$item], $variables);

    Inside fetchString the eval magic happens. And this always returns the string and does not care about the global variables.

    I thought I would've overridden the template languageItems, but apparently you need to tick the dropdown (which is hidden if you do not scroll down - maybe put that on top?).

    Once I removed the faulty literal tags from the string, everything went working again.

    After all this isn't a bug with the template engine nor caching, but is related to a setup where you have two or more languages installed. The language with the smallest ID wins on upgrade, the other one isn't touched or used. I remember a similar issue when upgrading from 3.x to 4.1 a year ago.

    I've solved it after hours of debugging by removing the German language pack and fixing the English template, but this probably affects more setups.

    Kind regards,


  • Thanks for your answer, as stated above I already solved it by removing the second language and fixing the remaining references. You can just close this issue, I'm just hoping others will find it and be able to resolve their problems.

    One thing which is buggy too is the fact that the table wcfX_board_last_post is never refreshed by a cron job (this only is called inside triggerPublication()). I'll look for existing bug reports and either update or create a new one for that.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!