Skip to content

Commit 761525a

Browse files
committed
fix(files): add plural form for selected nodes
Reported at Transifex: > This string needs pluralization feature, because in some languages translation of "selected" differs between singular and plural. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 758c905 commit 761525a

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

apps/files/src/components/FilesListVirtual.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
</template>
2222

2323
<template v-if="!isNoneSelected" #header-overlay>
24-
<span class="files-list__selected">{{ t('files', '{count} selected', { count: selectedNodes.length }) }}</span>
24+
<span class="files-list__selected">
25+
{{ n('files', '{count} selected', '{count} selected', selectedNodes.length, { count: selectedNodes.length }) }}
26+
</span>
2527
<FilesListTableHeaderActions :current-view="currentView"
2628
:selected-nodes="selectedNodes" />
2729
</template>
@@ -65,8 +67,8 @@ import type { Location } from 'vue-router'
6567
6668
import { Folder, View, getFileActions, FileType } from '@nextcloud/files'
6769
import { showError } from '@nextcloud/dialogs'
68-
import { translate as t } from '@nextcloud/l10n'
6970
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
71+
import { n, t } from '@nextcloud/l10n'
7072
import { defineComponent } from 'vue'
7173
7274
import { action as sidebarAction } from '../actions/sidebarAction.ts'
@@ -130,6 +132,9 @@ export default defineComponent({
130132
131133
userConfigStore,
132134
selectionStore,
135+
136+
n,
137+
t,
133138
}
134139
},
135140
@@ -353,8 +358,6 @@ export default defineComponent({
353358
tableElement.scrollTop = tableElement.scrollTop + 25
354359
}
355360
},
356-
357-
t,
358361
},
359362
})
360363
</script>

cypress/e2e/files/files-selection.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('files: Select all files', { testIsolation: true }, () => {
4040

4141
selectAllFiles()
4242

43-
cy.get('.files-list__selected').should('have.text', '7 selected')
43+
cy.get('.files-list__selected').should('contain.text', '7 selected')
4444
cy.get('[data-cy-files-list-row-checkbox]').findByRole('checkbox').should('be.checked')
4545

4646
deselectAllFiles()
@@ -59,7 +59,7 @@ describe('files: Select all files', { testIsolation: true }, () => {
5959

6060
randomFiles.forEach(name => selectRowForFile(name))
6161

62-
cy.get('.files-list__selected').should('have.text', `${randomFiles.length} selected`)
62+
cy.get('.files-list__selected').should('contain.text', `${randomFiles.length} selected`)
6363
cy.get('[data-cy-files-list-row-checkbox] input[type="checkbox"]:checked').should('have.length', randomFiles.length)
6464
})
6565

@@ -70,7 +70,7 @@ describe('files: Select all files', { testIsolation: true }, () => {
7070
selectRowForFile('readme.md', { shiftKey: true })
7171
cy.window().trigger('keyup', { shiftKey: false, key: 'Shift' })
7272

73-
cy.get('.files-list__selected').should('have.text', '4 selected')
73+
cy.get('.files-list__selected').should('contain.text', '4 selected')
7474
cy.get('[data-cy-files-list-row-checkbox] input[type="checkbox"]:checked').should('have.length', 4)
7575

7676
})

cypress/e2e/files_trashbin/files.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('files_trashbin: download files', { testIsolation: true }, () => {
6363
it('does not offer bulk download', () => {
6464
cy.get('[data-cy-files-list-row-checkbox]').should('have.length', 2)
6565
selectAllFiles()
66-
cy.get('.files-list__selected').should('have.text', '2 selected')
66+
cy.get('.files-list__selected').should('contain.text', '2 selected')
6767
cy.get('.files-list__row-actions-batch')
6868
.should('be.visible')
6969
.within(() => {

0 commit comments

Comments
 (0)