git-gui: Paper bag fix missing translated strings
The Tcl expression "[append [mc Foo] Bar]" does not return the string "FooBar" after translation; instead it is setting the variable Foo to the value Bar, or if Foo is already defined it is appending Bar onto the end of it. This is *not* what we wanted to have happen here. Tcl's join function is actually the correct function but its default joinStr argument is a single space. Unfortunately all of our call sites do not want an extra space added to their string. So we need a small wrapper function to make the call to join with an empty join string. In C this is (roughly) the job of the strcat function. Since strcat is not yet used at the global level it is a reasonable name to use here. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
bba060462c
commit
31bb1d1b2d
18
git-gui.sh
18
git-gui.sh
@ -96,6 +96,10 @@ proc mc {fmt args} {
|
||||
return [eval [list format $fmt] $args]
|
||||
}
|
||||
|
||||
proc strcat {args} {
|
||||
return [join $args {}]
|
||||
}
|
||||
|
||||
::msgcat::mcload $oguimsg
|
||||
unset oguimsg
|
||||
|
||||
@ -540,7 +544,7 @@ if {![regsub {^git version } $_git_version {} _git_version]} {
|
||||
-icon error \
|
||||
-type ok \
|
||||
-title [mc "git-gui: fatal error"] \
|
||||
-message [append [mc "Cannot parse Git version string:"] "\n\n$_git_version"]
|
||||
-message [strcat [mc "Cannot parse Git version string:"] "\n\n$_git_version"]
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -722,7 +726,7 @@ if {[catch {
|
||||
set _prefix [git rev-parse --show-prefix]
|
||||
} err]} {
|
||||
catch {wm withdraw .}
|
||||
error_popup [append [mc "Cannot find the git directory:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Cannot find the git directory:"] "\n\n$err"]
|
||||
exit 1
|
||||
}
|
||||
if {![file isdirectory $_gitdir] && [is_Cygwin]} {
|
||||
@ -730,26 +734,26 @@ if {![file isdirectory $_gitdir] && [is_Cygwin]} {
|
||||
}
|
||||
if {![file isdirectory $_gitdir]} {
|
||||
catch {wm withdraw .}
|
||||
error_popup [append [mc "Git directory not found:"] "\n\n$_gitdir"]
|
||||
error_popup [strcat [mc "Git directory not found:"] "\n\n$_gitdir"]
|
||||
exit 1
|
||||
}
|
||||
if {$_prefix ne {}} {
|
||||
regsub -all {[^/]+/} $_prefix ../ cdup
|
||||
if {[catch {cd $cdup} err]} {
|
||||
catch {wm withdraw .}
|
||||
error_popup [append [mc "Cannot move to top of working directory:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Cannot move to top of working directory:"] "\n\n$err"]
|
||||
exit 1
|
||||
}
|
||||
unset cdup
|
||||
} elseif {![is_enabled bare]} {
|
||||
if {[lindex [file split $_gitdir] end] ne {.git}} {
|
||||
catch {wm withdraw .}
|
||||
error_popup [append [mc "Cannot use funny .git directory:"] "\n\n$_gitdir"]
|
||||
error_popup [strcat [mc "Cannot use funny .git directory:"] "\n\n$_gitdir"]
|
||||
exit 1
|
||||
}
|
||||
if {[catch {cd [file dirname $_gitdir]} err]} {
|
||||
catch {wm withdraw .}
|
||||
error_popup [append [mc "No working directory"] " [file dirname $_gitdir]:\n\n$err"]
|
||||
error_popup [strcat [mc "No working directory"] " [file dirname $_gitdir]:\n\n$err"]
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
@ -1658,7 +1662,7 @@ proc apply_config {} {
|
||||
font configure $font $cn $cv
|
||||
}
|
||||
} err]} {
|
||||
error_popup [append [mc "Invalid font specified in %s:" "gui.$name"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Invalid font specified in %s:" "gui.$name"] "\n\n$err"]
|
||||
}
|
||||
foreach {cn cv} [font configure $font] {
|
||||
font configure ${font}bold $cn $cv
|
||||
|
@ -784,16 +784,16 @@ method _showcommit {cur_w lno} {
|
||||
}
|
||||
|
||||
$w_cviewer insert end "commit $cmit\n" header_key
|
||||
$w_cviewer insert end [append [mc "Author:"] "\t"] header_key
|
||||
$w_cviewer insert end [strcat [mc "Author:"] "\t"] header_key
|
||||
$w_cviewer insert end "$author_name $author_email" header_val
|
||||
$w_cviewer insert end " $author_time\n" header_val
|
||||
|
||||
$w_cviewer insert end [append [mc "Committer:"] "\t"] header_key
|
||||
$w_cviewer insert end [strcat [mc "Committer:"] "\t"] header_key
|
||||
$w_cviewer insert end "$committer_name $committer_email" header_val
|
||||
$w_cviewer insert end " $committer_time\n" header_val
|
||||
|
||||
if {$file ne $path} {
|
||||
$w_cviewer insert end [append [mc "Original File:"] "\t"] header_key
|
||||
$w_cviewer insert end [strcat [mc "Original File:"] "\t"] header_key
|
||||
$w_cviewer insert end "[escape_path $file]\n" header_val
|
||||
}
|
||||
|
||||
@ -907,18 +907,18 @@ method _open_tooltip {cur_w} {
|
||||
catch {set summary $header($cmit,summary)}
|
||||
catch {set author_time [foramt_date $header($cmit,author-time)]}
|
||||
|
||||
$tooltip_t insert end [append [mc "Originally By:"] "\n"] section_header
|
||||
$tooltip_t insert end [strcat [mc "Originally By:"] "\n"] section_header
|
||||
$tooltip_t insert end "commit $cmit\n"
|
||||
$tooltip_t insert end "$author_name $author_time\n"
|
||||
$tooltip_t insert end "$summary\n"
|
||||
|
||||
if {$file ne $path} {
|
||||
$tooltip_t insert end [append [mc "In File:"] " "] section_header
|
||||
$tooltip_t insert end [strcat [mc "In File:"] " "] section_header
|
||||
$tooltip_t insert end "$file\n"
|
||||
}
|
||||
|
||||
$tooltip_t insert end "\n"
|
||||
$tooltip_t insert end [append [mc "Copied Or Moved Here By:"] "\n"] section_header
|
||||
$tooltip_t insert end [strcat [mc "Copied Or Moved Here By:"] "\n"] section_header
|
||||
$tooltip_t insert end $save
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ method _rename {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message [append [mc "Failed to rename '%s'." $oldname] "\n\n$err"]
|
||||
-message [strcat [mc "Failed to rename '%s'." $oldname] "\n\n$err"]
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ method _update_ref {} {
|
||||
if {[catch {
|
||||
git update-ref -m $reflog_msg $ref $new $cur
|
||||
} err]} {
|
||||
_error $this [append [mc "Failed to update '%s'." $newbranch] "\n\n$err"]
|
||||
_error $this [strcat [mc "Failed to update '%s'." $newbranch] "\n\n$err"]
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@ -351,7 +351,7 @@ method _readtree_wait {fd} {
|
||||
set err $readtree_d
|
||||
regsub {^fatal: } $err {} err
|
||||
$::main_status stop [mc "Aborted checkout of '%s' (file level merging is required)." [_name $this]]
|
||||
warn_popup [append [mc "File level merge required."] "
|
||||
warn_popup [strcat [mc "File level merge required."] "
|
||||
|
||||
$err
|
||||
|
||||
@ -575,7 +575,7 @@ method _toplevel {title} {
|
||||
}
|
||||
|
||||
method _fatal {err} {
|
||||
error_popup [append [mc "Failed to set current branch.
|
||||
error_popup [strcat [mc "Failed to set current branch.
|
||||
|
||||
This working directory is only partially switched. We successfully updated your files, but failed to update an internal Git file.
|
||||
|
||||
|
@ -314,7 +314,7 @@ method commit_or_die {} {
|
||||
}
|
||||
|
||||
set top [winfo toplevel $w]
|
||||
set msg [append [mc "Invalid revision: %s" [get $this]] "\n\n$err"]
|
||||
set msg [strcat [mc "Invalid revision: %s" [get $this]] "\n\n$err"]
|
||||
tk_messageBox \
|
||||
-icon error \
|
||||
-type ok \
|
||||
|
@ -46,7 +46,7 @@ You are currently in the middle of a merge that has not been fully completed. Y
|
||||
}
|
||||
set msg [string trim $msg]
|
||||
} err]} {
|
||||
error_popup [append [mc "Error loading commit data for amend:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"]
|
||||
return
|
||||
}
|
||||
|
||||
@ -73,12 +73,12 @@ proc committer_ident {} {
|
||||
|
||||
if {$GIT_COMMITTER_IDENT eq {}} {
|
||||
if {[catch {set me [git var GIT_COMMITTER_IDENT]} err]} {
|
||||
error_popup [append [mc "Unable to obtain your identity:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Unable to obtain your identity:"] "\n\n$err"]
|
||||
return {}
|
||||
}
|
||||
if {![regexp {^(.*) [0-9]+ [-+0-9]+$} \
|
||||
$me me GIT_COMMITTER_IDENT]} {
|
||||
error_popup [append [mc "Invalid GIT_COMMITTER_IDENT:"] "\n\n$me"]
|
||||
error_popup [strcat [mc "Invalid GIT_COMMITTER_IDENT:"] "\n\n$me"]
|
||||
return {}
|
||||
}
|
||||
}
|
||||
@ -254,7 +254,7 @@ proc commit_committree {fd_wt curHEAD msg} {
|
||||
|
||||
gets $fd_wt tree_id
|
||||
if {$tree_id eq {} || [catch {close $fd_wt} err]} {
|
||||
error_popup [append [mc "write-tree failed:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "write-tree failed:"] "\n\n$err"]
|
||||
ui_status {Commit failed.}
|
||||
unlock_index
|
||||
return
|
||||
@ -314,7 +314,7 @@ A rescan will be automatically started now.
|
||||
}
|
||||
lappend cmd <$msg_p
|
||||
if {[catch {set cmt_id [eval git $cmd]} err]} {
|
||||
error_popup [append [mc "commit-tree failed:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
|
||||
ui_status {Commit failed.}
|
||||
unlock_index
|
||||
return
|
||||
@ -336,7 +336,7 @@ A rescan will be automatically started now.
|
||||
if {[catch {
|
||||
git update-ref -m $reflogm HEAD $cmt_id $curHEAD
|
||||
} err]} {
|
||||
error_popup [append [mc "update-ref failed:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "update-ref failed:"] "\n\n$err"]
|
||||
ui_status {Commit failed.}
|
||||
unlock_index
|
||||
return
|
||||
|
@ -112,7 +112,7 @@ proc show_diff {path w {lno {}}} {
|
||||
set diff_active 0
|
||||
unlock_index
|
||||
ui_status [mc "Unable to display %s" [escape_path $path]]
|
||||
error_popup [append [mc "Error loading file:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Error loading file:"] "\n\n$err"]
|
||||
return
|
||||
}
|
||||
$ui_diff conf -state normal
|
||||
@ -182,7 +182,7 @@ proc show_diff {path w {lno {}}} {
|
||||
set diff_active 0
|
||||
unlock_index
|
||||
ui_status [mc "Unable to display %s" [escape_path $path]]
|
||||
error_popup [append [mc "Error loading diff:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Error loading diff:"] "\n\n$err"]
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ proc do_restore_defaults {} {
|
||||
|
||||
proc do_save_config {w} {
|
||||
if {[catch {save_config} err]} {
|
||||
error_popup [append [mc "Failed to completely save options:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Failed to completely save options:"] "\n\n$err"]
|
||||
}
|
||||
reshow_diff
|
||||
destroy $w
|
||||
|
@ -23,7 +23,7 @@ proc do_windows_shortcut {} {
|
||||
puts $fd " \"[file normalize $argv0]\""
|
||||
close $fd
|
||||
} err]} {
|
||||
error_popup [append [mc "Cannot write script:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Cannot write script:"] "\n\n$err"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ proc do_cygwin_shortcut {} {
|
||||
puts $fd " &\""
|
||||
close $fd
|
||||
} err]} {
|
||||
error_popup [append [mc "Cannot write script:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Cannot write script:"] "\n\n$err"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,7 +146,7 @@ proc do_macosx_app {} {
|
||||
|
||||
file attributes $exe -permissions u+x,g+x,o+x
|
||||
} err]} {
|
||||
error_popup [append [mc "Cannot write icon:"] "\n\n$err"]
|
||||
error_popup [strcat [mc "Cannot write icon:"] "\n\n$err"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user