fix: make sure subscription strings work consistently across languages
This commit is contained in:
parent
a895bde661
commit
172d353df7
2 changed files with 72 additions and 14 deletions
|
@ -69,17 +69,38 @@ const emit = defineEmits(['update:modelValue'])
|
||||||
const subscriptionService = shallowRef(new SubscriptionService())
|
const subscriptionService = shallowRef(new SubscriptionService())
|
||||||
|
|
||||||
const {t} = useI18n({useScope: 'global'})
|
const {t} = useI18n({useScope: 'global'})
|
||||||
|
|
||||||
const tooltipText = computed(() => {
|
const tooltipText = computed(() => {
|
||||||
if (disabled.value) {
|
if (disabled.value) {
|
||||||
return t('task.subscription.subscribedThroughParent', {
|
if (props.entity === 'list' && subscriptionEntity.value === 'namespace') {
|
||||||
entity: props.entity,
|
return t('task.subscription.subscribedListThroughParentNamespace')
|
||||||
parent: subscriptionEntity.value,
|
}
|
||||||
})
|
if (props.entity === 'task' && subscriptionEntity.value === 'namespace') {
|
||||||
|
return t('task.subscription.subscribedTaskThroughParentNamespace')
|
||||||
|
}
|
||||||
|
if (props.entity === 'task' && subscriptionEntity.value === 'list') {
|
||||||
|
return t('task.subscription.subscribedTaskThroughParentList')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (props.entity) {
|
||||||
|
case 'namespace':
|
||||||
return props.modelValue !== null ?
|
return props.modelValue !== null ?
|
||||||
t('task.subscription.subscribed', {entity: props.entity}) :
|
t('task.subscription.subscribedNamespace') :
|
||||||
t('task.subscription.notSubscribed', {entity: props.entity})
|
t('task.subscription.notSubscribedNamespace')
|
||||||
|
case 'list':
|
||||||
|
return props.modelValue !== null ?
|
||||||
|
t('task.subscription.subscribedList') :
|
||||||
|
t('task.subscription.notSubscribedList')
|
||||||
|
case 'task':
|
||||||
|
return props.modelValue !== null ?
|
||||||
|
t('task.subscription.subscribedTask') :
|
||||||
|
t('task.subscription.notSubscribedTask')
|
||||||
|
}
|
||||||
|
|
||||||
|
return ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const buttonText = computed(() => props.modelValue ? t('task.subscription.unsubscribe') : t('task.subscription.subscribe'))
|
const buttonText = computed(() => props.modelValue ? t('task.subscription.unsubscribe') : t('task.subscription.subscribe'))
|
||||||
|
@ -105,7 +126,20 @@ async function subscribe() {
|
||||||
})
|
})
|
||||||
await subscriptionService.value.create(subscription)
|
await subscriptionService.value.create(subscription)
|
||||||
emit('update:modelValue', subscription)
|
emit('update:modelValue', subscription)
|
||||||
success({message: t('task.subscription.subscribeSuccess', {entity: props.entity})})
|
|
||||||
|
let message = ''
|
||||||
|
switch (props.entity) {
|
||||||
|
case 'namespace':
|
||||||
|
message = t('task.subscription.subscribeSuccessNamespace')
|
||||||
|
break
|
||||||
|
case 'list':
|
||||||
|
message = t('task.subscription.subscribeSuccessList')
|
||||||
|
break
|
||||||
|
case 'task':
|
||||||
|
message = t('task.subscription.subscribeSuccessTask')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
success({message})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function unsubscribe() {
|
async function unsubscribe() {
|
||||||
|
@ -115,6 +149,19 @@ async function unsubscribe() {
|
||||||
})
|
})
|
||||||
await subscriptionService.value.delete(subscription)
|
await subscriptionService.value.delete(subscription)
|
||||||
emit('update:modelValue', null)
|
emit('update:modelValue', null)
|
||||||
success({message: t('task.subscription.unsubscribeSuccess', {entity: props.entity})})
|
|
||||||
|
let message = ''
|
||||||
|
switch (props.entity) {
|
||||||
|
case 'namespace':
|
||||||
|
message = t('task.subscription.unsubscribeSuccessNamespace')
|
||||||
|
break
|
||||||
|
case 'list':
|
||||||
|
message = t('task.subscription.unsubscribeSuccessList')
|
||||||
|
break
|
||||||
|
case 'task':
|
||||||
|
message = t('task.subscription.unsubscribeSuccessTask')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
success({message})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -169,6 +169,7 @@
|
||||||
"title": "List Title",
|
"title": "List Title",
|
||||||
"color": "Color",
|
"color": "Color",
|
||||||
"lists": "Lists",
|
"lists": "Lists",
|
||||||
|
"list": "List",
|
||||||
"search": "Type to search for a list…",
|
"search": "Type to search for a list…",
|
||||||
"searchSelect": "Click or press enter to select this list",
|
"searchSelect": "Click or press enter to select this list",
|
||||||
"shared": "Shared Lists",
|
"shared": "Shared Lists",
|
||||||
|
@ -675,13 +676,23 @@
|
||||||
"updated": "Updated"
|
"updated": "Updated"
|
||||||
},
|
},
|
||||||
"subscription": {
|
"subscription": {
|
||||||
"subscribedThroughParent": "You can't unsubscribe here because you are subscribed to this {entity} through its {parent}.",
|
"subscribedListThroughParentNamespace": "You can't unsubscribe here because you are subscribed to this list through its namespace.",
|
||||||
"subscribed": "You are currently subscribed to this {entity} and will receive notifications for changes.",
|
"subscribedTaskThroughParentNamespace": "You can't unsubscribe here because you are subscribed to this task through its namespace.",
|
||||||
"notSubscribed": "You are not subscribed to this {entity} and won't receive notifications for changes.",
|
"subscribedTaskThroughParentList": "You can't unsubscribe here because you are subscribed to this task through its list.",
|
||||||
|
"subscribedNamespace": "You are currently subscribed to this namespace and will receive notifications for changes.",
|
||||||
|
"notSubscribedNamespace": "You are not subscribed to this namespace and won't receive notifications for changes.",
|
||||||
|
"subscribedList": "You are currently subscribed to this list and will receive notifications for changes.",
|
||||||
|
"notSubscribedList": "You are not subscribed to this list and won't receive notifications for changes.",
|
||||||
|
"subscribedTask": "You are currently subscribed to this task and will receive notifications for changes.",
|
||||||
|
"notSubscribedTask": "You are not subscribed to this task and won't receive notifications for changes.",
|
||||||
"subscribe": "Subscribe",
|
"subscribe": "Subscribe",
|
||||||
"unsubscribe": "Unsubscribe",
|
"unsubscribe": "Unsubscribe",
|
||||||
"subscribeSuccess": "You are now subscribed to this {entity}",
|
"subscribeSuccessNamespace": "You are now subscribed to this namespace",
|
||||||
"unsubscribeSuccess": "You are now unsubscribed to this {entity}"
|
"unsubscribeSuccessNamespace": "You are now unsubscribed to this namespace",
|
||||||
|
"subscribeSuccessList": "You are now subscribed to this list",
|
||||||
|
"unsubscribeSuccessList": "You are now unsubscribed to this list",
|
||||||
|
"subscribeSuccessTask": "You are now subscribed to this task",
|
||||||
|
"unsubscribeSuccessTask": "You are now unsubscribed to this task"
|
||||||
},
|
},
|
||||||
"attachment": {
|
"attachment": {
|
||||||
"title": "Attachments",
|
"title": "Attachments",
|
||||||
|
|
Loading…
Reference in a new issue