mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
use locales array in federation visualization item component
This commit is contained in:
parent
3e277bcb79
commit
206dcda775
@ -15,6 +15,8 @@
|
|||||||
import { formatDistanceToNow } from 'date-fns'
|
import { formatDistanceToNow } from 'date-fns'
|
||||||
import { de, en, fr, es, nl } from 'date-fns/locale'
|
import { de, en, fr, es, nl } from 'date-fns/locale'
|
||||||
|
|
||||||
|
const locales = { en, de, es, fr, nl }
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FederationVisualizeItem',
|
name: 'FederationVisualizeItem',
|
||||||
props: {
|
props: {
|
||||||
@ -37,26 +39,12 @@ export default {
|
|||||||
variant() {
|
variant() {
|
||||||
return this.verified ? 'success' : 'danger'
|
return this.verified ? 'success' : 'danger'
|
||||||
},
|
},
|
||||||
fnsLocale() {
|
|
||||||
switch (this.locale) {
|
|
||||||
case 'de':
|
|
||||||
return de
|
|
||||||
case 'es':
|
|
||||||
return es
|
|
||||||
case 'fr':
|
|
||||||
return fr
|
|
||||||
case 'nl':
|
|
||||||
return nl
|
|
||||||
default:
|
|
||||||
return en
|
|
||||||
}
|
|
||||||
},
|
|
||||||
lastAnnouncedAt() {
|
lastAnnouncedAt() {
|
||||||
if (this.item.lastAnnouncedAt) {
|
if (this.item.lastAnnouncedAt) {
|
||||||
return formatDistanceToNow(new Date(this.item.lastAnnouncedAt), {
|
return formatDistanceToNow(new Date(this.item.lastAnnouncedAt), {
|
||||||
includeSecond: true,
|
includeSecond: true,
|
||||||
addSuffix: true,
|
addSuffix: true,
|
||||||
locale: this.fnsLocale,
|
locale: locales[this.locale],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
@ -66,7 +54,7 @@ export default {
|
|||||||
return formatDistanceToNow(new Date(this.item.createdAt), {
|
return formatDistanceToNow(new Date(this.item.createdAt), {
|
||||||
includeSecond: true,
|
includeSecond: true,
|
||||||
addSuffix: true,
|
addSuffix: true,
|
||||||
locale: this.fnsLocale,
|
locale: locales[this.locale],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user