Fix poor translation strings for blacklisted error reason strings
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 14 Oct 2024 02:50:24 +0000 (10:50 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 15 Oct 2024 02:59:44 +0000 (10:59 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/libsync/discovery.cpp

index 475f7aa3207be441b27423fe5bc5d319eeced493..cc61bfab548072dcc465db28ca1a25d1338391c7 100644 (file)
@@ -436,19 +436,21 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent
             item->_errorString = tr("The filename cannot be encoded on your file system.");
             break;
         case CSYNC_FILE_EXCLUDE_SERVER_BLACKLISTED:
-            item->_errorString = tr("The filename is blacklisted on the server.");
+            const auto errorString = tr("The filename is blacklisted on the server.");
+            QString reasonString;
             if (hasForbiddenFilename) {
-                item->_errorString += tr(" Reason: the entire filename is forbidden.");
+                reasonString = tr("Reason: the entire filename is forbidden.");
             }
             if (hasForbiddenBasename) {
-                item->_errorString += tr(" Reason: the filename has a forbidden base name (filename start).");
+                reasonString = tr("Reason: the filename has a forbidden base name (filename start).");
             }
             if (hasForbiddenExtension) {
-                item->_errorString += tr(" Reason: the file has a forbidden extension (.%1).").arg(extension);
+                reasonString = tr("Reason: the file has a forbidden extension (.%1).").arg(extension);
             }
             if (containsForbiddenCharacters) {
-                item->_errorString += tr(" Reason: the filename contains a forbidden character (%1).").arg(forbiddenCharMatch);
+                reasonString = tr("Reason: the filename contains a forbidden character (%1).").arg(forbiddenCharMatch);
             }
+            item->_errorString = reasonString.isEmpty() ? errorString : QString("%1 %2").arg(errorString, reasonString);
             item->_status = SyncFileItem::FileNameInvalidOnServer;
             break;
         }