i18n: add--interactive: mark status words for translation

Mark words 'nothing', 'unchanged' and 'binary' used to display what has been staged or not, in "git add -i" status command. Alternatively one could mark N__('nothing') no-op in order to xgettext(1) extract the string and then trigger the translation at run time only with __($print->{FILE}), but that has the side effect of triggering retrieval of translations for the changes indicator too (e.g. +2/-1) which may or may not be a problem. To avoid that potential problem, mark only where there is certain to trigger translation only of those words but in this case we must also retrieve the translation for the eq tests, since the value assigned was of the translation, not the English source. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Vasco Almeida committed Dec 14, 2016 at 11:54 UTC 55aa04423f14df3099466dc7eea4ca2d027b7d4c
1 file changed +6 -6
git-add--interactive.perl
+6 -6
@@ -294,7 +294,7 @@ sub list_modified {
294 my ($change, $bin);
295 $file = unquote_path($file);
296 if ($add eq '-' && $del eq '-') {
297 - $change = 'binary';
297 + $change = __('binary');
298 $bin = 1;
299 }
300 else {
@@ -303,7 +303,7 @@ sub list_modified {
303 $data{$file} = {
304 INDEX => $change,
305 BINARY => $bin,
306 - FILE => 'nothing',
306 + FILE => __('nothing'),
307 }
308 }
309 elsif (($adddel, $file) =
@@ -319,7 +319,7 @@ sub list_modified {
319 $file = unquote_path($file);
320 my ($change, $bin);
321 if ($add eq '-' && $del eq '-') {
322 - $change = 'binary';
322 + $change = __('binary');
323 $bin = 1;
324 }
325 else {
@@ -339,7 +339,7 @@ sub list_modified {
339 $file = unquote_path($2);
340 if (!exists $data{$file}) {
341 $data{$file} = +{
342 - INDEX => 'unchanged',
342 + INDEX => __('unchanged'),
343 BINARY => 0,
344 };
345 }
@@ -354,10 +354,10 @@ sub list_modified {
354
355 if ($only) {
356 if ($only eq 'index-only') {
357 - next if ($it->{INDEX} eq 'unchanged');
357 + next if ($it->{INDEX} eq __('unchanged'));
358 }
359 if ($only eq 'file-only') {
360 - next if ($it->{FILE} eq 'nothing');
360 + next if ($it->{FILE} eq __('nothing'));
361 }
362 }
363 push @return, +{