diff --git a/frontend/i18n/en/projects/statistics.js b/frontend/i18n/en/projects/statistics.js index c058a6c4..9c9f4d81 100644 --- a/frontend/i18n/en/projects/statistics.js +++ b/frontend/i18n/en/projects/statistics.js @@ -1,7 +1,9 @@ export default { statistics: 'Statistics', - completed: 'Completed', - incomplete: 'Incomplete', + progress: [ + 'Completed', + 'Incomplete' + ], labelStats: 'Label stats', userStats: 'User stats' } diff --git a/frontend/i18n/fr/projects/statistics.js b/frontend/i18n/fr/projects/statistics.js index 56a53f7b..83f0e99b 100644 --- a/frontend/i18n/fr/projects/statistics.js +++ b/frontend/i18n/fr/projects/statistics.js @@ -1,7 +1,9 @@ export default { statistics: 'Statistiques', - completed: 'Complété', - incomplete: 'Incomplet', + progress: [ + 'Complété', + 'Incomplet' + ], labelStats: 'Étiqueter les stats', userStats: 'Stats des utilisateurs' } diff --git a/frontend/pages/projects/_id/statistics/index.vue b/frontend/pages/projects/_id/statistics/index.vue index eb618ffd..57f494b7 100644 --- a/frontend/pages/projects/_id/statistics/index.vue +++ b/frontend/pages/projects/_id/statistics/index.vue @@ -6,7 +6,7 @@ > @@ -16,7 +16,7 @@ > @@ -26,7 +26,7 @@ > @@ -58,7 +58,16 @@ export default { }, methods: { - ...mapActions('statistics', ['fetchStatistics']) + ...mapActions('statistics', ['fetchStatistics']), + progressLocale() { + return this.progress(this.$t('statistics.progress')) + }, + labelStatsLocale() { + return this.labelStats(this.$t('statistics.labelStats')) + }, + userStatsLocale() { + return this.userStats(this.$t('statistics.userStats')) + } }, validate({ params }) { diff --git a/frontend/store/statistics.js b/frontend/store/statistics.js index 81481819..b4efc542 100644 --- a/frontend/store/statistics.js +++ b/frontend/store/statistics.js @@ -29,25 +29,27 @@ export const mutations = { export const getters = { progress(state) { - const complete = state.stats.total - state.stats.remaining - const incomplete = state.stats.remaining - return { - datasets: [{ - data: [complete, incomplete], - backgroundColor: ['#00d1b2', '#ffdd57'] - }], - - labels: [ - 'Completed', - 'Incomplete' - ] + return (labels) => { + const complete = state.stats.total - state.stats.remaining + const incomplete = state.stats.remaining + return { + datasets: [{ + data: [complete, incomplete], + backgroundColor: ['#00d1b2', '#ffdd57'] + }], + labels + } } }, labelStats(state) { - return makeData(state.stats.label, 'Label stats') + return (label) => { + return makeData(state.stats.label, label) + } }, userStats(state) { - return makeData(state.stats.user, 'User stats') + return (label) => { + return makeData(state.stats.user, label) + } } }