Skip to content

Commit 5fe1484

Browse files
committed
Merge branch 'jx/i18n-1.7.11'
Add i18n support for scripted Porcelains, and mark strings in merge(-recursive), am, and rebase for i18n. * jx/i18n-1.7.11: i18n: merge-recursive: mark strings for translation Remove dead code which contains bad gettext block i18n: am: mark more strings for translation rebase: remove obsolete and unused LONG_USAGE which breaks xgettext i18n: Rewrite gettext messages start with dash i18n: rebase: mark messages for translation i18n: New keywords for xgettext extraction from sh
2 parents 3b2d763 + 55653a6 commit 5fe1484

11 files changed

+150
-157
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,8 @@ XGETTEXT_FLAGS = \
23942394
--from-code=UTF-8
23952395
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
23962396
--keyword=_ --keyword=N_ --keyword="Q_:1,2"
2397-
XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell
2397+
XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2398+
--keyword=gettextln --keyword=eval_gettextln
23982399
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
23992400
LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
24002401
LOCALIZED_SH := $(SCRIPT_SH)

git-am.sh

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ safe_to_abort () {
9292
then
9393
return 0
9494
fi
95-
gettextln "You seem to have moved HEAD since the last 'am' failure.
95+
gettextln "You seem to have moved HEAD since the last 'am' failure.
9696
Not rewinding to ORIG_HEAD" >&2
9797
return 1
9898
}
@@ -102,9 +102,9 @@ stop_here_user_resolve () {
102102
printf '%s\n' "$resolvemsg"
103103
stop_here $1
104104
fi
105-
eval_gettextln "When you have resolved this problem run \"\$cmdline --resolved\".
106-
If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
107-
To restore the original branch and stop patching run \"\$cmdline --abort\"."
105+
eval_gettextln "When you have resolved this problem, run \"\$cmdline --resolved\".
106+
If you prefer to skip this patch, run \"\$cmdline --skip\" instead.
107+
To restore the original branch and stop patching, run \"\$cmdline --abort\"."
108108

109109
stop_here $1
110110
}
@@ -136,7 +136,7 @@ fall_back_3way () {
136136
git write-tree >"$dotest/patch-merge-base+" ||
137137
cannot_fallback "$(gettext "Repository lacks necessary blobs to fall back on 3-way merge.")"
138138

139-
say Using index info to reconstruct a base tree...
139+
say "$(gettext "Using index info to reconstruct a base tree...")"
140140

141141
cmd='GIT_INDEX_FILE="$dotest/patch-merge-tmp-index"'
142142

@@ -176,8 +176,7 @@ It does not apply to blobs recorded in its index.")"
176176
fi
177177
git-merge-recursive $orig_tree -- HEAD $his_tree || {
178178
git rerere $allow_rerere_autoupdate
179-
echo Failed to merge in the changes.
180-
exit 1
179+
die "$(gettext "Failed to merge in the changes.")"
181180
}
182181
unset GITHEAD_$his_tree
183182
}
@@ -387,8 +386,8 @@ do
387386
-i|--interactive)
388387
interactive=t ;;
389388
-b|--binary)
390-
echo >&2 "The $1 option has been a no-op for long time, and"
391-
echo >&2 "it will be removed. Please do not use it anymore."
389+
gettextln >&2 "The -b/--binary option has been a no-op for long time, and
390+
it will be removed. Please do not use it anymore."
392391
;;
393392
-3|--3way)
394393
threeway=t ;;
@@ -414,9 +413,6 @@ do
414413
abort=t ;;
415414
--rebasing)
416415
rebasing=t threeway=t ;;
417-
-d|--dotest)
418-
die "$(gettext "-d option is no longer supported. Do not use.")"
419-
;;
420416
--resolvemsg)
421417
shift; resolvemsg=$1 ;;
422418
--whitespace|--directory|--exclude|--include)

git-rebase.sh

Lines changed: 34 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,6 @@
33
# Copyright (c) 2005 Junio C Hamano.
44
#
55

6-
USAGE='[--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]
7-
[--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'
8-
LONG_USAGE='git-rebase replaces <branch> with a new branch of the
9-
same name. When the --onto option is provided the new branch starts
10-
out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
11-
It then attempts to create a new commit for each commit from the original
12-
<branch> that does not exist in the <upstream> branch.
13-
14-
It is possible that a merge failure will prevent this process from being
15-
completely automatic. You will have to resolve any such merge failure
16-
and run git rebase --continue. Another option is to bypass the commit
17-
that caused the merge failure with git rebase --skip. To check out the
18-
original <branch> and remove the .git/rebase-apply working files, use the
19-
command git rebase --abort instead.
20-
21-
Note that if <branch> is not specified on the command line, the
22-
currently checked out branch is used.
23-
24-
Example: git-rebase master~1 topic
25-
26-
A---B---C topic A'\''--B'\''--C'\'' topic
27-
/ --> /
28-
D---E---F---G master D---E---F---G master
29-
'
30-
316
SUBDIRECTORY_OK=Yes
327
OPTIONS_KEEPDASHDASH=
338
OPTIONS_SPEC="\
@@ -65,6 +40,7 @@ abort! abort and check out the original branch
6540
skip! skip current patch and continue
6641
"
6742
. git-sh-setup
43+
. git-sh-i18n
6844
set_reflog_action rebase
6945
require_work_tree_exists
7046
cd_to_toplevel
@@ -73,9 +49,9 @@ LF='
7349
'
7450
ok_to_skip_pre_rebase=
7551
resolvemsg="
76-
When you have resolved this problem run \"git rebase --continue\".
77-
If you would prefer to skip this patch, instead run \"git rebase --skip\".
78-
To check out the original branch and stop rebasing run \"git rebase --abort\".
52+
$(gettext 'When you have resolved this problem, run "git rebase --continue".
53+
If you prefer to skip this patch, run "git rebase --skip" instead.
54+
To check out the original branch and stop rebasing, run "git rebase --abort".')
7955
"
8056
unset onto
8157
cmd=
@@ -161,7 +137,7 @@ move_to_original_branch () {
161137
git symbolic-ref \
162138
-m "rebase finished: returning to $head_name" \
163139
HEAD $head_name ||
164-
die "Could not move back to $head_name"
140+
die "$(gettext "Could not move back to $head_name")"
165141
;;
166142
esac
167143
}
@@ -180,12 +156,12 @@ run_pre_rebase_hook () {
180156
test -x "$GIT_DIR/hooks/pre-rebase"
181157
then
182158
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
183-
die "The pre-rebase hook refused to rebase."
159+
die "$(gettext "The pre-rebase hook refused to rebase.")"
184160
fi
185161
}
186162

187163
test -f "$apply_dir"/applying &&
188-
die 'It looks like git-am is in progress. Cannot rebase.'
164+
die "$(gettext "It looks like git-am is in progress. Cannot rebase.")"
189165

190166
if test -d "$apply_dir"
191167
then
@@ -316,12 +292,12 @@ test $# -gt 2 && usage
316292
if test -n "$cmd" &&
317293
test "$interactive_rebase" != explicit
318294
then
319-
die "--exec option must be used with --interactive option"
295+
die "$(gettext "The --exec option must be used with the --interactive option")"
320296
fi
321297

322298
if test -n "$action"
323299
then
324-
test -z "$in_progress" && die "No rebase in progress?"
300+
test -z "$in_progress" && die "$(gettext "No rebase in progress?")"
325301
# Only interactive rebase uses detailed reflog messages
326302
if test "$type" = interactive && test "$GIT_REFLOG_ACTION" = rebase
327303
then
@@ -334,11 +310,11 @@ case "$action" in
334310
continue)
335311
# Sanity check
336312
git rev-parse --verify HEAD >/dev/null ||
337-
die "Cannot read HEAD"
313+
die "$(gettext "Cannot read HEAD")"
338314
git update-index --ignore-submodules --refresh &&
339315
git diff-files --quiet --ignore-submodules || {
340-
echo "You must edit all merge conflicts and then"
341-
echo "mark them as resolved using git add"
316+
echo "$(gettext "You must edit all merge conflicts and then
317+
mark them as resolved using git add")"
342318
exit 1
343319
}
344320
read_basic_state
@@ -355,7 +331,7 @@ abort)
355331
case "$head_name" in
356332
refs/*)
357333
git symbolic-ref -m "rebase: aborting" HEAD $head_name ||
358-
die "Could not move back to $head_name"
334+
die "$(eval_gettext "Could not move back to \$head_name")"
359335
;;
360336
esac
361337
output git reset --hard $orig_head
@@ -367,15 +343,18 @@ esac
367343
# Make sure no rebase is in progress
368344
if test -n "$in_progress"
369345
then
370-
die '
371-
It seems that there is already a '"${state_dir##*/}"' directory, and
372-
I wonder if you are in the middle of another rebase. If that is the
346+
state_dir_base=${state_dir##*/}
347+
cmd_live_rebase="git rebase (--continue | --abort | --skip)"
348+
cmd_clear_stale_rebase="rm -fr \"$state_dir\""
349+
die "
350+
$(eval_gettext 'It seems that there is already a $state_dir_base directory, and
351+
I wonder if you ware in the middle of another rebase. If that is the
373352
case, please try
374-
git rebase (--continue | --abort | --skip)
353+
$cmd_live_rebase
375354
If that is not the case, please
376-
rm -fr '"$state_dir"'
355+
$cmd_clear_stale_rebase
377356
and run me again. I am stopping in case you still have something
378-
valuable there.'
357+
valuable there.')"
379358
fi
380359

381360
if test -n "$rebase_root" && test -z "$onto"
@@ -413,7 +392,7 @@ then
413392
;;
414393
esac
415394
upstream=`git rev-parse --verify "${upstream_name}^0"` ||
416-
die "invalid upstream $upstream_name"
395+
die "$(eval_gettext "invalid upstream \$upstream_name")"
417396
upstream_arg="$upstream_name"
418397
else
419398
if test -z "$onto"
@@ -437,19 +416,19 @@ case "$onto_name" in
437416
then
438417
case "$onto" in
439418
?*"$LF"?*)
440-
die "$onto_name: there are more than one merge bases"
419+
die "$(eval_gettext "\$onto_name: there are more than one merge bases")"
441420
;;
442421
'')
443-
die "$onto_name: there is no merge base"
422+
die "$(eval_gettext "\$onto_name: there is no merge base")"
444423
;;
445424
esac
446425
else
447-
die "$onto_name: there is no merge base"
426+
die "$(eval_gettext "\$onto_name: there is no merge base")"
448427
fi
449428
;;
450429
*)
451430
onto=$(git rev-parse --verify "${onto_name}^0") ||
452-
die "Does not point to a valid commit: $onto_name"
431+
die "$(eval_gettext "Does not point to a valid commit: \$onto_name")"
453432
;;
454433
esac
455434

@@ -472,7 +451,7 @@ case "$#" in
472451
then
473452
head_name="detached HEAD"
474453
else
475-
die "fatal: no such branch: $1"
454+
die "$(eval_gettext "fatal: no such branch: \$branch_name")"
476455
fi
477456
;;
478457
0)
@@ -492,7 +471,7 @@ case "$#" in
492471
;;
493472
esac
494473

495-
require_clean_work_tree "rebase" "Please commit or stash them."
474+
require_clean_work_tree "rebase" "$(gettext "Please commit or stash them.")"
496475

497476
# Now we are rebasing commits $upstream..$orig_head (or with --root,
498477
# everything leading up to $orig_head) on top of $onto
@@ -510,10 +489,10 @@ then
510489
then
511490
# Lazily switch to the target branch if needed...
512491
test -z "$switch_to" || git checkout "$switch_to" --
513-
say "Current branch $branch_name is up to date."
492+
say "$(eval_gettext "Current branch \$branch_name is up to date.")"
514493
exit 0
515494
else
516-
say "Current branch $branch_name is up to date, rebase forced."
495+
say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
517496
fi
518497
fi
519498

@@ -524,7 +503,7 @@ if test -n "$diffstat"
524503
then
525504
if test -n "$verbose"
526505
then
527-
echo "Changes from $mb to $onto:"
506+
echo "$(eval_gettext "Changes from \$mb to \$onto:")"
528507
fi
529508
# We want color (if set), but no pager
530509
GIT_PAGER='' git diff --stat --summary "$mb" "$onto"
@@ -533,15 +512,15 @@ fi
533512
test "$type" = interactive && run_specific_rebase
534513

535514
# Detach HEAD and reset the tree
536-
say "First, rewinding head to replay your work on top of it..."
515+
say "$(gettext "First, rewinding head to replay your work on top of it...")"
537516
git checkout -q "$onto^0" || die "could not detach HEAD"
538517
git update-ref ORIG_HEAD $orig_head
539518

540519
# If the $onto is a proper descendant of the tip of the branch, then
541520
# we just fast-forwarded.
542521
if test "$mb" = "$orig_head"
543522
then
544-
say "Fast-forwarded $branch_name to $onto_name."
523+
say "$(eval_gettext "Fast-forwarded \$branch_name to \$onto_name.")"
545524
move_to_original_branch
546525
exit 0
547526
fi

git-submodule.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ cmd_summary() {
751751
if [ -n "$files" ]
752752
then
753753
test -n "$cached" &&
754-
die "$(gettext -- "--cached cannot be used with --files")"
754+
die "$(gettext "The --cached option cannot be used with the --files option")"
755755
diff_cmd=diff-files
756756
head=
757757
fi

0 commit comments

Comments
 (0)