Index: binaries/data/mods/public/gui/common/functions_utility.js =================================================================== --- binaries/data/mods/public/gui/common/functions_utility.js +++ binaries/data/mods/public/gui/common/functions_utility.js @@ -109,14 +109,33 @@ } /** - * Convert time in milliseconds to [hh:]mm:ss string representation. + * Convert time in milliseconds to m:ss or H:mm:ss string representation. * @param time Time period in milliseconds (integer) * @return String representing time period */ function timeToString(time) { return Engine.FormatMillisecondsIntoDateStringGMT(time, time < 1000 * 60 * 60 ? - translate("mm:ss") : translate("HH:mm:ss")); + // Translation: Format of the time elapsed or remaining, for game durations, ceasefire and wonder-victory countdowns, etc. + // 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 + translateWithContext("countdown format for times less than one hour", "m:ss") : + // Translation: Format of the time elapsed or remaining, for game durations, ceasefire and wonder-victory countdowns, etc. + // 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 + translateWithContext("countdown format for times greater than one hour", "H:mm:ss")); +} + +function chatTimestampToString(time) +{ + return sprintf( + // Translation: Time prefix as shown in the chat in the lobby, game setup, and session (when you enable it in the options page). + translate("\\[%(time)s]"), { + // Translation: Format of the local time as shown in the chat in the lobby, game setup, and session (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 + "time": Engine.FormatMillisecondsIntoDateStringLocal(time, translateWithContext("chat timestamp format", "HH:mm")) + }); } function removeDupes(array) Index: binaries/data/mods/public/gui/common/functions_utility_loadsave.js =================================================================== --- binaries/data/mods/public/gui/common/functions_utility_loadsave.js +++ binaries/data/mods/public/gui/common/functions_utility_loadsave.js @@ -12,7 +12,10 @@ function generateSavegameDateString(metadata, engineInfo) { return compatibilityColor( - Engine.FormatMillisecondsIntoDateStringLocal(metadata.time * 1000, translate("yyyy-MM-dd HH:mm:ss")), + // Translation: Format of the local time as shown in the load game menu and the save game dialog. + // 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 + Engine.FormatMillisecondsIntoDateStringLocal(metadata.time * 1000, translateWithContext("load/save game date format", "yyyy-MM-dd HH:mm:ss")), isCompatibleSavegame(metadata, engineInfo)); } Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js =================================================================== --- binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -2151,9 +2151,7 @@ if (Engine.ConfigDB_GetValue("user", "chat.timestamp") == "true") text = sprintf(translate("%(time)s %(message)s"), { - "time": sprintf(translate("\\[%(time)s]"), { - "time": Engine.FormatMillisecondsIntoDateStringLocal(Date.now(), translate("HH:mm")) - }), + "time": chatTimestampToString(Date.now()), "message": text }); Index: binaries/data/mods/public/gui/lobby/lobby.js =================================================================== --- binaries/data/mods/public/gui/lobby/lobby.js +++ binaries/data/mods/public/gui/lobby/lobby.js @@ -994,9 +994,11 @@ sgGameStartTime.hidden = !game.startTime; if (game.startTime) sgGameStartTime.caption = sprintf( - // Translation: %(time)s is the hour and minute here. translate("Game started at %(time)s"), { - "time": Engine.FormatMillisecondsIntoDateStringLocal(+game.startTime*1000, translate("HH:mm")) + // Translation: Format of the local start time of a selected game in the lobby. + // 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 + "time": Engine.FormatMillisecondsIntoDateStringLocal(game.startTime * 1000, translateWithContext("game start time format", "HH:mm")) }); sgNbPlayers.caption = sprintf( @@ -1348,19 +1350,9 @@ if (Engine.ConfigDB_GetValue("user", "chat.timestamp") != "true") return formattedMessage; - // 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 - let timeString = Engine.FormatMillisecondsIntoDateStringLocal(msg.time ? msg.time * 1000 : Date.now(), translate("HH:mm")); - - // Translation: Time prefix as shown in the multiplayer lobby (when you enable it in the options page). - let timePrefixString = sprintf(translate("\\[%(time)s]"), { - "time": timeString - }); - // Translation: IRC message format when there is a time prefix. return sprintf(translate("%(time)s %(message)s"), { - "time": senderFont(timePrefixString), + "time": senderFont(chatTimestampToString(msg.time ? msg.time * 1000 : Date.now())), "message": formattedMessage }); } Index: binaries/data/mods/public/gui/replaymenu/replay_menu.js =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_menu.js +++ binaries/data/mods/public/gui/replaymenu/replay_menu.js @@ -296,7 +296,10 @@ */ function getReplayDateTime(replay) { - return Engine.FormatMillisecondsIntoDateStringLocal(replay.attribs.timestamp * 1000, translate("yyyy-MM-dd HH:mm")); + // Translation: Format of the local time as shown in the replay menu. + // 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 + return Engine.FormatMillisecondsIntoDateStringLocal(replay.attribs.timestamp * 1000, translateWithContext("replay date format", "yyyy-MM-dd HH:mm")); } /** @@ -326,11 +329,14 @@ */ function getReplayMonth(replay) { - return Engine.FormatMillisecondsIntoDateStringLocal(replay.attribs.timestamp * 1000, translate("yyyy-MM")); + // Translation: Format of the local time (month) as shown in the date filter dropdown in the replay menu. + // 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 + return Engine.FormatMillisecondsIntoDateStringLocal(replay.attribs.timestamp * 1000, translateWithContext("replay date filter format", "yyyy-MM")); } /** - * Returns a human-readable version of the time when the replay started. + * Returns a human-readable version of the duration of the replay. * * @returns {string} */ Index: binaries/data/mods/public/gui/session/messages.js =================================================================== --- binaries/data/mods/public/gui/session/messages.js +++ binaries/data/mods/public/gui/session/messages.js @@ -894,9 +894,7 @@ // Save to chat history let historical = { "txt": formatted, - "timePrefix": sprintf(translate("\\[%(time)s]"), { - "time": Engine.FormatMillisecondsIntoDateStringLocal(Date.now(), translate("HH:mm")) - }), + "timePrefix": chatTimestampToString(Date.now()), "filter": {} }; Index: binaries/data/mods/public/gui/session/selection_panels.js =================================================================== --- binaries/data/mods/public/gui/session/selection_panels.js +++ binaries/data/mods/public/gui/session/selection_panels.js @@ -639,7 +639,7 @@ // Show the time remaining to finish the first item if (data.i == 0) - Engine.GetGUIObjectByName("queueTimeRemaining").caption = Engine.FormatMillisecondsIntoDateStringGMT(data.item.timeRemaining, translateWithContext("countdown format", "m:ss")); + Engine.GetGUIObjectByName("queueTimeRemaining").caption = timeToString(data.item.timeRemaining); let guiObject = Engine.GetGUIObjectByName("unitQueueProgressSlider["+data.i+"]"); let size = guiObject.size;