@@ -8,7 +8,7 @@ import type { OCSResponse } from '@nextcloud/typings/ocs'
88import { emit } from '@nextcloud/event-bus'
99import { generateOcsUrl } from '@nextcloud/router'
1010import { showError , showLoading , showSuccess } from '@nextcloud/dialogs'
11- import { t } from '@nextcloud/l10n'
11+ import { n , t } from '@nextcloud/l10n'
1212import axios , { isAxiosError } from '@nextcloud/axios'
1313import PQueue from 'p-queue'
1414
@@ -21,8 +21,8 @@ type ConversionResponse = {
2121}
2222
2323interface PromiseRejectedResult < T > {
24- status : 'rejected'
25- reason : T
24+ status : 'rejected'
25+ reason : T
2626}
2727
2828type PromiseSettledResult < T , E > = PromiseFulfilledResult < T > | PromiseRejectedResult < E > ;
@@ -62,23 +62,16 @@ export const convertFiles = async function(fileIds: number[], targetMimeType: st
6262 return
6363 }
6464
65- // A single file failed
66- if ( failed . length === 1 ) {
67- // If we have a message for the failed file, show it
68- if ( messages [ 0 ] ) {
69- showError ( t ( 'files' , 'One file could not be converted: {message}' , { message : messages [ 0 ] } ) )
70- return
71- }
72-
73- // Otherwise, show a generic error
74- showError ( t ( 'files' , 'One file could not be converted' ) )
65+ // A single file failed and if we have a message for the failed file, show it
66+ if ( failed . length === 1 && messages [ 0 ] ) {
67+ showError ( t ( 'files' , 'One file could not be converted: {message}' , { message : messages [ 0 ] } ) )
7568 return
7669 }
7770
7871 // We already check above when all files failed
7972 // if we're here, we have a mix of failed and successful files
80- showError ( t ( 'files' , '{count} files could not be converted' , { count : failed . length } ) )
81- showSuccess ( t ( 'files' , '{count} files successfully converted' , { count : fileIds . length - failed . length } ) )
73+ showError ( n ( 'files' , 'One file could not be converted' , '%n files could not be converted' , failed . length ) )
74+ showSuccess ( n ( 'files' , 'One file successfully converted' , '%n files successfully converted' , fileIds . length - failed . length ) )
8275 return
8376 }
8477
0 commit comments