Differential D2412 Diff 10323 binaries/data/mods/public/gui/lobby/LobbyPage/Chat/ChatMessageFormat/TimestampWrapper.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/lobby/LobbyPage/Chat/ChatMessageFormat/TimestampWrapper.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
/** | |||||
* This class wraps a string with a timestamp dating to when the message was sent. | |||||
*/ | |||||
class TimestampWrapper | |||||
{ | |||||
constructor() | |||||
{ | |||||
this.timeObject = {}; | |||||
this.timestampObject = {}; | |||||
} | |||||
format(timestamp, text) | |||||
{ | |||||
this.timeObject.time = | |||||
Engine.FormatMillisecondsIntoDateStringLocal( | |||||
timestamp ? timestamp * 1000 : Date.now(), | |||||
this.TimeFormat) | |||||
this.timestampObject.time = sprintf(this.TimestampFormat, this.timeObject); | |||||
this.timestampObject.message = text; | |||||
return sprintf(this.TimestampedMessageFormat, this.timestampObject); | |||||
} | |||||
} | |||||
// Translation: Chat message format when there is a time prefix. | |||||
TimestampWrapper.prototype.TimestampedMessageFormat = translate("%(time)s %(message)s"); | |||||
// Translation: Time prefix as shown in the multiplayer lobby (when you enable it in the options page). | |||||
TimestampWrapper.prototype.TimestampFormat = translate("\\[%(time)s]"); | |||||
// Translation: Time as shown in the multiplayer lobby (when you enable it in the options page). | |||||
// For a list of symbols that you can use, see: | |||||
// https://sites.google.com/site/icuprojectuserguide/formatparse/datetime?pli=1#TOC-Date-Field-Symbol-Table | |||||
TimestampWrapper.prototype.TimeFormat = translate("HH:mm"); |
Wildfire Games · Phabricator