From 8d1d77772ef0169a2e8eba81138f372df6d84632 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Wed, 3 Mar 2021 17:07:09 +0100 Subject: FEAT(client): Add option to print translation dirs In order to figure out where Mumble _really_ tries to look for translation files (*.qm) on the local disk, this commit adds an option that will cause Mumble to print out the list of directories it will search (in order). --- src/mumble/main.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp index bad20b746..587e84b25 100644 --- a/src/mumble/main.cpp +++ b/src/mumble/main.cpp @@ -224,6 +224,7 @@ int main(int argc, char **argv) { bool suppressIdentity = false; bool customJackClientName = false; bool bRpcMode = false; + bool printTranslationDirs = false; QString rpcCommand; QUrl url; QStringList extraTranslationDirs; @@ -281,6 +282,10 @@ int main(int argc, char **argv) { " the bundled ones\n" " Directories added this way have higher priority than\n" " the default locations used otherwise\n" + " --print-translation-dirs\n" + " Print out the paths in which Mumble will search for\n" + " translation files that overwrite the bundled ones.\n" + " (Useful for translators testing their translations)\n" "\n"); QString rpcHelpBanner = MainWindow::tr("Remote controlling Mumble:\n" "\n"); @@ -369,6 +374,8 @@ int main(int argc, char **argv) { Global::get().bDebugDumpInput = true; } else if (args.at(i) == QLatin1String("--print-echocancel-queue")) { Global::get().bDebugPrintQueue = true; + } else if (args.at(i) == "--print-translation-dirs") { + printTranslationDirs = true; } else if (args.at(i) == "--translation-dir") { if (i + 1 < args.count()) { extraTranslationDirs.append(args.at(i + 1)); @@ -412,6 +419,24 @@ int main(int argc, char **argv) { extraTranslationDirs.append(QDir::cleanPath(currentHomePath + QDir::separator() + "MumbleTranslations")); } + if (printTranslationDirs) { + QString infoString = QObject::tr("The directories in which Mumble searches for extra translation files are:\n"); + + int counter = 1; + for (const QString ¤tTranslationDir : extraTranslationDirs) { + infoString += QString::fromLatin1("%1. ").arg(counter) + currentTranslationDir + "\n"; + counter++; + } + +#if defined(Q_OS_WIN) + QMessageBox::information(nullptr, QObject::tr("Invocation"), infoString); +#else + printf("%s", qUtf8Printable(infoString)); +#endif + + return 0; + } + #ifdef USE_DBUS # ifdef Q_OS_WIN // By default, windbus expects the path to dbus-daemon to be in PATH, and the path -- cgit v1.2.3