From 9541b43eefa9f0b64cdb0149d222c8adb5ae03af Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 28 Feb 2024 11:23:54 +0000 Subject: [PATCH 1/4] girepository: Provide placeholders for --includedir If we don't do this, the --help text is formatted as though the option did not expect an argument. This does not introduce new translated strings: DIRECTORY was already translated. Signed-off-by: Simon McVittie --- girepository/compiler/compiler.c | 2 +- girepository/decompiler/decompiler.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/girepository/compiler/compiler.c b/girepository/compiler/compiler.c index 278f76ae1..b0fc59d45 100644 --- a/girepository/compiler/compiler.c +++ b/girepository/compiler/compiler.c @@ -144,7 +144,7 @@ log_handler (const gchar *log_domain, } static GOptionEntry options[] = { - { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, N_("Include directories in GIR search path"), NULL }, + { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, N_("Include directories in GIR search path"), N_("DIRECTORY") }, { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, N_("Output file"), N_("FILE") }, { "shared-library", 'l', 0, G_OPTION_ARG_FILENAME_ARRAY, &shlibs, N_("Shared library"), N_("FILE") }, { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Show debug messages"), NULL }, diff --git a/girepository/decompiler/decompiler.c b/girepository/decompiler/decompiler.c index 51a225383..951e11d82 100644 --- a/girepository/decompiler/decompiler.c +++ b/girepository/decompiler/decompiler.c @@ -49,7 +49,7 @@ main (int argc, char *argv[]) GOptionEntry options[] = { { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, N_("Output file"), N_("FILE") }, - { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, N_("Include directories in GIR search path"), NULL }, + { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, N_("Include directories in GIR search path"), N_("DIRECTORY") }, { "all", 0, 0, G_OPTION_ARG_NONE, &show_all, N_("Show all available information"), NULL, }, { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program’s version number and exit"), NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL }, From 1a8e2228f66b93cb18af3127dbc16ace2bb9e6d3 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 28 Feb 2024 11:25:07 +0000 Subject: [PATCH 2/4] girepository: Provide placeholders for positional parameters Otherwise, correct invocation isn't clear from the --help output. This does not introduce new translated strings: FILE was already translated. Signed-off-by: Simon McVittie --- girepository/compiler/compiler.c | 3 ++- girepository/decompiler/decompiler.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/girepository/compiler/compiler.c b/girepository/compiler/compiler.c index b0fc59d45..c786d4f5e 100644 --- a/girepository/compiler/compiler.c +++ b/girepository/compiler/compiler.c @@ -164,7 +164,8 @@ main (int argc, char **argv) setlocale (LC_ALL, ""); - context = g_option_context_new (""); + /* Translators: commandline placeholder */ + context = g_option_context_new (_("FILE")); g_option_context_add_main_entries (context, options, NULL); g_option_context_parse (context, &argc, &argv, &error); g_option_context_free (context); diff --git a/girepository/decompiler/decompiler.c b/girepository/decompiler/decompiler.c index 951e11d82..9e183374d 100644 --- a/girepository/decompiler/decompiler.c +++ b/girepository/decompiler/decompiler.c @@ -37,6 +37,7 @@ int main (int argc, char *argv[]) { GIRepository *repository = NULL; + gchar *param; gchar *output = NULL; gchar **includedirs = NULL; gboolean show_all = FALSE; @@ -60,7 +61,10 @@ main (int argc, char *argv[]) setlocale (LC_ALL, ""); - context = g_option_context_new (""); + /* Translators: commandline placeholder */ + param = g_strdup_printf ("%s…", _("FILE")); + context = g_option_context_new (param); + g_free (param); g_option_context_add_main_entries (context, options, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { From 5622a4a625877938feee8f3807a2db5feaf7d771 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 28 Feb 2024 11:22:30 +0000 Subject: [PATCH 3/4] gdbus: Add command-line placeholder for ADDRESS If we don't do this, the --help text is formatted as though the option did not expect an argument. This introduces a new translated string, but it is developer-oriented, so a missing translation is not particularly bad. Signed-off-by: Simon McVittie --- gio/gdbus-tool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gdbus-tool.c b/gio/gdbus-tool.c index 2435998d3..63c7ec9dc 100644 --- a/gio/gdbus-tool.c +++ b/gio/gdbus-tool.c @@ -404,7 +404,7 @@ static const GOptionEntry connection_entries[] = { { "system", 'y', 0, G_OPTION_ARG_NONE, &opt_connection_system, N_("Connect to the system bus"), NULL}, { "session", 'e', 0, G_OPTION_ARG_NONE, &opt_connection_session, N_("Connect to the session bus"), NULL}, - { "address", 'a', 0, G_OPTION_ARG_STRING, &opt_connection_address, N_("Connect to given D-Bus address"), NULL}, + { "address", 'a', 0, G_OPTION_ARG_STRING, &opt_connection_address, N_("Connect to given D-Bus address"), N_("ADDRESS") }, G_OPTION_ENTRY_NULL }; From fb4b780eea822c944572f6b3f48544c33a861922 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 28 Feb 2024 11:23:08 +0000 Subject: [PATCH 4/4] glib-compile-resources: Provide placeholders for options with an argument If we don't do this, the --help text is formatted as though the option did not expect an argument. IDENTIFIER is a new translated string, but it is developer-oriented, so a missing translation is not particularly bad. COMMAND is already present in translations. Signed-off-by: Simon McVittie --- gio/glib-compile-resources.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c index 2ce923766..36f64a491 100644 --- a/gio/glib-compile-resources.c +++ b/gio/glib-compile-resources.c @@ -830,8 +830,8 @@ main (int argc, char **argv) { "manual-register", 0, 0, G_OPTION_ARG_NONE, &manual_register, N_("Don’t automatically create and register resource"), NULL }, { "internal", 0, 0, G_OPTION_ARG_NONE, &internal, N_("Don’t export functions; declare them G_GNUC_INTERNAL"), NULL }, { "external-data", 0, 0, G_OPTION_ARG_NONE, &external_data, N_("Don’t embed resource data in the C file; assume it's linked externally instead"), NULL }, - { "c-name", 0, 0, G_OPTION_ARG_STRING, &c_name, N_("C identifier name used for the generated source code"), NULL }, - { "compiler", 'C', 0, G_OPTION_ARG_STRING, &compiler, N_("The target C compiler (default: the CC environment variable)"), NULL }, + { "c-name", 0, 0, G_OPTION_ARG_STRING, &c_name, N_("C identifier name used for the generated source code"), N_("IDENTIFIER") }, + { "compiler", 'C', 0, G_OPTION_ARG_STRING, &compiler, N_("The target C compiler (default: the CC environment variable)"), N_("COMMAND") }, G_OPTION_ENTRY_NULL };