Add singular/plural collection name translations (#5302)

* Add singular/plural options to collection translations

* Use singular/plural item names in related values

* Use singular / plural names on item detail

* Use singular/plural for drawer item

* Fix translation
This commit is contained in:
Rijk van Zanten
2021-04-27 16:22:52 -04:00
committed by GitHub
parent 451cdac8ef
commit 84f4a1da01
7 changed files with 72 additions and 13 deletions

View File

@@ -122,15 +122,18 @@ export default defineComponent({
const { info: collectionInfo } = useCollection(collection);
const title = computed(() => {
if (props.primaryKey === '+') {
return i18n.t('creating_in', {
collection: junctionRelatedCollectionInfo?.value?.name || collectionInfo.value?.name,
});
const collection = junctionRelatedCollectionInfo?.value || collectionInfo.value!;
const isNew = props.primaryKey === '+';
if (i18n.te(`collection_names_singular.${collection.collection}`)) {
return isNew
? i18n.t('creating_unit', { unit: i18n.t(`collection_names_singular.${collection.collection}`) })
: i18n.t('editing_unit', { unit: i18n.t(`collection_names_singular.${collection.collection}`) });
}
return i18n.t('editing_in', {
collection: junctionRelatedCollectionInfo?.value?.name || collectionInfo.value?.name,
});
return isNew
? i18n.t('creating_in', { collection: collection.name })
: i18n.t('editing_in', { collection: collection.name });
});
const showDivider = computed(() => {