From 287739de7c0b8fdbfa42bc9a37a4eae8175aa8a3 Mon Sep 17 00:00:00 2001 From: Preston Date: Tue, 11 Aug 2020 23:26:49 -0400 Subject: [PATCH] Add More Locale Strings to Both the locales file and the app --- .../components/ft-list-video/ft-list-video.js | 30 +++++++++++------- .../ft-list-video/ft-list-video.vue | 10 +++--- .../components/playlist-info/playlist-info.js | 15 +++++---- .../playlist-info/playlist-info.vue | 6 ++-- .../watch-video-comments.vue | 2 +- .../watch-video-live-chat.vue | 2 +- src/renderer/main.js | 3 ++ src/renderer/views/Channel/Channel.vue | 4 +-- static/locales/en-US.yaml | 31 ++++++++++++++----- 9 files changed, 66 insertions(+), 37 deletions(-) diff --git a/src/renderer/components/ft-list-video/ft-list-video.js b/src/renderer/components/ft-list-video/ft-list-video.js index 8b2da219a..219ae7b08 100644 --- a/src/renderer/components/ft-list-video/ft-list-video.js +++ b/src/renderer/components/ft-list-video/ft-list-video.js @@ -31,6 +31,7 @@ export default Vue.extend({ channelName: '', channelId: '', viewCount: 0, + parsedViewCount: '', uploadedTime: '', duration: '', description: '', @@ -39,14 +40,6 @@ export default Vue.extend({ isLive: false, isFavorited: false, hideViews: false, - optionsNames: [ - 'Open in YouTube', - 'Copy YouTube Link', - 'Open YouTube Embedded Player', - 'Copy YouTube Embedded Player Link', - 'Open in Invidious', - 'Copy Invidious Link' - ], optionsValues: [ 'openYoutube', 'copyYoutube', @@ -90,6 +83,17 @@ export default Vue.extend({ return `https://www.youtube-nocookie.com/embed/${this.id}` }, + optionsNames: function () { + return [ + this.$t('Video.Open in YouTube'), + this.$t('Video.Copy YouTube Link'), + this.$t('Video.Open YouTube Embedded Player'), + this.$t('Video.Copy YouTube Embedded Player Link'), + this.$t('Video.Open in Invidious'), + this.$t('Video.Copy Invidious Link') + ] + }, + thumbnail: function () { let baseUrl if (this.backendPreference === 'invidious') { @@ -206,15 +210,16 @@ export default Vue.extend({ this.duration = this.calculateVideoDuration(this.data.lengthSeconds) this.description = this.data.description this.isLive = this.data.liveNow + this.viewCount = this.data.viewCount if (typeof (this.data.publishedText) !== 'undefined') { this.uploadedTime = this.data.publishedText } if (typeof (this.data.viewCount) !== 'undefined' && this.data.viewCount !== null) { - this.viewCount = this.data.viewCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + this.parsedViewCount = this.data.viewCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') } else if (typeof (this.data.viewCountText) !== 'undefined') { - this.viewCount = this.data.viewCountText.replace(' views', '') + this.parsedViewCount = this.data.viewCountText.replace(' views', '') } else { this.hideViews = true } @@ -232,6 +237,7 @@ export default Vue.extend({ if (typeof (this.data.author) === 'string') { this.channelName = this.data.author this.channelId = this.data.ucid + this.viewCount = this.data.views // Data is returned as a literal string names 'undefined' if (this.data.length_seconds !== 'undefined') { @@ -250,10 +256,10 @@ export default Vue.extend({ } if (this.data.views !== null && typeof (this.data.views) !== 'undefined') { - this.viewCount = this.data.views.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + this.parsedViewCount = this.data.views.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') } else if (typeof (this.data.view_count) !== 'undefined') { const viewCount = this.data.view_count.replace(',', '') - this.viewCount = viewCount.replace(/\B(?=(\d{3})+(?!\d))/g, ',') + this.parsedViewCount = viewCount.replace(/\B(?=(\d{3})+(?!\d))/g, ',') } else { this.hideViews = true } diff --git a/src/renderer/components/ft-list-video/ft-list-video.vue b/src/renderer/components/ft-list-video/ft-list-video.vue index f1ab22f4c..728976939 100644 --- a/src/renderer/components/ft-list-video/ft-list-video.vue +++ b/src/renderer/components/ft-list-video/ft-list-video.vue @@ -26,7 +26,7 @@ class="videoDuration" :class="{ live: isLive }" > - {{ isLive ? "Live" : duration }} + {{ isLive ? $t("Video.Live") : duration }} - Watched + {{ $t("Video.Watched") }}
• {{ viewCount }} views + >• {{ parsedViewCount }} + {{ $t("Video.Views").toLowerCase() }} + {{ $t("Video.View") }} • {{ viewCount }} watching + >• {{ viewCount }} {{ $t("Video.Watching").toLowerCase() }}

- {{ videoCount }} videos - {{ viewCount }} views - + {{ videoCount }} {{ $t("Playlist.Videos") }} - {{ viewCount }} {{ $t("Playlist.Views") }} - - Last updated on + {{ $t("Playlist.Last Updated On") }} {{ lastUpdated }}

@@ -31,7 +31,7 @@
- {{ $t("Load More Comments") }} + {{ $t("Comments.Load More Comments") }} diff --git a/src/renderer/components/watch-video-live-chat/watch-video-live-chat.vue b/src/renderer/components/watch-video-live-chat/watch-video-live-chat.vue index 995f56afd..ac932826b 100644 --- a/src/renderer/components/watch-video-live-chat/watch-video-live-chat.vue +++ b/src/renderer/components/watch-video-live-chat/watch-video-live-chat.vue @@ -37,7 +37,7 @@ v-else class="relative" > -

Live Chat

+

{{ $t("Video.Live Chat") }}

{ const i18n = new VueI18n({ locale: 'en-US', // set locale + fallbackLocale: { + default: 'en-US' + }, messages // set locale messages }) diff --git a/src/renderer/views/Channel/Channel.vue b/src/renderer/views/Channel/Channel.vue index 22003cf8f..68ef0e412 100644 --- a/src/renderer/views/Channel/Channel.vue +++ b/src/renderer/views/Channel/Channel.vue @@ -68,7 +68,7 @@ {{ $t("Channel.About.About").toUpperCase() }}
@@ -171,7 +171,7 @@ class="getNextPage" @click="handleFetchMore" > - Fetch more results… + {{ $t("Search Filters.Fetch more results") }} diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index a5dc6eec3..7dbb89044 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -272,8 +272,21 @@ Channel: Channel Description: Channel Description Featured Channels: Featured Channels Video: + Open in YouTube: Open in YouTube + Copy YouTube Link: Copy YouTube Link + Open YouTube Embedded Player: Open YouTube Embedded Player + Copy YouTube Embedded Player Link: Copy YouTube Embedded Player Link + Open in Invidious: Open in Invidious + Copy Invidious Link: Copy Invidious Link + View: View Views: Views + # Context is "X People Watching" + Watching: Watching + Watched: Watched + # As in a Live Video + Live: Live Live Now: Live Now + Live Chat: Live Chat Enable Live Chat: Enable Live Chat Live Chat is currently not supported in this build.: Live Chat is currently not supported in this build. 'Chat is disabled or the Live Stream has ended.': Chat is disabled or the Live Stream has ended. @@ -315,14 +328,16 @@ Videos: Playlist: #& About View Full Playlist: View Full Playlist - -# On Channel Playlist Page -Share Playlist: - Share Playlist: Share Playlist - Copy YouTube Link: Copy YouTube Link - Open in YouTube: Open in YouTube - Copy Invidious Link: Copy Invidious Link - Open in Invidious: Open in Invidious + Videos: Videos + View: View + Views: Views + Last Updated On: Last Updated On + Share Playlist: + Share Playlist: Share Playlist + Copy YouTube Link: Copy YouTube Link + Open in YouTube: Open in YouTube + Copy Invidious Link: Copy Invidious Link + Open in Invidious: Open in Invidious # On Video Watch Page #* Published