fix: make task relation kinds translatable

Related to #774
This commit is contained in:
kolaente 2021-10-04 21:52:18 +02:00
parent e941394147
commit 2a1004ac68
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 31 additions and 56 deletions

View File

@ -56,9 +56,9 @@
<div class="control is-expanded"> <div class="control is-expanded">
<div class="select is-fullwidth has-defaults"> <div class="select is-fullwidth has-defaults">
<select v-model="newTaskRelationKind"> <select v-model="newTaskRelationKind">
<option value="unset">Select a relation kind</option> <option value="unset">{{ $t('task.relation.select') }}</option>
<option :key="rk" :value="rk" v-for="(label, rk) in relationKinds"> <option :key="rk" :value="rk" v-for="rk in relationKinds">
{{ label[0] }} {{ $tc(`task.relation.kinds.${rk}`, 1) }}
</option> </option>
</select> </select>
</div> </div>
@ -256,10 +256,7 @@ export default {
}) })
}, },
relationKindTitle(kind, length) { relationKindTitle(kind, length) {
if (length > 1) { return this.$tc(`task.relation.kinds.${kind}`, length)
return relationKinds[kind][1]
}
return relationKinds[kind][0]
}, },
}, },
} }

View File

@ -645,7 +645,21 @@
"noneYet": "No task relations yet.", "noneYet": "No task relations yet.",
"delete": "Delete Task Relation", "delete": "Delete Task Relation",
"deleteText1": "Are you sure you want to delete this task relation?", "deleteText1": "Are you sure you want to delete this task relation?",
"deleteText2": "This cannot be undone!" "deleteText2": "This cannot be undone!",
"select": "Select a relation kind",
"kinds": {
"subtask": "Subtask | Subtasks",
"parenttask": "Parent Task | Parent Tasks",
"related": "Related Task | Related Tasks",
"duplicateof": "Duplicate Of | Duplicates Of",
"duplicates": "Duplicates | Duplicates",
"blocking": "Blocking | Blocking",
"blocked": "Blocked By | Blocked By",
"precedes": "Precedes | Precedes",
"follows": "Follows | Follows",
"copiedfrom": "Copied From | Copied From",
"copiedto": "Copied To | Copied To"
}
}, },
"repeat": { "repeat": {
"everyDay": "Every Day", "everyDay": "Every Day",

View File

@ -1,46 +1,12 @@
{ [
"subtask": [ "subtask",
"Subtask", "parenttask",
"Subtasks" "related",
], "duplicates",
"parenttask": [ "blocking",
"Parent Task", "blocked",
"Parent Tasks" "precedes",
], "follows",
"related": [ "copiedfrom",
"Related Task", "copiedto"
"Related Tasks" ]
],
"duplicateof": [
"Duplicate Of",
"Duplicates Of"
],
"duplicates": [
"Duplicates",
"Duplicates"
],
"blocking": [
"Blocking",
"Blocking"
],
"blocked": [
"Blocked By",
"Blocked By"
],
"precedes": [
"Precedes",
"Precedes"
],
"follows": [
"Follows",
"Follows"
],
"copiedfrom": [
"Copied From",
"Copied From"
],
"copiedto": [
"Copied To",
"Copied To"
]
}

View File

@ -423,7 +423,6 @@
<script> <script>
import TaskService from '../../services/task' import TaskService from '../../services/task'
import TaskModel from '../../models/task' import TaskModel from '../../models/task'
import relationKinds from '../../models/constants/relationKinds.json'
import priorites from '../../models/constants/priorities.json' import priorites from '../../models/constants/priorities.json'
import rights from '../../models/constants/rights.json' import rights from '../../models/constants/rights.json'
@ -473,7 +472,6 @@ export default {
return { return {
taskService: new TaskService(), taskService: new TaskService(),
task: new TaskModel(), task: new TaskModel(),
relationKinds: relationKinds,
// We doubled the task color property here because verte does not have a real change property, leading // We doubled the task color property here because verte does not have a real change property, leading
// to the color property change being triggered when the # is removed from it, leading to an update, // to the color property change being triggered when the # is removed from it, leading to an update,
// which leads in turn to a change... This creates an infinite loop in which the task is updated, changed, // which leads in turn to a change... This creates an infinite loop in which the task is updated, changed,