summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-01-17 01:35:13 +0100
committerJunio C Hamano <gitster@pobox.com>2025-01-17 01:35:13 +0100
commitf8f5af2952e76b4293f1cf0ff09d0e80697f6734 (patch)
tree039e4bcb881e5bb4d9b541b452c589c108165b64
parentMerge branch 're/submodule-parse-opt' (diff)
parentparse-options: localize mark-up of placeholder text in the short help (diff)
downloadgit-f8f5af2952e76b4293f1cf0ff09d0e80697f6734.tar.xz
git-f8f5af2952e76b4293f1cf0ff09d0e80697f6734.zip
Merge branch 'as/long-option-help-i18n'
Tweak the help text used for the option value placeholders by parse-options API so that translations can customize the "<>" placeholder signal (e.g. "--option=<value>"). * as/long-option-help-i18n: parse-options: localize mark-up of placeholder text in the short help
-rw-r--r--parse-options.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/parse-options.c b/parse-options.c
index 33bfba0ed4..3ff6a5d1fa 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -1076,11 +1076,48 @@ static int usage_argh(const struct option *opts, FILE *outfile)
!opts->argh || !!strpbrk(opts->argh, "()<>[]|");
if (opts->flags & PARSE_OPT_OPTARG)
if (opts->long_name)
- s = literal ? "[=%s]" : "[=<%s>]";
+ /*
+ * TRANSLATORS: The "<%s>" part of this string
+ * stands for an optional value given to a command
+ * line option in the long form, and "<>" is there
+ * as a convention to signal that it is a
+ * placeholder (i.e. the user should substitute it
+ * with the real value). If your language uses a
+ * different convention, you can change "<%s>" part
+ * to match yours, e.g. it might use "|%s|" instead,
+ * or if the alphabet is different enough it may use
+ * "%s" without any placeholder signal. Most
+ * translations leave this message as is.
+ */
+ s = literal ? "[=%s]" : _("[=<%s>]");
else
- s = literal ? "[%s]" : "[<%s>]";
+ /*
+ * TRANSLATORS: The "<%s>" part of this string
+ * stands for an optional value given to a command
+ * line option in the short form, and "<>" is there
+ * as a convention to signal that it is a
+ * placeholder (i.e. the user should substitute it
+ * with the real value). If your language uses a
+ * different convention, you can change "<%s>" part
+ * to match yours, e.g. it might use "|%s|" instead,
+ * or if the alphabet is different enough it may use
+ * "%s" without any placeholder signal. Most
+ * translations leave this message as is.
+ */
+ s = literal ? "[%s]" : _("[<%s>]");
else
- s = literal ? " %s" : " <%s>";
+ /*
+ * TRANSLATORS: The "<%s>" part of this string stands for a
+ * value given to a command line option, and "<>" is there
+ * as a convention to signal that it is a placeholder
+ * (i.e. the user should substitute it with the real value).
+ * If your language uses a different convention, you can
+ * change "<%s>" part to match yours, e.g. it might use
+ * "|%s|" instead, or if the alphabet is different enough it
+ * may use "%s" without any placeholder signal. Most
+ * translations leave this message as is.
+ */
+ s = literal ? " %s" : _(" <%s>");
return utf8_fprintf(outfile, s, opts->argh ? _(opts->argh) : _("..."));
}