Make the report logs translatable

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-06-09 14:55:48 +02:00
parent 4b21d1b347
commit 17503d3b96
3 changed files with 74 additions and 34 deletions

View File

@ -594,5 +594,12 @@
"No notifications": "No notifications", "No notifications": "No notifications",
"Direct": "Direct", "Direct": "Direct",
"Every hour": "Every hour", "Every hour": "Every hour",
"Every day": "Every day" "Every day": "Every day",
"report #{report_number}": "report #{report_number}",
"{actor} closed {report}": "{actor} closed {report}",
"a non-existent report": "a non-existent report",
"{actor} reopened {report}": "{actor} reopened {report}",
"{actor} marked {report} as resolved": "{actor} marked {report} as resolved",
"{actor} added a note on {report}": "{actor} added a note on {report}",
"{actor} deleted an event named \"{title}\"": "{actor} deleted an event named \"{title}\""
} }

View File

@ -597,10 +597,17 @@
"We'll always send you emails to notify about important event updates": "Nous vous enverrons toujours des emails pour vous notifier à propos des mises à jour importantes des événements", "We'll always send you emails to notify about important event updates": "Nous vous enverrons toujours des emails pour vous notifier à propos des mises à jour importantes des événements",
"Like title or physical address update, start or end date change or event being confirmed or cancelled.": "Comme la mise à jour du titre ou de l'addresse de l'événement, un changement de date de début ou de fin, ou bien l'événement devenant confirmé ou bien annulé.", "Like title or physical address update, start or end date change or event being confirmed or cancelled.": "Comme la mise à jour du titre ou de l'addresse de l'événement, un changement de date de début ou de fin, ou bien l'événement devenant confirmé ou bien annulé.",
"Organizer notifications": "Notifications pour organisateur·ice", "Organizer notifications": "Notifications pour organisateur·ice",
"Notifications for manually approved participations to an event": "Notifications pour l'approbabtion manuelle des participations à un événement", "Notifications for manually approved participations to an event": "Notifications pour l'approbation manuelle des participations à un événement",
"We'll send you an email when there new participations requests.": "Nous vous enverrons un email lorsqu'il y aura de nouvelles demandes de participation.", "We'll send you an email when there new participations requests.": "Nous vous enverrons un email lorsqu'il y aura de nouvelles demandes de participation.",
"No notifications": "Pas de notifications", "No notifications": "Pas de notifications",
"Direct": "Direct", "Direct": "Direct",
"Every hour": "À chaque heure", "Every hour": "À chaque heure",
"Every day": "Chaque jour" "Every day": "Chaque jour",
"report #{report_number}": "le signalement #{report_number}",
"{actor} closed {report}": "{actor} a fermé {report}",
"a non-existent report": "un signalement non-existant",
"{actor} reopened {report}": "{actor} a réouvert {report}",
"{actor} marked {report} as resolved": "{actor} a marqué {report} comme résolu",
"{actor} added a note on {report}": "{actor} a ajouté une note sur {report}",
"{actor} deleted an event named \"{title}\"": "{actor} a supprimé un événement nommé \"{title}\""
} }

View File

@ -1,48 +1,74 @@
<template> <template>
<section> <section>
<ul v-if="actionLogs.length > 0"> <ul v-if="actionLogs.length > 0">
<li v-for="log in actionLogs"> <li v-for="log in actionLogs" :key="log.id">
<div class="box"> <div class="box">
<img class="image" :src="log.actor.avatar.url" v-if="log.actor.avatar" /> <img class="image" :src="log.actor.avatar.url" v-if="log.actor.avatar" />
<span>@{{ log.actor.preferredUsername }}</span> <i18n
<span v-if="log.action === ActionLogAction.REPORT_UPDATE_CLOSED"> v-if="log.action === ActionLogAction.REPORT_UPDATE_CLOSED"
closed tag="span"
<router-link :to="{ name: RouteName.REPORT, params: { reportId: log.object.id } }" path="{actor} closed {report}"
>report #{{ log.object.id }}</router-link >
> <span slot="actor">@{{ log.actor.preferredUsername }}</span>
</span> <router-link
<span v-else-if="log.action === ActionLogAction.REPORT_UPDATE_OPENED"> :to="{ name: RouteName.REPORT, params: { reportId: log.object.id } }"
reopened slot="report"
<router-link :to="{ name: RouteName.REPORT, params: { reportId: log.object.id } }" >{{ $t("report #{report_number}", { report_number: log.object.id }) }}
>report #{{ log.object.id }}</router-link </router-link>
> </i18n>
</span> <i18n
<span v-else-if="log.action === ActionLogAction.REPORT_UPDATE_RESOLVED"> v-else-if="log.action === ActionLogAction.REPORT_UPDATE_OPENED"
marked tag="span"
<router-link :to="{ name: RouteName.REPORT, params: { reportId: log.object.id } }" path="{actor} reopened {report}"
>report #{{ log.object.id }}</router-link >
>as resolved <span slot="actor">@{{ log.actor.preferredUsername }}</span>
</span> <router-link
<span v-else-if="log.action === ActionLogAction.NOTE_CREATION"> :to="{ name: RouteName.REPORT, params: { reportId: log.object.id } }"
added a note on slot="report"
>{{ $t("report #{report_number}", { report_number: log.object.id }) }}
</router-link>
</i18n>
<i18n
v-else-if="log.action === ActionLogAction.REPORT_UPDATE_RESOLVED"
tag="span"
path="{actor} marked {report} as resolved"
>
<span slot="actor">@{{ log.actor.preferredUsername }}</span>
<router-link
:to="{ name: RouteName.REPORT, params: { reportId: log.object.id } }"
slot="report"
>{{ $t("report #{report_number}", { report_number: log.object.id }) }}
</router-link>
</i18n>
<i18n
v-else-if="log.action === ActionLogAction.NOTE_CREATION"
tag="span"
path="{actor} added a note on {report}"
>
<span slot="actor">@{{ log.actor.preferredUsername }}</span>
<router-link <router-link
v-if="log.object.report" v-if="log.object.report"
:to="{ name: RouteName.REPORT, params: { reportId: log.object.report.id } }" :to="{ name: RouteName.REPORT, params: { reportId: log.object.report.id } }"
>report #{{ log.object.report.id }}</router-link slot="report"
> >{{ $t("report #{report_number}", { report_number: log.object.report.id }) }}
<span v-else>a non-existent report</span> </router-link>
</span> <span v-else slot="report">{{ $t("a non-existent report") }}</span>
<span v-else-if="log.action === ActionLogAction.EVENT_DELETION" </i18n>
>deleted an event named « {{ log.object.title }} »</span <i18n
v-else-if="log.action === ActionLogAction.EVENT_DELETION"
tag="span"
path='{actor} deleted an event named "{title}"'
> >
<span slot="actor">@{{ log.actor.preferredUsername }}</span>
<span slot="title">{{ log.object.title }}</span>
</i18n>
<br /> <br />
<small>{{ log.insertedAt | formatDateTimeString }}</small> <small>{{ log.insertedAt | formatDateTimeString }}</small>
</div> </div>
<!-- <pre>{{ log }}</pre>-->
</li> </li>
</ul> </ul>
<div v-else> <div v-else>
<b-message type="is-info">{{ $t('No moderation logs yet') }}</b-message> <b-message type="is-info">{{ $t("No moderation logs yet") }}</b-message>
</div> </div>
</section> </section>
</template> </template>
@ -73,7 +99,7 @@ export default class ReportList extends Vue {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
img.image { img.image {
display: inline; display: inline-block;
height: 1.5em; height: 1.5em;
vertical-align: text-bottom; vertical-align: text-bottom;
} }