Commit 8d1780b5 by Jakub Jelinek

i18n: Fix translation of --help [PR93759]

The first two hunks make sure we actually translate what has been marked
for translation, i.e. the cl_options[...].help strings, rather than those
strings ammended in various ways, like:
_("%s  Same as %s."), help, ...
or
"%s  %s", help, _(use_diagnosed_msg)

The exgettext changes attempt to make sure that the cl_options[...].help
strings are marked as no-c-format, because otherwise if they happen
to contain a % character, such as the 90% substring, they will be marked
as c-format, which they aren't.

2020-02-21  Jakub Jelinek  <jakub@redhat.com>

	PR translation/93759
	* opts.c (print_filtered_help): Translate help before appending
	messages to it rather than after that.

	* exgettext: For *.opt help texts, use __opt_help_text("...")
	rather than _("...") in the $emsg file and pass options that
	say that this implies no-c-format.
parent d11676de
2020-02-21 Jakub Jelinek <jakub@redhat.com>
PR translation/93759
* opts.c (print_filtered_help): Translate help before appending
messages to it rather than after that.
2020-02-19 Richard Sandiford <richard.sandiford@arm.com> 2020-02-19 Richard Sandiford <richard.sandiford@arm.com>
PR rtl-optimization/PR92989 PR rtl-optimization/PR92989
......
...@@ -1309,10 +1309,13 @@ print_filtered_help (unsigned int include_flags, ...@@ -1309,10 +1309,13 @@ print_filtered_help (unsigned int include_flags,
help = undocumented_msg; help = undocumented_msg;
} }
/* Get the translation. */
help = _(help);
if (option->alias_target < N_OPTS if (option->alias_target < N_OPTS
&& cl_options [option->alias_target].help) && cl_options [option->alias_target].help)
{ {
if (help == undocumented_msg) if (option->help == NULL)
{ {
/* For undocumented options that are aliases for other options /* For undocumented options that are aliases for other options
that are documented, point the reader to the other option in that are documented, point the reader to the other option in
...@@ -1347,9 +1350,6 @@ print_filtered_help (unsigned int include_flags, ...@@ -1347,9 +1350,6 @@ print_filtered_help (unsigned int include_flags,
help = new_help; help = new_help;
} }
/* Get the translation. */
help = _(help);
/* Find the gap between the name of the /* Find the gap between the name of the
option and its descriptive text. */ option and its descriptive text. */
tab = strchr (help, '\t'); tab = strchr (help, '\t');
......
2020-02-21 Jakub Jelinek <jakub@redhat.com>
PR translation/93759
* exgettext: For *.opt help texts, use __opt_help_text("...")
rather than _("...") in the $emsg file and pass options that
say that this implies no-c-format.
2020-02-20 Joseph Myers <joseph@codesourcery.com> 2020-02-20 Joseph Myers <joseph@codesourcery.com>
* de.po: Update. * de.po: Update.
......
...@@ -227,6 +227,7 @@ END { ...@@ -227,6 +227,7 @@ END {
} }
} }
print emsg > posr print emsg > posr
print "--keyword=__opt_help_text\n--flag=__opt_help_text:1:no-c-format" >> kopt
}' }'
) || exit ) || exit
...@@ -240,7 +241,7 @@ echo "scanning option files..." >&2 ...@@ -240,7 +241,7 @@ echo "scanning option files..." >&2
while (getline < file) { while (getline < file) {
if (/^[ \t]*(;|$)/ || !/^[^ \t]/) { if (/^[ \t]*(;|$)/ || !/^[^ \t]/) {
if (field > 2) if (field > 2)
printf("_(\"%s\")\n", line) printf("__opt_help_text(\"%s\")\n", line)
field = 0 field = 0
} else { } else {
if ((field == 1) && /MissingArgError/) { if ((field == 1) && /MissingArgError/) {
...@@ -287,7 +288,7 @@ echo "scanning option files..." >&2 ...@@ -287,7 +288,7 @@ echo "scanning option files..." >&2
lineno++; lineno++;
} }
if (field > 2) if (field > 2)
printf("_(\"%s\")\n", line) printf("__opt_help_text(\"%s\")\n", line)
}') >> $emsg }') >> $emsg
# Run the xgettext commands, with temporary added as a file to scan. # Run the xgettext commands, with temporary added as a file to scan.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment