Fix WCF.String.addThousandsSeparator()
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 4 May 2023 08:46:28 +0000 (10:46 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 4 May 2023 08:46:28 +0000 (10:46 +0200)
The previously used phrase is no longer available to the JavaScript. It would
also be inconsistent. Use `.toLocaleString()`.

Fxies #5471

wcfsetup/install/files/js/WCF.js

index 3e69beab3b19f699c6fc65ef310596891baf0803..76539306aecfdacd530ac6ae996521f55f26cf28 100755 (executable)
@@ -1936,7 +1936,7 @@ WCF.String = {
         * @return      string
         */
        addThousandsSeparator: function(number) {
-               return String(number).replace(/(^-?\d{1,3}|\d{3})(?=(?:\d{3})+(?:$|\.))/g, '$1' + WCF.Language.get('wcf.global.thousandsSeparator'));
+               return Number(number).toLocaleString(document.documentElement.lang);
        },
        
        /**