]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/date_format' into 'master'
authorterencehill <piuntn@gmail.com>
Thu, 29 Aug 2019 18:48:19 +0000 (18:48 +0000)
committerterencehill <piuntn@gmail.com>
Thu, 29 Aug 2019 18:48:19 +0000 (18:48 +0000)
Menu Xonstats date format: allow changing it in other languages; display cardinal day number (e.g. "January 1, 2019" instead of "January 1st, 2019")

See merge request xonotic/xonotic-data.pk3dir!650

qcsrc/menu/xonotic/statslist.qc

index 2c600b6f5289e6d92a03569a0c2dabf03cab3ca7..7d19516cf01673cfd38f150a63ab4678de6612ca 100644 (file)
@@ -41,12 +41,11 @@ string XonoticStatsList_convertDate(string input)
                default: return input; // failed, why?
        }
 
-       return sprintf(
-               "%s %s, %d",
-               monthname,
-               count_ordinal(stof(substring(input, 8, 2))),
-               stof(substring(input, 0, 4))
-       );
+       string date = ZCTX(_("DATE^%m %d, %Y"));
+       date = strreplace("%Y", substring(input, 0, 4), date);
+       date = strreplace("%d", ftos(stof(substring(input, 8, 2))), date); // ftos-stof removes leading 0
+       date = strreplace("%m", monthname, date);
+       return date;
 }
 
 void XonoticStatsList_getStats(entity me)