added translation for CLI --help output (#839)

* added translation for CLI --help output

* improved formatting with clang-format
This commit is contained in:
Martin Eckleben
2020-09-07 14:28:43 +02:00
committed by GitHub
parent 1da8e8277f
commit 9f530fdfae
19 changed files with 2786 additions and 80 deletions

View File

@@ -61,7 +61,7 @@ optionsToString(const QList<CommandOption>& options,
// generate the text
QString result;
if (!dashedOptionList.isEmpty()) {
result += QLatin1String("Options:\n");
result += QObject::tr("Options") + ":\n";
QString linePadding = QStringLiteral(" ").repeated(size + 4).prepend("\n");
for (int i = 0; i < options.length(); ++i) {
result += QStringLiteral(" %1 %2\n")
@@ -74,7 +74,7 @@ optionsToString(const QList<CommandOption>& options,
}
}
if (!arguments.isEmpty()) {
result += QLatin1String("Arguments:\n");
result += QObject::tr("Arguments") + ":\n";
}
for (int i = 0; i < arguments.length(); ++i) {
result += QStringLiteral(" %1 %2\n")
@@ -346,15 +346,18 @@ CommandLineParser::printHelp(QStringList args, const Node* node)
if (argName.isEmpty()) {
argName = qApp->applicationName();
}
QString argText = node->subNodes.isEmpty() ? "" : "[arguments]";
helpText += QStringLiteral("Usage: %1 [%2-options] %3\n\n")
QString argText =
node->subNodes.isEmpty() ? "" : "[" + QObject::tr("arguments") + "]";
helpText += QObject::tr("Usage") + ": %1 [%2-" + QObject::tr("options") +
QStringLiteral("] %3\n\n")
.arg(args.join(QStringLiteral(" ")))
.arg(argName)
.arg(argText);
// short section about default behavior
helpText += QStringLiteral("Per default runs Flameshot in the background and \
adds a tray icon for configuration.\n\n");
helpText += QObject::tr("Per default runs Flameshot in the background and \
adds a tray icon for configuration.");
helpText += "\n\n";
// add command options and subarguments
QList<CommandArgument> subArgs;