From dc26141338a58449a07f283eca59af7758a5f334 Mon Sep 17 00:00:00 2001 From: vallode <18506096+vallode@users.noreply.github.com> Date: Wed, 6 Oct 2021 22:09:08 +0100 Subject: [PATCH] Parse like and dislike count to add comma separator (#1796) * Parse like and dislike count to add comma separator * Use user locale with fallback for like count --- .../watch-video-info/watch-video-info.js | 18 ++++++++++++++++++ .../watch-video-info/watch-video-info.vue | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/watch-video-info/watch-video-info.js b/src/renderer/components/watch-video-info/watch-video-info.js index 30579e88..088bd006 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.js +++ b/src/renderer/components/watch-video-info/watch-video-info.js @@ -198,6 +198,24 @@ export default Vue.extend({ return this.likeCount + this.dislikeCount }, + parsedLikeCount: function () { + if (this.hideVideoLikesAndDislikes) { + return null + } + + const locale = this.currentLocale.replace('_', '-') + return this.likeCount.toLocaleString([locale, 'en']) + }, + + parsedDislikeCount: function () { + if (this.hideVideoLikesAndDislikes) { + return null + } + + const locale = this.currentLocale.replace('_', '-') + return this.dislikeCount.toLocaleString([locale, 'en']) + }, + likePercentageRatio: function () { return parseInt(this.likeCount / this.totalLikeCount * 100) }, diff --git a/src/renderer/components/watch-video-info/watch-video-info.vue b/src/renderer/components/watch-video-info/watch-video-info.vue index 2ea9960d..0f66d444 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.vue +++ b/src/renderer/components/watch-video-info/watch-video-info.vue @@ -56,8 +56,8 @@ :style="{ background: `linear-gradient(to right, var(--accent-color) ${likePercentageRatio}%, #9E9E9E ${likePercentageRatio}%` }" />
- {{ likeCount }} - {{ dislikeCount }} + {{ parsedLikeCount }} + {{ parsedDislikeCount }}