Video publication string, Localization files
Added: 1) video publication string - The code now creates a correctly translated string for the info on how far back the publication was 2) Localization files - Added the required template string as well as the unit for second and seconds to the yaml files to be able to utilize them in 1)
This commit is contained in:
parent
2e8fc9da87
commit
91bcf52dab
|
@ -1,5 +1,6 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import FtIconButton from '../ft-icon-button/ft-icon-button.vue'
|
import FtIconButton from '../ft-icon-button/ft-icon-button.vue'
|
||||||
|
import { mapActions } from 'vuex'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'FtListVideo',
|
name: 'FtListVideo',
|
||||||
|
@ -213,7 +214,16 @@ export default Vue.extend({
|
||||||
this.viewCount = this.data.viewCount
|
this.viewCount = this.data.viewCount
|
||||||
|
|
||||||
if (typeof (this.data.publishedText) !== 'undefined') {
|
if (typeof (this.data.publishedText) !== 'undefined') {
|
||||||
this.uploadedTime = this.data.publishedText
|
// produces a string according to the template in the locales string
|
||||||
|
this.toLocaleStringS({
|
||||||
|
publishText: this.data.publishedText,
|
||||||
|
templateString: this.$t('Video.Publicationtemplate'),
|
||||||
|
timeStrings: this.$t('Video.Published')
|
||||||
|
}).then((data) => {
|
||||||
|
this.uploadedTime = data
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof (this.data.viewCount) !== 'undefined' && this.data.viewCount !== null) {
|
if (typeof (this.data.viewCount) !== 'undefined' && this.data.viewCount !== null) {
|
||||||
|
@ -265,6 +275,9 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isLive = this.data.live
|
this.isLive = this.data.live
|
||||||
}
|
},
|
||||||
|
...mapActions([
|
||||||
|
'toLocaleStringS'
|
||||||
|
])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -166,6 +166,64 @@ const actions = {
|
||||||
return vttString
|
return vttString
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toLocaleStringS ({ dispatch }, payload) {
|
||||||
|
const strings = payload.publishText.split(' ')
|
||||||
|
const singular = (strings[0] === '1')
|
||||||
|
let publicationString = payload.templateString.replace('$', strings[0])
|
||||||
|
switch (strings[1].substring(0, 2)) {
|
||||||
|
case 'se':
|
||||||
|
if (singular) {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Second)
|
||||||
|
} else {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Seconds)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'mi':
|
||||||
|
if (singular) {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Minute)
|
||||||
|
} else {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Minutes)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'ho':
|
||||||
|
if (singular) {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Hour)
|
||||||
|
} else {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Hours)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'da':
|
||||||
|
if (singular) {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Day)
|
||||||
|
} else {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Days)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'we':
|
||||||
|
if (singular) {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Week)
|
||||||
|
} else {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Weeks)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'mo':
|
||||||
|
if (singular) {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Month)
|
||||||
|
} else {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Months)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'ye':
|
||||||
|
if (singular) {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Year)
|
||||||
|
} else {
|
||||||
|
publicationString = publicationString.replace('%', payload.timeStrings.Years)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return publicationString
|
||||||
|
},
|
||||||
|
|
||||||
showToast (_, payload) {
|
showToast (_, payload) {
|
||||||
FtToastEvents.$emit('toast.open', payload.message, payload.action, payload.time)
|
FtToastEvents.$emit('toast.open', payload.message, payload.action, payload.time)
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,18 +305,22 @@ Video:
|
||||||
Oct: Okt
|
Oct: Okt
|
||||||
Nov: Nov
|
Nov: Nov
|
||||||
Dec: Dez
|
Dec: Dez
|
||||||
|
Second: Sekunde
|
||||||
|
Seconds: Sekunden
|
||||||
Hour: Stunde
|
Hour: Stunde
|
||||||
Hours: Stunden
|
Hours: Stunden
|
||||||
Day: Tag
|
Day: Tag
|
||||||
Days: Tage
|
Days: Tagen
|
||||||
Week: Woche
|
Week: Woche
|
||||||
Weeks: Wochen
|
Weeks: Wochen
|
||||||
Month: Monat
|
Month: Monat
|
||||||
Months: Monate
|
Months: Monaten
|
||||||
Year: Jahr
|
Year: Jahr
|
||||||
Years: Jahre
|
Years: Jahren
|
||||||
Ago: Vor
|
Ago: Vor
|
||||||
Published on: Veröffentlicht am
|
Published on: Veröffentlicht am
|
||||||
|
Publicationtemplate: vor $ % veröffentlicht
|
||||||
|
|
||||||
#& Videos
|
#& Videos
|
||||||
Videos:
|
Videos:
|
||||||
#& Sort By
|
#& Sort By
|
||||||
|
|
|
@ -297,6 +297,8 @@ Video:
|
||||||
Oct: Oct
|
Oct: Oct
|
||||||
Nov: Nov
|
Nov: Nov
|
||||||
Dec: Dec
|
Dec: Dec
|
||||||
|
Second: Second
|
||||||
|
Seconds: Seconds
|
||||||
Hour: Hour
|
Hour: Hour
|
||||||
Hours: Hours
|
Hours: Hours
|
||||||
Day: Day
|
Day: Day
|
||||||
|
@ -309,6 +311,8 @@ Video:
|
||||||
Years: Years
|
Years: Years
|
||||||
Ago: Ago
|
Ago: Ago
|
||||||
Published on: Published on
|
Published on: Published on
|
||||||
|
# $ is replaced with the number and % with the unit (days, hours, minutes...)
|
||||||
|
Publicationtemplate: $ % ago
|
||||||
#& Videos
|
#& Videos
|
||||||
Videos:
|
Videos:
|
||||||
#& Sort By
|
#& Sort By
|
||||||
|
|
Loading…
Reference in New Issue