Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/chat/ChatMessageFormatPlayer.js
Show All 17 Lines | class ChatMessageFormatPlayer | ||||
{ | { | ||||
if (!msg.text) | if (!msg.text) | ||||
return ""; | return ""; | ||||
let isMe = msg.text.startsWith("/me "); | let isMe = msg.text.startsWith("/me "); | ||||
if (!isMe && !this.parseMessageAddressee(msg)) | if (!isMe && !this.parseMessageAddressee(msg)) | ||||
return ""; | return ""; | ||||
isMe = msg.text.startsWith("/me "); | |||||
if (isMe) | if (isMe) | ||||
msg.text = msg.text.substr("/me ".length); | msg.text = msg.text.substr("/me ".length); | ||||
// Translate or escape text | // Translate or escape text | ||||
if (!msg.text) | if (!msg.text) | ||||
return ""; | return ""; | ||||
if (msg.translate) | if (msg.translate) | ||||
Show All 14 Lines | else | ||||
if (userName != g_PlayerAssignments[msg.guid].name && | if (userName != g_PlayerAssignments[msg.guid].name && | ||||
msg.text.toLowerCase().indexOf(splitRatingFromNick(userName).nick.toLowerCase()) != -1) | msg.text.toLowerCase().indexOf(splitRatingFromNick(userName).nick.toLowerCase()) != -1) | ||||
soundNotification("nick"); | soundNotification("nick"); | ||||
} | } | ||||
// GUID for players, playerID for AIs | // GUID for players, playerID for AIs | ||||
let coloredUsername = msg.guid != -1 ? colorizePlayernameByGUID(msg.guid) : colorizePlayernameByID(msg.player); | let coloredUsername = msg.guid != -1 ? colorizePlayernameByGUID(msg.guid) : colorizePlayernameByID(msg.player); | ||||
return sprintf(translate(this.strings[isMe ? "me" : "regular"][msg.context ? "context" : "no-context"]), { | // Get the right format message. | ||||
let formatType = this.strings[isMe ? "me" : "regular"][msg.context ? "context" : "no-context"]; | |||||
return sprintf(translate(formatType), { | |||||
"message": msg.text, | "message": msg.text, | ||||
"context": msg.context ? translateWithContext("chat message context", msg.context) : "", | "context": msg.context ? translate(msg.context) : "", | ||||
elexis: Why is this change performed? If the string was extracted with `markForTranslationWithContext`… | |||||
"user": coloredUsername, | "user": coloredUsername, | ||||
"userTag": sprintf(translate("<%(user)s>"), { "user": coloredUsername }) | "userTag": sprintf(translate("<%(user)s>"), { "user": coloredUsername }) | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Checks if the current user is an addressee of the chatmessage sent by another player. | * Checks if the current user is an addressee of the chatmessage sent by another player. | ||||
* Sets the context and potentially addresseeGUID of that message. | * Sets the context and potentially addresseeGUID of that message. | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Why is this change performed? If the string was extracted with markForTranslationWithContext why would one translate it with translate instead of translateWithContext.