Translate pseudo namespaces and pseudo lists

This commit is contained in:
andreymal 2021-07-08 17:51:14 +03:00
parent caa2fda2a4
commit 6412849cb3
Signed by: andreymal
GPG Key ID: CB605DA977D27A93
10 changed files with 53 additions and 13 deletions

View File

@ -54,14 +54,14 @@
<span
@click="toggleLists(n.id)"
class="menu-label"
v-tooltip="n.title + ' (' + n.lists.filter(l => !l.isArchived).length + ')'">
v-tooltip="getNamespaceTitle(n) + ' (' + n.lists.filter(l => !l.isArchived).length + ')'">
<span class="name">
<span
:style="{ backgroundColor: n.hexColor }"
class="color-bubble"
v-if="n.hexColor !== ''">
</span>
{{ n.title }} ({{ n.lists.filter(l => !l.isArchived).length }})
{{ getNamespaceTitle(n) }} ({{ n.lists.filter(l => !l.isArchived).length }})
</span>
</span>
<a
@ -91,7 +91,7 @@
v-if="l.hexColor !== ''">
</span>
<span class="list-menu-title">
{{ l.title }}
{{ getListTitle(l) }}
</span>
<span
:class="{'is-favorite': l.isFavorite}"

View File

@ -30,7 +30,7 @@
<h1
:style="{ 'opacity': currentList.title === '' ? '0': '1' }"
class="title">
{{ currentList.title === '' ? $t('misc.loading') : currentList.title }}
{{ currentList.title === '' ? $t('misc.loading') : getListTitle(currentList) }}
</h1>
<list-settings-dropdown v-if="canWriteCurrentList && currentList.id !== -1" :list="currentList"/>

View File

@ -0,0 +1,6 @@
export const getListTitle = (l, $t) => {
if (l.id === -1) {
return $t('list.pseudo.favorites.title');
}
return l.title;
}

View File

@ -0,0 +1,12 @@
export const getNamespaceTitle = (n, $t) => {
if (n.id === -1) {
return $t('namespace.pseudo.sharedLists.title');
}
if (n.id === -2) {
return $t('namespace.pseudo.favorites.title');
}
if (n.id === -3) {
return $t('namespace.pseudo.savedFilters.title');
}
return n.title;
}

View File

@ -245,6 +245,11 @@
"bucketTitleSavedSuccess": "The bucket title has been saved successfully.",
"bucketLimitSavedSuccess": "The bucket limit been saved successfully.",
"collapse": "Collapse this bucket"
},
"pseudo": {
"favorites": {
"title": "Favorites"
}
}
},
"namespace": {
@ -294,6 +299,17 @@
"color": "Color",
"archived": "Is Archived",
"isArchived": "This namespace is archived"
},
"pseudo": {
"sharedLists": {
"title": "Shared Lists"
},
"favorites": {
"title": "Favorites"
},
"savedFilters": {
"title": "Filters"
}
}
},
"filters": {

View File

@ -85,6 +85,8 @@ import vueShortkey from 'vue-shortkey'
import message from './message'
import {colorIsDark} from './helpers/color/colorIsDark'
import {setTitle} from './helpers/setTitle'
import {getNamespaceTitle} from './helpers/getNamespaceTitle'
import {getListTitle} from './helpers/getListTitle'
// Vuex
import {store} from './store'
// i18n
@ -199,6 +201,12 @@ Vue.mixin({
formatDateShort(date) {
return formatDate(date, 'PPpp', this.$t('date.locale'))
},
getNamespaceTitle(n) {
return getNamespaceTitle(n, p => this.$t(p))
},
getListTitle(l) {
return getListTitle(l, p => this.$t(p))
},
error(e, actions = []) {
return message.error(e, this, p => this.$t(p), actions)
},

View File

@ -20,7 +20,6 @@ import attachments from './modules/attachments'
import labels from './modules/labels'
import ListService from '../services/list'
import {setTitle} from '@/helpers/setTitle'
Vue.use(Vuex)
@ -69,8 +68,6 @@ export const store = new Vuex.Store({
return
}
setTitle(currentList.title)
// Not sure if this is the right way to do it but hey, it works
if (
// List changed
@ -140,4 +137,4 @@ export const store = new Vuex.Store({
state.quickActionsActive = active
},
},
})
})

View File

@ -97,7 +97,7 @@ export default {
saveListToHistory(listData)
this.setTitle(this.currentList.title)
this.setTitle(this.currentList.id ? this.getListTitle(this.currentList) : '')
// This invalidates the loaded list at the kanban board which lets it reload its content when
// switched to it. This ensures updates done to tasks in the gantt or list views are consistently
@ -144,6 +144,7 @@ export default {
.then(r => {
this.$set(this, 'list', r)
this.$store.commit(CURRENT_LIST, r)
this.setTitle(this.getListTitle(r))
})
.catch(e => {
this.error(e)
@ -154,4 +155,4 @@ export default {
},
},
}
</script>
</script>

View File

@ -39,7 +39,7 @@
</x-button>
<h1>
<span>{{ n.title }}</span>
<span>{{ getNamespaceTitle(n) }}</span>
<span class="is-archived" v-if="n.isArchived">
{{ $t('namespace.archived') }}
</span>

View File

@ -3,9 +3,9 @@
<div class="task-view">
<heading v-model="task" :can-write="canWrite" ref="heading"/>
<h6 class="subtitle" v-if="parent && parent.namespace && parent.list">
{{ parent.namespace.title }} >
{{ getNamespaceTitle(parent.namespace) }} >
<router-link :to="{ name: listViewName, params: { listId: parent.list.id } }">
{{ parent.list.title }}
{{ getListTitle(parent.list) }}
</router-link>
</h6>