Local API Publication Strings, Localization Files 2, Live and Upcoming

videos
Added:
1) Local API Publication Strings - When using the local API, the
correctly translated strings stating how much time since publication has
passed are displayed
2) Localization Files 2 - Added additional strings for upcoming videos
as well as the missing strings to the third translation marked as
missing

Fixed:
Live and Upcoming videos - Livestreams were not handled before but are
now correctly implemented. Upcoming videos have a dummy string until the
relevant data is provided by the scraper
This commit is contained in:
Luca 2020-08-18 21:37:43 +02:00
parent 91bcf52dab
commit d4a3d35734
5 changed files with 38 additions and 4 deletions

View File

@ -215,10 +215,14 @@ export default Vue.extend({
if (typeof (this.data.publishedText) !== 'undefined') { if (typeof (this.data.publishedText) !== 'undefined') {
// produces a string according to the template in the locales string // produces a string according to the template in the locales string
this.toLocaleStringS({ this.toLocalePublicationString({
publishText: this.data.publishedText, publishText: this.data.publishedText,
templateString: this.$t('Video.Publicationtemplate'), templateString: this.$t('Video.Publicationtemplate'),
timeStrings: this.$t('Video.Published') timeStrings: this.$t('Video.Published'),
liveStreamString: this.$t('Video.Watching'),
upcomingString: this.$t('Video.Published.Upcoming'),
isLive: this.data.live,
isUpcoming: this.data.isUpcoming
}).then((data) => { }).then((data) => {
this.uploadedTime = data this.uploadedTime = data
}).catch((error) => { }).catch((error) => {
@ -262,6 +266,19 @@ export default Vue.extend({
} }
if (typeof (this.data.uploaded_at) !== 'undefined') { if (typeof (this.data.uploaded_at) !== 'undefined') {
this.toLocalePublicationString({
publishText: this.data.uploaded_at,
templateString: this.$t('Video.Publicationtemplate'),
timeStrings: this.$t('Video.Published'),
liveStreamString: this.$t('Video.Watching'),
upcomingString: this.$t('Video.Published.Upcoming'),
isLive: this.data.live,
isUpcoming: false
}).then((data) => {
this.uploadedTime = data
}).catch((error) => {
console.error(error)
})
this.uploadedTime = this.data.uploaded_at this.uploadedTime = this.data.uploaded_at
} }
@ -277,7 +294,7 @@ export default Vue.extend({
this.isLive = this.data.live this.isLive = this.data.live
}, },
...mapActions([ ...mapActions([
'toLocaleStringS' 'toLocalePublicationString'
]) ])
} }
}) })

View File

@ -166,7 +166,13 @@ const actions = {
return vttString return vttString
}, },
toLocaleStringS ({ dispatch }, payload) { toLocalePublicationString ({ dispatch }, payload) {
if (payload.isLive) {
return '0' + payload.liveStreamString
} else if (payload.isUpcoming || payload.publishText === null) {
// the check for null is currently just an inferring of knowledge, because there is no other possibility left
return payload.upcomingString
}
const strings = payload.publishText.split(' ') const strings = payload.publishText.split(' ')
const singular = (strings[0] === '1') const singular = (strings[0] === '1')
let publicationString = payload.templateString.replace('$', strings[0]) let publicationString = payload.templateString.replace('$', strings[0])

View File

@ -318,6 +318,7 @@ Video:
Year: Jahr Year: Jahr
Years: Jahren Years: Jahren
Ago: Vor Ago: Vor
Upcoming: Premiere bald
Published on: Veröffentlicht am Published on: Veröffentlicht am
Publicationtemplate: vor $ % veröffentlicht Publicationtemplate: vor $ % veröffentlicht

View File

@ -310,6 +310,7 @@ Video:
Year: Year Year: Year
Years: Years Years: Years
Ago: Ago Ago: Ago
Upcoming: Premieres soon
Published on: Published on Published on: Published on
# $ is replaced with the number and % with the unit (days, hours, minutes...) # $ is replaced with the number and % with the unit (days, hours, minutes...)
Publicationtemplate: $ % ago Publicationtemplate: $ % ago

View File

@ -302,6 +302,10 @@ Video:
Oct: Out Oct: Out
Nov: Nov Nov: Nov
Dec: Dez Dec: Dez
# !
Second: Second
# !
Seconds: Seconds
Hour: Hora Hour: Hora
Hours: Horas Hours: Horas
Day: Dia Day: Dia
@ -313,7 +317,12 @@ Video:
Year: Ano Year: Ano
Years: Anos Years: Anos
Ago: Ago:
# !
Upcoming: Premieres soon
Published on: Publicado em Published on: Publicado em
# !
# $ is replaced with the number and % with the unit (days, hours, minutes...)
Publicationtemplate: $ % ago
#& Videos #& Videos
Videos: Videos:
#& Sort By #& Sort By