Re: [PATCH v2 01/11] i18n: add--interactive: mark strings for translation
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 25, 2016, 22:52 UTC
- Message-ID
- <xmqqr387y4le.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1472646690-9699-2-git-send-email-vascomalmeida@sapo.pt>
Vasco Almeida <vascomalmeida@sapo.pt> writes:
Show 29 quoted lines
> Mark simple strings (without interpolation) for translation.
>
> Brackets around first parameter of ternary operator is necessary because
> otherwise xgettext fails to extract strings marked for translation from
> the rest of the file.
>
> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
> ---
> git-add--interactive.perl | 68 +++++++++++++++++++++++++----------------------
> 1 file changed, 36 insertions(+), 32 deletions(-)
>
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index 822f857..fb8e5de 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -4,6 +4,7 @@ use 5.008;
> use strict;
> use warnings;
> use Git;
> +use Git::I18N;
>
> binmode(STDOUT, ":raw");
>
> @@ -252,7 +253,7 @@ sub list_untracked {
> }
>
> my $status_fmt = '%12s %12s %s';
> -my $status_head = sprintf($status_fmt, 'staged', 'unstaged', 'path');
> +my $status_head = sprintf($status_fmt, __('staged'), __('unstaged'), __('path'));Wouldn't it make sense to allow translators to tweak $status_fmt if you are allowing the earlier elements that are formatted with %12s, as their translation may not fit within that width, in which case they may want to make these columns wider?
Show 8 quoted lines
> prompt_yesno(
> - 'Your edited hunk does not apply. Edit again '
> - . '(saying "no" discards!) [y/n]? '
> + # TRANSLATORS: do not translate [y/n]
> + # The program will only accept that input
> + # at this point.
> + __('Your edited hunk does not apply. Edit again '
> + . '(saying "no" discards!) [y/n]? ')Not just [y/n], but "no" in "saying no discards!" also needs to stay, no? I wonder if it is a good idea to lose the TRANSLATORS comment by ejecting "[y/n]" outside the "__()" construct here.