File indexing completed on 2024-03-24 17:22:06

0001 /***************************************************************************
0002  *   Copyright (C) 2008-2011 by Daniel Nicoletti                           *
0003  *   dantti12@gmail.com                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; see the file COPYING. If not, write to       *
0017  *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
0018  *   Boston, MA 02110-1301, USA.                                           *
0019  ***************************************************************************/
0020 
0021 #include "PkStrings.h"
0022 
0023 #include <KLocalizedString>
0024 #include <KFormat>
0025 //#include <KGlobal>
0026 
0027 #include <QLoggingCategory>
0028 
0029 Q_DECLARE_LOGGING_CATEGORY(APPER_LIB)
0030 
0031 using namespace PackageKit;
0032 
0033 QString PkStrings::status(Transaction::Status status, uint speed, qulonglong downloadRemaining)
0034 {
0035     switch (status) {
0036     case Transaction::StatusUnknown:
0037         return i18nc("This is when the transaction status is not known",
0038                      "Unknown state");
0039     case Transaction::StatusSetup:
0040         return i18nc("transaction state, the daemon is in the process of starting",
0041                      "Waiting for service to start");
0042     case Transaction::StatusWait:
0043         return i18nc("transaction state, the transaction is waiting for another to complete",
0044                      "Waiting for other tasks");
0045     case Transaction::StatusRunning :
0046         return i18nc("transaction state, just started",
0047                      "Running task");
0048     case Transaction::StatusQuery :
0049         return i18nc("transaction state, is querying data",
0050                      "Querying");
0051     case Transaction::StatusInfo :
0052         return i18nc("transaction state, getting data from a server",
0053                      "Getting information");
0054     case Transaction::StatusRemove :
0055         return i18nc("transaction state, removing packages",
0056                      "Removing packages");
0057     case Transaction::StatusDownload:
0058         if (speed != 0 && downloadRemaining != 0) {
0059             KFormat f;
0060             return i18nc("transaction state, downloading package files",
0061                          "Downloading at %1/s, %2 remaining",
0062                          f.formatByteSize(speed),
0063                          f.formatByteSize(downloadRemaining));
0064         } else if (speed != 0 && downloadRemaining == 0) {
0065             KFormat f;
0066             return i18nc("transaction state, downloading package files",
0067                          "Downloading at %1/s",
0068                          f.formatByteSize(speed));
0069         } else if (speed == 0 && downloadRemaining != 0) {
0070             KFormat f;
0071             return i18nc("transaction state, downloading package files",
0072                          "Downloading, %1 remaining",
0073                          f.formatByteSize(downloadRemaining));
0074         } else {
0075             return i18nc("transaction state, downloading package files",
0076                          "Downloading");
0077         }
0078     case Transaction::StatusInstall :
0079         return i18nc("transaction state, installing packages",
0080                      "Installing packages");
0081     case Transaction::StatusRefreshCache :
0082         return i18nc("transaction state, refreshing internal lists",
0083                      "Refreshing software list");
0084     case Transaction::StatusUpdate :
0085         return i18nc("transaction state, installing updates",
0086                      "Updating packages");
0087     case Transaction::StatusCleanup :
0088         return i18nc("transaction state, removing old packages, and cleaning config files",
0089                      "Cleaning up packages");
0090     case Transaction::StatusObsolete :
0091         return i18nc("transaction state, obsoleting old packages",
0092                      "Obsoleting packages");
0093     case Transaction::StatusDepResolve :
0094         return i18nc("transaction state, checking the transaction before we do it",
0095                      "Resolving dependencies");
0096     case Transaction::StatusSigCheck :
0097         return i18nc("transaction state, checking if we have all the security keys for the operation",
0098                      "Checking signatures");
0099     case Transaction::StatusTestCommit :
0100         return i18nc("transaction state, when we're doing a test transaction",
0101                      "Testing changes");
0102     case Transaction::StatusCommit :
0103         return i18nc("transaction state, when we're writing to the system package database",
0104                      "Committing changes");
0105     case Transaction::StatusRequest :
0106         return i18nc("transaction state, requesting data from a server",
0107                      "Requesting data");
0108     case Transaction::StatusFinished :
0109         return i18nc("transaction state, all done!",
0110                      "Finished");
0111     case Transaction::StatusCancel :
0112         return i18nc("transaction state, in the process of cancelling",
0113                      "Cancelling");
0114     case Transaction::StatusDownloadRepository :
0115         return i18nc("transaction state, downloading metadata",
0116                      "Downloading repository information");
0117     case Transaction::StatusDownloadPackagelist :
0118         return i18nc("transaction state, downloading metadata",
0119                      "Downloading list of packages");
0120     case Transaction::StatusDownloadFilelist :
0121         return i18nc("transaction state, downloading metadata",
0122                      "Downloading file lists");
0123     case Transaction::StatusDownloadChangelog :
0124         return i18nc("transaction state, downloading metadata",
0125                      "Downloading lists of changes");
0126     case Transaction::StatusDownloadGroup :
0127         return i18nc("transaction state, downloading metadata",
0128                      "Downloading groups");
0129     case Transaction::StatusDownloadUpdateinfo :
0130         return i18nc("transaction state, downloading metadata",
0131                      "Downloading update information");
0132     case Transaction::StatusRepackaging :
0133         return i18nc("transaction state, repackaging delta files",
0134                      "Repackaging files");
0135     case Transaction::StatusLoadingCache :
0136         return i18nc("transaction state, loading databases",
0137                      "Loading cache");
0138     case Transaction::StatusScanApplications :
0139         return i18nc("transaction state, scanning for running processes",
0140                      "Scanning installed applications");
0141     case Transaction::StatusGeneratePackageList :
0142         return i18nc("transaction state, generating a list of packages installed on the system",
0143                      "Generating package lists");
0144     case Transaction::StatusWaitingForLock :
0145         return i18nc("transaction state, when we're waiting for the native tools to exit",
0146                      "Waiting for package manager lock");
0147     case Transaction::StatusWaitingForAuth :
0148         return i18nc("waiting for user to type in a password",
0149                      "Waiting for authentication");
0150     case Transaction::StatusScanProcessList :
0151         return i18nc("we are updating the list of processes",
0152                      "Updating the list of running applications");
0153     case Transaction::StatusCheckExecutableFiles :
0154         return i18nc("we are checking executable files in use",
0155                      "Checking for applications currently in use");
0156     case Transaction::StatusCheckLibraries :
0157         return i18nc("we are checking for libraries in use",
0158                      "Checking for libraries currently in use");
0159     case Transaction::StatusCopyFiles :
0160         return i18nc("we are copying package files to prepare to install",
0161                      "Copying files");
0162     case Transaction::StatusRunHook :
0163         return i18nc("we are running hooks pre or post transaction",
0164                      "Running hooks");
0165     }
0166     qCWarning(APPER_LIB) << "status unrecognised: " << status;
0167     return QString();
0168 }
0169 
0170 QString PkStrings::status(int status, uint speed, qulonglong downloadRemaining)
0171 {
0172     return PkStrings::status(static_cast<Transaction::Status>(status), speed, downloadRemaining);
0173 }
0174 
0175 QString PkStrings::statusPast(Transaction::Status status)
0176 {
0177     switch (status) {
0178     case Transaction::StatusDownload:
0179         return i18nc("The action of the package, in past tense", "Downloaded");
0180     case Transaction::StatusUpdate:
0181         return i18nc("The action of the package, in past tense", "Updated");
0182     case Transaction::StatusInstall:
0183         return i18nc("The action of the package, in past tense", "Installed");
0184     case Transaction::StatusRemove:
0185         return i18nc("The action of the package, in past tense", "Removed");
0186     case Transaction::StatusCleanup:
0187         return i18nc("The action of the package, in past tense", "Cleaned Up");
0188     case Transaction::StatusObsolete:
0189         return i18nc("The action of the package, in past tense", "Obsoleted");
0190     default : // In this case we don't want to map all enums
0191         qCWarning(APPER_LIB) << "status unrecognised: " << status;
0192         return QString();
0193     }
0194 }
0195 
0196 QString PkStrings::action(Transaction::Role role, Transaction::TransactionFlags flags)
0197 {
0198     switch (role) {
0199     case Transaction::RoleUnknown :
0200         return i18nc("The role of the transaction, in present tense", "Unknown role type");
0201     case Transaction::RoleDependsOn :
0202         return i18nc("The role of the transaction, in present tense", "Getting dependencies");
0203     case Transaction::RoleGetUpdateDetail :
0204         return i18nc("The role of the transaction, in present tense", "Getting update detail");
0205     case Transaction::RoleGetDetails:
0206     case Transaction::RoleGetDetailsLocal:
0207         return i18nc("The role of the transaction, in present tense", "Getting details");
0208     case Transaction::RoleRequiredBy :
0209         return i18nc("The role of the transaction, in present tense", "Getting requires");
0210     case Transaction::RoleGetUpdates :
0211         return i18nc("The role of the transaction, in present tense", "Getting updates");
0212     case Transaction::RoleSearchDetails :
0213         return i18nc("The role of the transaction, in present tense", "Searching details");
0214     case Transaction::RoleSearchFile :
0215         return i18nc("The role of the transaction, in present tense", "Searching for file");
0216     case Transaction::RoleSearchGroup :
0217         return i18nc("The role of the transaction, in present tense", "Searching groups");
0218     case Transaction::RoleSearchName :
0219         return i18nc("The role of the transaction, in present tense", "Searching by package name");
0220     case Transaction::RoleRemovePackages :
0221         if (flags & Transaction::TransactionFlagSimulate) {
0222             return i18nc("The role of the transaction, in present tense", "Simulating removal");
0223         } else if (flags & Transaction::TransactionFlagOnlyDownload) {
0224             return i18nc("The role of the transaction, in present tense", "Downloading packages");
0225         }
0226         return i18nc("The role of the transaction, in present tense", "Removing");
0227     case Transaction::RoleInstallPackages :
0228         if (flags & Transaction::TransactionFlagSimulate) {
0229             return i18nc("The role of the transaction, in present tense", "Simulating install");
0230         } else if (flags & Transaction::TransactionFlagOnlyDownload) {
0231             return i18nc("The role of the transaction, in present tense", "Downloading packages");
0232         }
0233         return i18nc("The role of the transaction, in present tense", "Installing");
0234     case Transaction::RoleInstallFiles :
0235         if (flags & Transaction::TransactionFlagSimulate) {
0236             return i18nc("The role of the transaction, in present tense", "Simulating file install");
0237         } else if (flags & Transaction::TransactionFlagOnlyDownload) {
0238             return i18nc("The role of the transaction, in present tense", "Downloading required packages");
0239         }
0240         return i18nc("The role of the transaction, in present tense", "Installing file");
0241     case Transaction::RoleRefreshCache :
0242         return i18nc("The role of the transaction, in present tense", "Refreshing package cache");
0243     case Transaction::RoleUpdatePackages :
0244         if (flags & Transaction::TransactionFlagSimulate) {
0245             return i18nc("The role of the transaction, in present tense", "Simulating update");
0246         } else if (flags & Transaction::TransactionFlagOnlyDownload) {
0247             return i18nc("The role of the transaction, in present tense", "Downloading updates");
0248         }
0249         return i18nc("The role of the transaction, in present tense", "Updating packages");
0250     case Transaction::RoleCancel :
0251         return i18nc("The role of the transaction, in present tense", "Canceling");
0252     case Transaction::RoleGetRepoList :
0253         return i18nc("The role of the transaction, in present tense", "Getting list of repositories");
0254     case Transaction::RoleRepoEnable :
0255         return i18nc("The role of the transaction, in present tense", "Enabling repository");
0256     case Transaction::RoleRepoSetData :
0257         return i18nc("The role of the transaction, in present tense", "Setting repository data");
0258     case Transaction::RoleResolve :
0259         return i18nc("The role of the transaction, in present tense", "Resolving");
0260     case Transaction::RoleGetFiles:
0261     case Transaction::RoleGetFilesLocal:
0262         return i18nc("The role of the transaction, in present tense", "Getting file list");
0263     case Transaction::RoleWhatProvides :
0264         return i18nc("The role of the transaction, in present tense", "Getting what provides");
0265     case Transaction::RoleInstallSignature :
0266         return i18nc("The role of the transaction, in present tense", "Installing signature");
0267     case Transaction::RoleGetPackages :
0268         return i18nc("The role of the transaction, in present tense", "Getting package lists");
0269     case Transaction::RoleAcceptEula :
0270         return i18nc("The role of the transaction, in present tense", "Accepting EULA");
0271     case Transaction::RoleDownloadPackages :
0272         return i18nc("The role of the transaction, in present tense", "Downloading packages");
0273     case Transaction::RoleGetDistroUpgrades :
0274         return i18nc("The role of the transaction, in present tense", "Getting distribution upgrade information");
0275     case Transaction::RoleGetCategories :
0276         return i18nc("The role of the transaction, in present tense", "Getting categories");
0277     case Transaction::RoleGetOldTransactions :
0278         return i18nc("The role of the transaction, in present tense", "Getting old transactions");
0279     case Transaction::RoleRepairSystem :
0280         return i18nc("The role of the transaction, in present tense", "Repairing system");
0281     case Transaction::RoleRepoRemove:
0282         return i18nc("The role of the transaction, in present tense", "Removing repository");
0283     case Transaction::RoleUpgradeSystem:
0284         return i18nc("The role of the transaction, in present tense", "Upgrading the system");
0285     }
0286     qCWarning(APPER_LIB) << "action unrecognised: " << role;
0287     return QString();
0288 }
0289 
0290 QString PkStrings::action(int role, int flags)
0291 {
0292     return PkStrings::action(static_cast<Transaction::Role>(role), static_cast<Transaction::TransactionFlags>(flags));
0293 }
0294 
0295 QString PkStrings::actionPast(Transaction::Role action)
0296 {
0297     switch (action) {
0298     case Transaction::RoleUnknown:
0299         return i18nc("The role of the transaction, in past tense", "Unknown role type");
0300     case Transaction::RoleDependsOn :
0301         return i18nc("The role of the transaction, in past tense", "Got dependencies");
0302     case Transaction::RoleGetUpdateDetail :
0303         return i18nc("The role of the transaction, in past tense", "Got update detail");
0304     case Transaction::RoleGetDetails:
0305     case Transaction::RoleGetDetailsLocal:
0306         return i18nc("The role of the transaction, in past tense", "Got details");
0307     case Transaction::RoleRequiredBy :
0308         return i18nc("The role of the transaction, in past tense", "Got requires");
0309     case Transaction::RoleGetUpdates :
0310         return i18nc("The role of the transaction, in past tense", "Got updates");
0311     case Transaction::RoleSearchDetails :
0312         return i18nc("The role of the transaction, in past tense", "Searched for package details");
0313     case Transaction::RoleSearchFile :
0314         return i18nc("The role of the transaction, in past tense", "Searched for file");
0315     case Transaction::RoleSearchGroup :
0316         return i18nc("The role of the transaction, in past tense", "Searched groups");
0317     case Transaction::RoleSearchName :
0318         return i18nc("The role of the transaction, in past tense", "Searched for package name");
0319     case Transaction::RoleRemovePackages :
0320         return i18nc("The role of the transaction, in past tense", "Removed packages");
0321     case Transaction::RoleInstallPackages :
0322         return i18nc("The role of the transaction, in past tense", "Installed packages");
0323     case Transaction::RoleInstallFiles :
0324         return i18nc("The role of the transaction, in past tense", "Installed local files");
0325     case Transaction::RoleRefreshCache :
0326         return i18nc("The role of the transaction, in past tense", "Refreshed package cache");
0327     case Transaction::RoleUpdatePackages :
0328         return i18nc("The role of the transaction, in past tense", "Updated packages");
0329     case Transaction::RoleCancel :
0330         return i18nc("The role of the transaction, in past tense", "Canceled");
0331     case Transaction::RoleGetRepoList :
0332         return i18nc("The role of the transaction, in past tense", "Got list of repositories");
0333     case Transaction::RoleRepoEnable :
0334         return i18nc("The role of the transaction, in past tense", "Enabled repository");
0335     case Transaction::RoleRepoSetData :
0336         return i18nc("The role of the transaction, in past tense", "Set repository data");
0337     case Transaction::RoleResolve :
0338         return i18nc("The role of the transaction, in past tense", "Resolved");
0339     case Transaction::RoleGetFiles:
0340     case Transaction::RoleGetFilesLocal:
0341         return i18nc("The role of the transaction, in past tense", "Got file list");
0342     case Transaction::RoleWhatProvides :
0343         return i18nc("The role of the transaction, in past tense", "Got what provides");
0344     case Transaction::RoleInstallSignature :
0345         return i18nc("The role of the transaction, in past tense", "Installed signature");
0346     case Transaction::RoleGetPackages :
0347         return i18nc("The role of the transaction, in past tense", "Got package lists");
0348     case Transaction::RoleAcceptEula :
0349         return i18nc("The role of the transaction, in past tense", "Accepted EULA");
0350     case Transaction::RoleDownloadPackages :
0351         return i18nc("The role of the transaction, in past tense", "Downloaded packages");
0352     case Transaction::RoleGetDistroUpgrades :
0353         return i18nc("The role of the transaction, in past tense", "Got distribution upgrades");
0354     case Transaction::RoleGetCategories :
0355         return i18nc("The role of the transaction, in past tense", "Got categories");
0356     case Transaction::RoleGetOldTransactions :
0357         return i18nc("The role of the transaction, in past tense", "Got old transactions");
0358     case Transaction::RoleRepairSystem:
0359         return i18nc("The role of the transaction, in past tense", "Repaired system");
0360     case Transaction::RoleRepoRemove:
0361         return i18nc("The role of the transaction, in past tense", "Removed repository");
0362     case Transaction::RoleUpgradeSystem:
0363         return i18nc("The role of the transaction, in past tense", "Upgraded the system");
0364     }
0365     qCWarning(APPER_LIB) << "action unrecognised: " << action;
0366     return QString();
0367 }
0368 
0369 QString PkStrings::infoPresent(Transaction::Info info)
0370 {
0371     switch (info) {
0372     case Transaction::InfoDownloading :
0373         return i18n("Downloading");
0374     case Transaction::InfoUpdating :
0375         return i18n("Updating");
0376     case Transaction::InfoInstalling :
0377         return i18n("Installing");
0378     case Transaction::InfoRemoving :
0379         return i18n("Removing");
0380     case Transaction::InfoCleanup :
0381         return i18n("Cleaning up");
0382     case Transaction::InfoObsoleting :
0383         return i18n("Obsoleting");
0384     case Transaction::InfoReinstalling :
0385         return i18n("Reinstalling");
0386     case Transaction::InfoPreparing :
0387         return i18n("Preparing");
0388     case Transaction::InfoDecompressing :
0389         return i18n("Decompressing");
0390     default :
0391         qCWarning(APPER_LIB) << "info unrecognised:" << info;
0392         return QString();
0393     }
0394 }
0395 
0396 QString PkStrings::infoPast(Transaction::Info info)
0397 {
0398     switch (info) {
0399     case Transaction::InfoDownloading :
0400         return i18n("Downloaded");
0401     case Transaction::InfoUpdating :
0402         return i18n("Updated");
0403     case Transaction::InfoInstalling :
0404         return i18n("Installed");
0405     case Transaction::InfoRemoving :
0406         return i18n("Removed");
0407     case Transaction::InfoCleanup :
0408         return i18n("Cleaned up");
0409     case Transaction::InfoObsoleting :
0410         return i18n("Obsoleted");
0411     case Transaction::InfoReinstalling :
0412         return i18n("Reinstalled");
0413     case Transaction::InfoPreparing :
0414         return i18n("Prepared");
0415     case Transaction::InfoDecompressing :
0416         return i18n("Decompressed");
0417     default :
0418         qCWarning(APPER_LIB) << "info unrecognised: " << info;
0419         return QString();
0420     }
0421 }
0422 
0423 QString PkStrings::error(Transaction::Error error)
0424 {
0425     switch (error) {
0426     case Transaction::ErrorNoNetwork :
0427         return i18n("No network connection available");
0428     case Transaction::ErrorNoCache :
0429         return i18n("No package cache is available");
0430     case Transaction::ErrorOom :
0431         return i18n("Out of memory");
0432     case Transaction::ErrorCreateThreadFailed :
0433         return i18n("Failed to create a thread");
0434     case Transaction::ErrorNotSupported :
0435         return i18n("Not supported by this backend");
0436     case Transaction::ErrorInternalError :
0437         return i18n("An internal system error has occurred");
0438     case Transaction::ErrorGpgFailure :
0439         return i18n("A security trust relationship is not present");
0440     case Transaction::ErrorPackageNotInstalled :
0441         return i18n("The package is not installed");
0442     case Transaction::ErrorPackageNotFound :
0443         return i18n("The package was not found");
0444     case Transaction::ErrorPackageAlreadyInstalled :
0445         return i18n("The package is already installed");
0446     case Transaction::ErrorPackageDownloadFailed :
0447         return i18n("The package download failed");
0448     case Transaction::ErrorGroupNotFound :
0449         return i18n("The group was not found");
0450     case Transaction::ErrorGroupListInvalid :
0451         return i18n("The group list was invalid");
0452     case Transaction::ErrorDepResolutionFailed :
0453         return i18n("Dependency resolution failed");
0454     case Transaction::ErrorFilterInvalid :
0455         return i18n("Search filter was invalid");
0456     case Transaction::ErrorPackageIdInvalid :
0457         return i18n("The package identifier was not well formed");
0458     case Transaction::ErrorTransactionError :
0459         return i18n("Transaction error");
0460     case Transaction::ErrorRepoNotFound :
0461         return i18n("Repository name was not found");
0462     case Transaction::ErrorCannotRemoveSystemPackage :
0463         return i18n("Could not remove a protected system package");
0464     case Transaction::ErrorTransactionCancelled :
0465         return i18n("The task was canceled");
0466     case Transaction::ErrorProcessKill :
0467         return i18n("The task was forcibly canceled");
0468     case Transaction::ErrorFailedConfigParsing :
0469         return i18n("Reading the config file failed");
0470     case Transaction::ErrorCannotCancel :
0471         return i18n("The task cannot be cancelled");
0472     case Transaction::ErrorCannotInstallSourcePackage :
0473         return i18n("Source packages cannot be installed");
0474     case Transaction::ErrorNoLicenseAgreement :
0475         return i18n("The license agreement failed");
0476     case Transaction::ErrorFileConflicts :
0477         return i18n("Local file conflict between packages");
0478     case Transaction::ErrorPackageConflicts :
0479         return i18n("Packages are not compatible");
0480     case Transaction::ErrorRepoNotAvailable :
0481         return i18n("Problem connecting to a software origin");
0482     case Transaction::ErrorFailedInitialization :
0483         return i18n("Failed to initialize");
0484     case Transaction::ErrorFailedFinalise :
0485         return i18n("Failed to finalize");
0486     case Transaction::ErrorCannotGetLock :
0487         return i18n("Cannot get lock");
0488     case Transaction::ErrorNoPackagesToUpdate :
0489         return i18n("No packages to update");
0490     case Transaction::ErrorCannotWriteRepoConfig :
0491         return i18n("Cannot write repository configuration");
0492     case Transaction::ErrorLocalInstallFailed :
0493         return i18n("Local install failed");
0494     case Transaction::ErrorBadGpgSignature :
0495         return i18n("Bad GPG signature");
0496     case Transaction::ErrorMissingGpgSignature :
0497         return i18n("Missing GPG signature");
0498     case Transaction::ErrorRepoConfigurationError :
0499         return i18n("Repository configuration invalid");
0500     case Transaction::ErrorInvalidPackageFile :
0501         return i18n("Invalid package file");
0502     case Transaction::ErrorPackageInstallBlocked :
0503         return i18n("Package install blocked");
0504     case Transaction::ErrorPackageCorrupt :
0505         return i18n("Package is corrupt");
0506     case Transaction::ErrorAllPackagesAlreadyInstalled :
0507         return i18n("All packages are already installed");
0508     case Transaction::ErrorFileNotFound :
0509         return i18n("The specified file could not be found");
0510     case Transaction::ErrorNoMoreMirrorsToTry :
0511         return i18n("No more mirrors are available");
0512     case Transaction::ErrorNoDistroUpgradeData :
0513         return i18n("No distribution upgrade data is available");
0514     case Transaction::ErrorIncompatibleArchitecture :
0515         return i18n("Package is incompatible with this system");
0516     case Transaction::ErrorNoSpaceOnDevice :
0517         return i18n("No space is left on the disk");
0518     case Transaction::ErrorMediaChangeRequired :
0519         return i18n("A media change is required");
0520     case Transaction::ErrorNotAuthorized :
0521         return i18n("Authorization failed");
0522     case Transaction::ErrorUpdateNotFound :
0523         return i18n("Update not found");
0524     case Transaction::ErrorCannotInstallRepoUnsigned :
0525         return i18n("Cannot install from untrusted origin");
0526     case Transaction::ErrorCannotUpdateRepoUnsigned :
0527         return i18n("Cannot update from untrusted origin");
0528     case Transaction::ErrorCannotGetFilelist :
0529         return i18n("Cannot get the file list");
0530     case Transaction::ErrorCannotGetRequires :
0531         return i18n("Cannot get package requires");
0532     case Transaction::ErrorCannotDisableRepository :
0533         return i18n("Cannot disable origin");
0534     case Transaction::ErrorRestrictedDownload :
0535         return i18n("The download failed");
0536     case Transaction::ErrorPackageFailedToConfigure :
0537         return i18n("Package failed to configure");
0538     case Transaction::ErrorPackageFailedToBuild :
0539         return i18n("Package failed to build");
0540     case Transaction::ErrorPackageFailedToInstall :
0541         return i18n("Package failed to install");
0542     case Transaction::ErrorPackageFailedToRemove :
0543         return i18n("Package failed to be removed");
0544     case Transaction::ErrorUpdateFailedDueToRunningProcess :
0545         return i18n("Update failed due to running process");
0546     case Transaction::ErrorPackageDatabaseChanged :
0547         return i18n("The package database was changed");
0548     case Transaction::ErrorProvideTypeNotSupported :
0549         return i18n("Virtual provide type is not supported");
0550     case Transaction::ErrorInstallRootInvalid :
0551         return i18n("Install root is invalid");
0552     case Transaction::ErrorCannotFetchSources :
0553         return i18n("Cannot fetch install sources");
0554     case Transaction::ErrorCancelledPriority :
0555         return i18n("Rescheduled due to priority");
0556     case Transaction::ErrorUnfinishedTransaction:
0557         return i18n("Unfinished transaction");
0558     case Transaction::ErrorLockRequired:
0559         return i18n("Lock required");
0560     case Transaction::ErrorUnknown:
0561         return i18n("Unknown error");
0562     }
0563     qCWarning(APPER_LIB) << "error unrecognised: " << error;
0564     return QString();
0565 }
0566 
0567 QString PkStrings::errorMessage(Transaction::Error error)
0568 {
0569     switch (error) {
0570     case Transaction::ErrorNoNetwork :
0571         return i18n("There is no network connection available.\n"
0572                     "Please check your connection settings and try again");
0573     case Transaction::ErrorNoCache :
0574         return i18n("The package list needs to be rebuilt.\n"
0575                     "This should have been done by the backend automatically.");
0576     case Transaction::ErrorOom :
0577         return i18n("The service that is responsible for handling user requests is out of memory.\n"
0578                     "Please close some programs or restart your computer.");
0579     case Transaction::ErrorCreateThreadFailed :
0580         return i18n("A thread could not be created to service the user request.");
0581     case Transaction::ErrorNotSupported :
0582         return i18n("The action is not supported by this backend.\n"
0583                     "Please report a bug as this should not have happened.");
0584     case Transaction::ErrorInternalError :
0585         return i18n("A problem that we were not expecting has occurred.\n"
0586                     "Please report this bug with the error description.");
0587     case Transaction::ErrorGpgFailure :
0588         return i18n("A security trust relationship could not be made with the software origin.\n"
0589                     "Please check your software signature settings.");
0590     case Transaction::ErrorPackageNotInstalled :
0591         return i18n("The package that is trying to be removed or updated is not already installed.");
0592     case Transaction::ErrorPackageNotFound :
0593         return i18n("The package that is being modified was not found on your system or in any software origin.");
0594     case Transaction::ErrorPackageAlreadyInstalled :
0595         return i18n("The package that is trying to be installed is already installed.");
0596     case Transaction::ErrorPackageDownloadFailed :
0597         return i18n("The package download failed.\n"
0598                     "Please check your network connectivity.");
0599     case Transaction::ErrorGroupNotFound :
0600         return i18n("The group type was not found.\n"
0601                     "Please check your group list and try again.");
0602     case Transaction::ErrorGroupListInvalid :
0603         return i18n("The group list could not be loaded.\n"
0604                     "Refreshing your cache may help, although this is normally a software "
0605                     "origin error.");
0606     case Transaction::ErrorDepResolutionFailed :
0607         return i18n("A package dependency could not be found.\n"
0608                     "More information is available in the detailed report.");
0609     case Transaction::ErrorFilterInvalid :
0610         return i18n("The search filter was not correctly formed.");
0611     case Transaction::ErrorPackageIdInvalid :
0612         return i18n("The package identifier was not well formed when sent to the system daemon.\n"
0613                     "This normally indicates an internal bug and should be reported.");
0614     case Transaction::ErrorTransactionError :
0615         return i18n("An error occurred while running the transaction.\n"
0616                     "More information is available in the detailed report.");
0617     case Transaction::ErrorRepoNotFound :
0618         return i18n("The remote software origin name was not found.\n"
0619                     "You may need to enable an item in Software Origins.");
0620     case Transaction::ErrorCannotRemoveSystemPackage :
0621         return i18n("Removing a protected system package is not allowed.");
0622     case Transaction::ErrorTransactionCancelled :
0623         return i18n("The task was canceled successfully and no packages were changed.");
0624     case Transaction::ErrorProcessKill :
0625         return i18n("The task was canceled successfully and no packages were changed.\n"
0626                     "The backend did not exit cleanly.");
0627     case Transaction::ErrorFailedConfigParsing :
0628         return i18n("The native package configuration file could not be opened.\n"
0629                     "Please make sure your system's configuration is valid.");
0630     case Transaction::ErrorCannotCancel :
0631         return i18n("The task is not safe to be cancelled at this time.");
0632     case Transaction::ErrorCannotInstallSourcePackage :
0633         return i18n("Source packages are not normally installed this way.\n"
0634                     "Check the extension of the file you are trying to install.");
0635     case Transaction::ErrorNoLicenseAgreement :
0636         return i18n("The license agreement was not agreed to.\n"
0637                     "To use this software you have to accept the license.");
0638     case Transaction::ErrorFileConflicts :
0639         return i18n("Two packages provide the same file.\n"
0640                     "This is usually due to mixing packages for different software origins.");
0641     case Transaction::ErrorPackageConflicts :
0642         return i18n("Multiple packages exist that are not compatible with each other.\n"
0643                     "This is usually due to mixing packages from different software origins.");
0644     case Transaction::ErrorRepoNotAvailable :
0645         return i18n("There was a (possibly temporary) problem connecting to a software origins.\n"
0646                     "Please check the detailed error for further details.");
0647     case Transaction::ErrorFailedInitialization :
0648         return i18n("Failed to initialize packaging backend.\n"
0649                     "This may occur if other packaging tools are being used simultaneously.");
0650     case Transaction::ErrorFailedFinalise :
0651         return i18n("Failed to close down the backend instance.\n"
0652                     "This error can normally be ignored.");
0653     case Transaction::ErrorCannotGetLock :
0654         return i18n("Cannot get the exclusive lock on the packaging backend.\n"
0655                     "Please close any other legacy packaging tools that may be open.");
0656     case Transaction::ErrorNoPackagesToUpdate :
0657         return i18n("None of the selected packages could be updated.");
0658     case Transaction::ErrorCannotWriteRepoConfig :
0659         return i18n("The repository configuration could not be modified.");
0660     case Transaction::ErrorLocalInstallFailed :
0661         return i18n("Installing the local file failed.\n"
0662                     "More information is available in the detailed report.");
0663     case Transaction::ErrorBadGpgSignature :
0664         return i18n("The package signature could not be verified.");
0665     case Transaction::ErrorMissingGpgSignature :
0666         return i18n("The package signature was missing and this package is untrusted.\n"
0667                     "This package was not signed with a GPG key when created.");
0668     case Transaction::ErrorRepoConfigurationError :
0669         return i18n("Repository configuration was invalid and could not be read.");
0670     case Transaction::ErrorInvalidPackageFile :
0671         return i18n("The package you are attempting to install is not valid.\n"
0672                     "The package file could be corrupt, or not a proper package.");
0673     case Transaction::ErrorPackageInstallBlocked :
0674         return i18n("Installation of this package was prevented by your packaging system's configuration.");
0675     case Transaction::ErrorPackageCorrupt :
0676         return i18n("The package that was downloaded is corrupt and needs to be downloaded again.");
0677     case Transaction::ErrorAllPackagesAlreadyInstalled :
0678         return i18n("All of the packages selected for install are already installed on the system.");
0679     case Transaction::ErrorFileNotFound :
0680         return i18n("The specified file could not be found on the system.\n"
0681                     "Check that the file still exists and has not been deleted.");
0682     case Transaction::ErrorNoMoreMirrorsToTry :
0683         return i18n("Required data could not be found on any of the configured software origins.\n"
0684                     "There were no more download mirrors that could be tried.");
0685     case Transaction::ErrorNoDistroUpgradeData :
0686         return i18n("Required upgrade data could not be found in any of the configured software origins.\n"
0687                     "The list of distribution upgrades will be unavailable.");
0688     case Transaction::ErrorIncompatibleArchitecture :
0689         return i18n("The package that is trying to be installed is incompatible with this system.");
0690     case Transaction::ErrorNoSpaceOnDevice :
0691         return i18n("There is insufficient space on the device.\n"
0692                     "Free some space on the system disk to perform this operation.");
0693     case Transaction::ErrorMediaChangeRequired :
0694         return i18n("Additional media is required to complete the transaction.");
0695     case Transaction::ErrorNotAuthorized :
0696         return i18n("You have failed to provide correct authentication.\n"
0697                     "Please check any passwords or account settings.");
0698     case Transaction::ErrorUpdateNotFound :
0699         return i18n("The specified update could not be found.\n"
0700                     "It could have already been installed or no longer available on the remote server.");
0701     case Transaction::ErrorCannotInstallRepoUnsigned :
0702         return i18n("The package could not be installed from untrusted origin.");
0703     case Transaction::ErrorCannotUpdateRepoUnsigned :
0704         return i18n("The package could not be updated from untrusted origin.");
0705     case Transaction::ErrorCannotGetFilelist :
0706         return i18n("The file list is not available for this package.");
0707     case Transaction::ErrorCannotGetRequires :
0708         return i18n("The information about what requires this package could not be obtained.");
0709     case Transaction::ErrorCannotDisableRepository :
0710         return i18n("The specified software origin could not be disabled.");
0711     case Transaction::ErrorRestrictedDownload :
0712         return i18n("The download could not be done automatically and should be done manually.\n"
0713                     "More information is available in the detailed report.");
0714     case Transaction::ErrorPackageFailedToConfigure :
0715         return i18n("One of the selected packages failed to configure correctly.\n"
0716                     "More information is available in the detailed report.");
0717     case Transaction::ErrorPackageFailedToBuild :
0718         return i18n("One of the selected packages failed to build correctly.\n"
0719                     "More information is available in the detailed report.");
0720     case Transaction::ErrorPackageFailedToInstall :
0721         return i18n("One of the selected packages failed to install correctly.\n"
0722                     "More information is available in the detailed report.");
0723     case Transaction::ErrorPackageFailedToRemove :
0724         return i18n("One of the selected packages failed to be removed correctly.\n"
0725                     "More information is available in the detailed report.");
0726     case Transaction::ErrorUpdateFailedDueToRunningProcess :
0727         return i18n("A program is running that has to be closed before the update can proceed.\n"
0728                     "More information is available in the detailed report.");
0729     case Transaction::ErrorPackageDatabaseChanged :
0730         return i18n("The package database was changed while the request was running.");
0731     case Transaction::ErrorProvideTypeNotSupported :
0732         return i18n("The virtual provide type is not supported by this system.");
0733     case Transaction::ErrorInstallRootInvalid :
0734         return i18n("The install root is invalid. Please contact your administrator.");
0735     case Transaction::ErrorCannotFetchSources :
0736         return i18n("The list of software could not be downloaded.");
0737     case Transaction::ErrorCancelledPriority :
0738         return i18n("The transaction has been cancelled and will be retried when the system is idle.");
0739     case Transaction::ErrorUnfinishedTransaction :
0740         return i18n("A previous package management transaction was interrupted.");
0741     case Transaction::ErrorLockRequired :
0742         return i18n("A package manager lock is required.");
0743     case Transaction::ErrorUnknown:
0744         return i18n("Unknown error, please report a bug.\n"
0745                     "More information is available in the detailed report.");
0746     }
0747     qCWarning(APPER_LIB) << "error unrecognised: " << error;
0748     return QString();
0749 }
0750 
0751 QString PkStrings::groups(Transaction::Group group)
0752 {
0753     switch (group) {
0754     case Transaction::GroupAccessibility :
0755         return i18nc("The group type", "Accessibility");
0756     case Transaction::GroupAccessories :
0757         return i18nc("The group type", "Accessories");
0758     case Transaction::GroupEducation :
0759         return i18nc("The group type", "Education");
0760     case Transaction::GroupGames :
0761         return i18nc("The group type", "Games");
0762     case Transaction::GroupGraphics :
0763         return i18nc("The group type", "Graphics");
0764     case Transaction::GroupInternet :
0765         return i18nc("The group type", "Internet");
0766     case Transaction::GroupOffice :
0767         return i18nc("The group type", "Office");
0768     case Transaction::GroupOther :
0769         return i18nc("The group type", "Others");
0770     case Transaction::GroupProgramming :
0771         return i18nc("The group type", "Development");
0772     case Transaction::GroupMultimedia :
0773         return i18nc("The group type", "Multimedia");
0774     case Transaction::GroupSystem :
0775         return i18nc("The group type", "System");
0776     case Transaction::GroupDesktopGnome :
0777         return i18nc("The group type", "GNOME desktop");
0778     case Transaction::GroupDesktopKde :
0779         return i18nc("The group type", "KDE desktop");
0780     case Transaction::GroupDesktopXfce :
0781         return i18nc("The group type", "XFCE desktop");
0782     case Transaction::GroupDesktopOther :
0783         return i18nc("The group type", "Other desktops");
0784     case Transaction::GroupPublishing :
0785         return i18nc("The group type", "Publishing");
0786     case Transaction::GroupServers :
0787         return i18nc("The group type", "Servers");
0788     case Transaction::GroupFonts :
0789         return i18nc("The group type", "Fonts");
0790     case Transaction::GroupAdminTools :
0791         return i18nc("The group type", "Admin tools");
0792     case Transaction::GroupLegacy :
0793         return i18nc("The group type", "Legacy");
0794     case Transaction::GroupLocalization :
0795         return i18nc("The group type", "Localization");
0796     case Transaction::GroupVirtualization :
0797         return i18nc("The group type", "Virtualization");
0798     case Transaction::GroupSecurity :
0799         return i18nc("The group type", "Security");
0800     case Transaction::GroupPowerManagement :
0801         return i18nc("The group type", "Power management");
0802     case Transaction::GroupCommunication :
0803         return i18nc("The group type", "Communication");
0804     case Transaction::GroupNetwork :
0805         return i18nc("The group type", "Network");
0806     case Transaction::GroupMaps :
0807         return i18nc("The group type", "Maps");
0808     case Transaction::GroupRepos :
0809         return i18nc("The group type", "Software sources");
0810     case Transaction::GroupScience :
0811         return i18nc("The group type", "Science");
0812     case Transaction::GroupDocumentation :
0813         return i18nc("The group type", "Documentation");
0814     case Transaction::GroupElectronics :
0815         return i18nc("The group type", "Electronics");
0816     case Transaction::GroupCollections ://TODO check this one
0817         return i18nc("The group type", "Package collections");
0818     case Transaction::GroupVendor :
0819         return i18nc("The group type", "Vendor");
0820     case Transaction::GroupNewest :
0821         return i18nc("The group type", "Newest packages");
0822     case Transaction::GroupUnknown:
0823         return i18nc("The group type", "Unknown group");
0824     }
0825     qCWarning(APPER_LIB) << "group unrecognised: " << group;
0826     return QString();
0827 }
0828 
0829 QString PkStrings::info(int state)
0830 {
0831     Transaction::Info stateEnum = static_cast<Transaction::Info>(state);
0832     switch (stateEnum) {
0833     case Transaction::InfoLow :
0834         return i18nc("The type of update", "Trivial update");
0835     case Transaction::InfoNormal :
0836         return i18nc("The type of update", "Normal update");
0837     case Transaction::InfoImportant :
0838         return i18nc("The type of update", "Important update");
0839     case Transaction::InfoSecurity :
0840         return i18nc("The type of update", "Security update");
0841     case Transaction::InfoBugfix :
0842         return i18nc("The type of update", "Bug fix update");
0843     case Transaction::InfoEnhancement :
0844         return i18nc("The type of update", "Enhancement update");
0845     case Transaction::InfoBlocked :
0846         return i18nc("The type of update", "Blocked update");
0847     case Transaction::InfoInstalled :
0848     case Transaction::InfoCollectionInstalled :
0849         return i18nc("The type of update", "Installed");
0850     case Transaction::InfoAvailable :
0851     case Transaction::InfoCollectionAvailable :
0852         return i18nc("The type of update", "Available");
0853     case Transaction::InfoUnknown:
0854         return i18nc("The type of update", "Unknown update");
0855     default : // In this case we don't want to map all enums
0856         qCWarning(APPER_LIB) << "info unrecognised: " << state;
0857         return QString();
0858     }
0859 }
0860 
0861 QString PkStrings::packageQuantity(bool updates, int packages, int selected)
0862 {
0863     if (updates) {
0864         if (packages == 0) {
0865             return i18n("No Updates Available");
0866         } else if (packages == selected) {
0867             return i18ncp("Some updates were selected on the view",
0868                           "1 Update Selected",
0869                           "%1 Updates Selected", packages);
0870         } else if (selected == 0) {
0871             return i18ncp("Some updates are being shown on the screen",
0872                           "1 Update", "%1 Updates",
0873                           packages);
0874         } else {
0875             return i18nc("Type of update, in the case it's just an update", "%1, %2",
0876                          i18ncp("Part of: %1 Updates, %1 Selected", "%1 Update", "%1 Updates", packages),
0877                          i18ncp("Part of: %1 Updates, %1 Selected", "%1 Selected", "%1 Selected", selected));
0878         }
0879     } else {
0880         if (packages == 0) {
0881             return i18n("No Packages");
0882         }
0883         return i18np("1 Package", "%1 Packages", packages);
0884     }
0885 }
0886 
0887 QString PkStrings::restartTypeFuture(Transaction::Restart value)
0888 {
0889     switch (value) {
0890     case Transaction::RestartNone:
0891         return i18n("No restart is necessary");
0892     case Transaction::RestartApplication:
0893         return i18n("You will be required to restart this application");
0894     case Transaction::RestartSession:
0895         return i18n("You will be required to log out and back in");
0896     case Transaction::RestartSystem:
0897         return i18n("A restart will be required");
0898     case Transaction::RestartSecuritySession:
0899         return i18n("You will be required to log out and back in due to a security update.");
0900     case Transaction::RestartSecuritySystem:
0901         return i18n("A restart will be required due to a security update.");
0902     case Transaction::RestartUnknown:
0903         qCWarning(APPER_LIB) << "restartTypeFuture(Transaction::RestartUnknown)";
0904         return QString();
0905     }
0906     qCWarning(APPER_LIB) << "restart unrecognised: " << value;
0907     return QString();
0908 }
0909 
0910 QString PkStrings::restartType(Transaction::Restart value)
0911 {
0912     switch (value) {
0913     case Transaction::RestartNone:
0914         return i18n("No restart is required");
0915     case Transaction::RestartSystem:
0916         return i18n("A restart is required");
0917     case Transaction::RestartSession:
0918         return i18n("You need to log out and log back in");
0919     case Transaction::RestartApplication:
0920         return i18n("You need to restart the application");
0921     case Transaction::RestartSecuritySession:
0922         return i18n("You need to log out and log back in to remain secure.");
0923     case Transaction::RestartSecuritySystem:
0924         return i18n("A restart is required to remain secure.");
0925     case Transaction::RestartUnknown:
0926         qCWarning(APPER_LIB) << "restartType(Transaction::RestartUnknown)";
0927         return QString();
0928     }
0929     qCWarning(APPER_LIB) << "restart unrecognised: " << value;
0930     return QString();
0931 }
0932 
0933 QString PkStrings::updateState(Transaction::UpdateState value)
0934 {
0935     switch (value) {
0936     case Transaction::UpdateStateStable:
0937         return i18n("Stable");
0938     case Transaction::UpdateStateUnstable:
0939         return i18n("Unstable");
0940     case Transaction::UpdateStateTesting:
0941         return i18n("Testing");
0942     case Transaction::UpdateStateUnknown:
0943         qCWarning(APPER_LIB) << "updateState(Transaction::UnknownUpdateState)";
0944         return QString();
0945     }
0946     qCWarning(APPER_LIB) << "value unrecognised: " << value;
0947     return QString();
0948 }
0949 
0950 QString PkStrings::mediaMessage(Transaction::MediaType value, const QString &text)
0951 {
0952     switch (value) {
0953     case Transaction::MediaTypeCd :
0954         return i18n("Please insert the CD labeled '%1', and press continue.", text);
0955     case Transaction::MediaTypeDvd :
0956         return i18n("Please insert the DVD labeled '%1', and press continue.", text);
0957     case Transaction::MediaTypeDisc :
0958         return i18n("Please insert the disc labeled '%1', and press continue.", text);
0959     case Transaction::MediaTypeUnknown:
0960         return i18n("Please insert the medium labeled '%1', and press continue.", text);
0961     }
0962     qCWarning(APPER_LIB) << "value unrecognised: " << value;
0963     return i18n("Please insert the medium labeled '%1', and press continue.", text);
0964 }
0965 
0966 //QString PkStrings::message(Transaction::Message value)
0967 //{
0968 //    switch (value) {
0969 //    case Transaction::MessageBrokenMirror :
0970 //        return i18n("A mirror is possibly broken");
0971 //    case Transaction::MessageConnectionRefused :
0972 //        return i18n("The connection was refused");
0973 //    case Transaction::MessageParameterInvalid :
0974 //        return i18n("The parameter was invalid");
0975 //    case Transaction::MessagePriorityInvalid :
0976 //        return i18n("The priority was invalid");
0977 //    case Transaction::MessageBackendError :
0978 //        return i18n("Backend warning");
0979 //    case Transaction::MessageDaemonError :
0980 //        return i18n("Daemon warning");
0981 //    case Transaction::MessageCacheBeingRebuilt :
0982 //        return i18n("The package list cache is being rebuilt");
0983 //    case Transaction::MessageUntrustedPackage :
0984 //        return i18n("An untrusted package was installed");
0985 //    case Transaction::MessageNewerPackageExists :
0986 //        return i18n("A newer package exists");
0987 //    case Transaction::MessageCouldNotFindPackage :
0988 //        return i18n("Could not find package");
0989 //    case Transaction::MessageConfigFilesChanged :
0990 //        return i18n("Configuration files were changed");
0991 //    case Transaction::MessagePackageAlreadyInstalled :
0992 //        return i18n("Package is already installed");
0993 //    case Transaction::MessageAutoremoveIgnored :
0994 //        return i18n("Automatic cleanup is being ignored");
0995 //    case Transaction::MessageRepoMetadataDownloadFailed :
0996 //        return i18n("Software source download failed");
0997 //    case Transaction::MessageRepoForDevelopersOnly :
0998 //        return i18n("This software source is for developers only");
0999 //    case Transaction::MessageOtherUpdatesHeldBack :
1000 //        return i18n("Other updates have been held back");
1001 //    case Transaction::MessageUnknown:
1002 //        qCWarning(APPER_LIB) << "message(Enum::UnknownMessageType)";
1003 //        return QString();
1004 //    }
1005 //    qCWarning(APPER_LIB) << "value unrecognised: " << value;
1006 //    return QString();
1007 //}
1008 
1009 QString PkStrings::daemonError(int value)
1010 {
1011     Transaction::InternalError statusEnum = static_cast<Transaction::InternalError>(value);
1012     switch (statusEnum) {
1013     case Transaction::InternalErrorFailedAuth :
1014         return i18n("You do not have the necessary privileges to perform this action.");
1015     case Transaction::InternalErrorNoTid :
1016         return i18n("Could not get a transaction id from packagekitd.");
1017     case Transaction::InternalErrorAlreadyTid :
1018         return i18n("Cannot connect to this transaction id.");
1019     case Transaction::InternalErrorRoleUnkown :
1020         return i18n("This action is unknown.");
1021     case Transaction::InternalErrorCannotStartDaemon :
1022         return i18n("The packagekitd service could not be started.");
1023     case Transaction::InternalErrorInvalidInput :
1024         return i18n("The query is not valid.");
1025     case Transaction::InternalErrorInvalidFile :
1026         return i18n("The file is not valid.");
1027     case Transaction::InternalErrorFunctionNotSupported :
1028         return i18n("This function is not yet supported.");
1029     case Transaction::InternalErrorDaemonUnreachable :
1030         return i18n("Could not talk to packagekitd.");
1031     case Transaction::InternalErrorFailed:
1032         return i18n("Error talking to packagekitd.");
1033     case Transaction::InternalErrorNone:
1034     case Transaction::InternalErrorUnkown :
1035         return i18n("An unknown error happened.");
1036     }
1037     qCWarning(APPER_LIB) << "value unrecognised: " << value;
1038     return i18n("An unknown error happened.");
1039 }
1040 
1041 QString PkStrings::prettyFormatDuration(unsigned long mSec)
1042 {
1043 
1044     return KFormat().formatSpelloutDuration(mSec);
1045 }
1046 
1047 QString PkStrings::lastCacheRefreshTitle(uint lastTime)
1048 {
1049     unsigned long fifteen = 60 * 60 * 24 * 15;
1050     unsigned long tirty = 60 * 60 * 24 * 30;
1051 
1052     if (lastTime != UINT_MAX && lastTime < fifteen) {
1053         return i18n("Your system is up to date");
1054     } else if (lastTime != UINT_MAX && lastTime > fifteen && lastTime < tirty) {
1055         return i18n("You have no updates");
1056     }
1057     return i18n("Last check for updates was more than a month ago");
1058 }
1059 
1060 QString PkStrings::lastCacheRefreshSubTitle(uint lastTime)
1061 {
1062     unsigned long tirty = 60 * 60 * 24 * 30;
1063 
1064     if (lastTime != UINT_MAX && lastTime < tirty) {
1065         return i18n("Verified %1 ago", PkStrings::prettyFormatDuration(lastTime * 1000));
1066     }
1067     return i18n("It's strongly recommended that you check for new updates now");
1068 }
1069 
1070 #include "moc_PkStrings.cpp"