diff options
author | Brian Choromanski <[email protected]> | 2021-12-06 05:57:37 -0500 |
---|---|---|
committer | Brian Choromanski <[email protected]> | 2021-12-06 05:57:37 -0500 |
commit | 7bca8e508ede26a2e0fc8fce3198ec1c2f54f5f9 (patch) | |
tree | 78227a0415eccdbda74c51ac2d30bc9cba901954 | |
parent | bc990cd683b169fd976774296f8a13df1361f746 (diff) | |
download | SponsorBlock-7bca8e508ede26a2e0fc8fce3198ec1c2f54f5f9.tar.gz SponsorBlock-7bca8e508ede26a2e0fc8fce3198ec1c2f54f5f9.zip |
Localized d and h
-rw-r--r-- | public/_locales/en/messages.json | 6 | ||||
-rw-r--r-- | src/popup.ts | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index f4285495..6215905f 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -837,5 +837,11 @@ }, "fillerNewFeature": { "message": "New! Skip tangents and jokes with the filler category. Enable in options" + }, + "dayAbbreviation": { + "message": "d" + }, + "hourAbbreviation": { + "message": "h" } } diff --git a/src/popup.ts b/src/popup.ts index e11cb600..88f4519c 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -731,17 +731,17 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { } /** - * Converts time in hours to 5h 25.1 + * Converts time in hours to 2d 5h 25.1 * If less than 1 hour, just returns minutes * * @param {float} seconds * @returns {string} */ function getFormattedHours(minutes) { - minutes = Math.round(minutes * 10) / 10 - const days = Math.floor(minutes / 3600) + minutes = Math.round(minutes * 10) / 10; + const days = Math.floor(minutes / 3600); const hours = Math.floor(minutes / 60) % 24; - return (days > 0 ? days + "d " : "") + (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1); + return (days > 0 ? days + chrome.i18n.getMessage("dayAbbreviation") + " " : "") + (hours > 0 ? hours + chrome.i18n.getMessage("hourAbbreviation") + " " : "") + (minutes % 60).toFixed(1); } //end of function |