Skip to content

Commit 55aa044

Browse files
vascoolgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ef84426 commit 55aa044

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

git-add--interactive.perl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ sub list_modified {
294294
my ($change, $bin);
295295
$file = unquote_path($file);
296296
if ($add eq '-' && $del eq '-') {
297-
$change = 'binary';
297+
$change = __('binary');
298298
$bin = 1;
299299
}
300300
else {
@@ -303,7 +303,7 @@ sub list_modified {
303303
$data{$file} = {
304304
INDEX => $change,
305305
BINARY => $bin,
306-
FILE => 'nothing',
306+
FILE => __('nothing'),
307307
}
308308
}
309309
elsif (($adddel, $file) =
@@ -319,7 +319,7 @@ sub list_modified {
319319
$file = unquote_path($file);
320320
my ($change, $bin);
321321
if ($add eq '-' && $del eq '-') {
322-
$change = 'binary';
322+
$change = __('binary');
323323
$bin = 1;
324324
}
325325
else {
@@ -339,7 +339,7 @@ sub list_modified {
339339
$file = unquote_path($2);
340340
if (!exists $data{$file}) {
341341
$data{$file} = +{
342-
INDEX => 'unchanged',
342+
INDEX => __('unchanged'),
343343
BINARY => 0,
344344
};
345345
}
@@ -354,10 +354,10 @@ sub list_modified {
354354

355355
if ($only) {
356356
if ($only eq 'index-only') {
357-
next if ($it->{INDEX} eq 'unchanged');
357+
next if ($it->{INDEX} eq __('unchanged'));
358358
}
359359
if ($only eq 'file-only') {
360-
next if ($it->{FILE} eq 'nothing');
360+
next if ($it->{FILE} eq __('nothing'));
361361
}
362362
}
363363
push @return, +{

0 commit comments

Comments
 (0)