Skip to content

Commit

Permalink
Fix checkbox label translation
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Feb 8, 2023
1 parent 2aaefd1 commit 889f407
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<template #select="{ item }">
<oc-checkbox
:id="`resource-table-select-${resourceDomSelector(item)}`"
:label="$gettext('Select %{ type }', { type: item.type })"
:label="getResourceCheckboxLabel(item)"
:hide-label="true"
size="large"
:model-value="isResourceSelected(item)"
Expand Down Expand Up @@ -771,6 +771,12 @@ export default defineComponent({
? !this.disabled.includes(resourceId)
: this.disabled !== resourceId
},
getResourceCheckboxLabel(resource) {
if (resource.type === 'folder') {
return this.$gettext('Select folder')
}
return this.$gettext('Select file')
},
getSharedWithAvatarDescription(resource) {
const resourceType =
resource.type === 'folder' ? this.$gettext('folder') : this.$gettext('file')
Expand Down
16 changes: 14 additions & 2 deletions packages/web-app-files/src/components/FilesList/ResourceTiles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
>
<template #selection>
<oc-checkbox
:label="$gettext('Select %{ type }', { type: resource.type })"
:label="getResourceCheckboxLabel(resource)"
:hide-label="true"
size="large"
class="oc-flex-inline oc-p-s"
Expand Down Expand Up @@ -182,6 +182,17 @@ export default defineComponent({
context.emit('update:selectedIds', selectedIds)
}
const getResourceCheckboxLabel = (resource) => {
switch (resource.type) {
case 'folder':
return $gettext('Select folder')
case 'space':
return $gettext('Select space')
default:
return $gettext('Select file')
}
}
onBeforeUpdate(() => {
tileRefs.value = {
tiles: [],
Expand All @@ -196,7 +207,8 @@ export default defineComponent({
showContextMenu,
tileRefs,
isResourceSelected,
setSelection
setSelection,
getResourceCheckboxLabel
}
},
data() {
Expand Down

0 comments on commit 889f407

Please sign in to comment.