diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index cb3341e2..5a6f4d57 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -429,34 +429,30 @@ export default Vue.extend({ // Convert from ms to second to minute upcomingTimeLeft = (upcomingTimeLeft / 1000) / 60 - let timeUnitI18nPartialKey = 'Minute' + let timeUnit = 'minute' // Youtube switches to showing time left in minutes at 120 minutes remaining if (upcomingTimeLeft > 120) { upcomingTimeLeft = upcomingTimeLeft / 60 - timeUnitI18nPartialKey = 'Hour' + timeUnit = 'hour' } - if (timeUnitI18nPartialKey === 'Hour' && upcomingTimeLeft > 24) { + if (timeUnit === 'hour' && upcomingTimeLeft > 24) { upcomingTimeLeft = upcomingTimeLeft / 24 - timeUnitI18nPartialKey = 'Day' + timeUnit = 'day' } // Value after decimal not to be displayed // e.g. > 2 days = display as `2 days` upcomingTimeLeft = Math.floor(upcomingTimeLeft) - if (upcomingTimeLeft !== 1) { - timeUnitI18nPartialKey = timeUnitI18nPartialKey + 's' - } - const timeUnitTranslated = this.$t(`Video.Published.${timeUnitI18nPartialKey}`).toLowerCase() // Displays when less than a minute remains // Looks better than `Premieres in x seconds` if (upcomingTimeLeft < 1) { - this.upcomingTimeLeft = this.$t('Video.Published.Less than a minute').toLowerCase() + this.upcomingTimeLeft = this.$t('Video.Published.In less than a minute').toLowerCase() } else { // TODO a I18n entry for time format might be needed here - this.upcomingTimeLeft = `${upcomingTimeLeft} ${timeUnitTranslated}` + this.upcomingTimeLeft = new Intl.RelativeTimeFormat(this.currentLocale).format(upcomingTimeLeft, timeUnit) } } else { this.upcomingTimestamp = null diff --git a/src/renderer/views/Watch/Watch.vue b/src/renderer/views/Watch/Watch.vue index 638cb97d..7a0e1ee0 100644 --- a/src/renderer/views/Watch/Watch.vue +++ b/src/renderer/views/Watch/Watch.vue @@ -54,7 +54,7 @@ v-if="upcomingTimestamp !== null" class="premiereText" > - {{ $t("Video.Premieres in") }} {{ upcomingTimeLeft }} + {{ $t("Video.Premieres") }} {{ upcomingTimeLeft }}
{{ upcomingTimestamp }}

diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index f106a311..18defc5b 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -542,7 +542,7 @@ Video: the page to check again # As in a Live Video Premieres on: Premieres on - Premieres in: Premieres in + Premieres: Premieres Live: Live Live Now: Live Now Live Chat: Live Chat @@ -593,7 +593,7 @@ Video: Years: Years Ago: Ago Upcoming: Premieres on - Less than a minute: Less than a minute + In less than a minute: In less than a minute Published on: Published on Streamed on: Streamed on Started streaming on: Started streaming on