git-gui: fix incorrect use of Tcl append command

Fix wrong use of append command in strings marked for translation.
According to Tcl/Tk Documentation [1],
	append varName ?value value value ...?
appends all value arguments to the current value of variable varName.
This means that
	append "[appname] ([reponame]): " [mc "File Viewer"]
is setting a variable named "[appname] ([reponame]): " to the output of
[mc "File Viewer"], rather than returning the concatenation of both
expressions as one might expect.

The format for some strings enables, for instance, a French translator
to translate like "%s (%s) : Create Branch" (space before colon).
Conversely, strings already translated will be marked as fuzzy and the
translator must update them herself.

For some cases, use alternative way for concatenation instead of using
strcat procedure defined in git-gui.sh.

Reference: 31bb1d1 ("git-gui: Paper bag fix missing translated strings",
2007-09-14) fixes the same issue slightly differently.

[1] http://www.tcl.tk/man/tcl/TclCmd/append.htm

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
This commit is contained in:
Vasco Almeida
2016-05-08 10:52:57 +00:00
committed by Pat Thoyts
parent 43c65a85c4
commit a3d97afaa8
15 changed files with 25 additions and 26 deletions

View File

@ -223,10 +223,9 @@ proc show_other_diff {path w m cont_info} {
}
$ui_diff conf -state normal
if {$type eq {submodule}} {
$ui_diff insert end [append \
"* " \
[mc "Git Repository (subproject)"] \
"\n"] d_info
$ui_diff insert end \
"* [mc "Git Repository (subproject)"]\n" \
d_info
} elseif {![catch {set type [exec file $path]}]} {
set n [string length $path]
if {[string equal -length $n $path $type]} {
@ -611,7 +610,7 @@ proc apply_hunk {x y} {
puts -nonewline $p $current_diff_header
puts -nonewline $p [$ui_diff get $s_lno $e_lno]
close $p} err]} {
error_popup [append $failed_msg "\n\n$err"]
error_popup "$failed_msg\n\n$err"
unlock_index
return
}
@ -829,7 +828,7 @@ proc apply_range_or_line {x y} {
puts -nonewline $p $current_diff_header
puts -nonewline $p $wholepatch
close $p} err]} {
error_popup [append $failed_msg "\n\n$err"]
error_popup "$failed_msg\n\n$err"
}
unlock_index