git-gui: Paper bag fix missing translated strings
[gitweb.git] / git-gui.sh
index afee777f1c0100f5606669d1a3372acb0a206b06..4682487ade27de393571e912433ece37f6816d82 100755 (executable)
@@ -10,7 +10,7 @@
 
 set appvers {@@GITGUI_VERSION@@}
 set copyright {
-Copyright © 2006, 2007 Shawn Pearce, et. al.
+Copyright Â© 2006, 2007 Shawn Pearce, et. al.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ if {[catch {package require Tcl 8.4} err]
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message $err
        exit 1
 }
@@ -86,7 +86,20 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
 ## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
 
 package require msgcat
-namespace import ::msgcat::mc
+
+proc mc {fmt args} {
+       set fmt [::msgcat::mc $fmt]
+       set cmk [string first @@ $fmt]
+       if {$cmk > 0} {
+               set fmt [string range $fmt 0 [expr {$cmk - 1}]]
+       }
+       return [eval [list format $fmt] $args]
+}
+
+proc strcat {args} {
+       return [join $args {}]
+}
+
 ::msgcat::mcload $oguimsg
 unset oguimsg
 
@@ -517,7 +530,7 @@ if {[catch {set _git_version [git --version]} err]} {
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message "Cannot determine Git version:
 
 $err
@@ -530,8 +543,8 @@ if {![regsub {^git version } $_git_version {} _git_version]} {
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
-               -message [append [mc "Cannot parse Git version string:"] "\n\n$_git_version"]
+               -title [mc "git-gui: fatal error"] \
+               -message [strcat [mc "Cannot parse Git version string:"] "\n\n$_git_version"]
        exit 1
 }
 
@@ -612,7 +625,7 @@ if {[git-version < 1.5]} {
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message "[appname] requires Git 1.5.0 or later.
 
 You are using [git-version]:
@@ -631,7 +644,7 @@ if {[catch {set fd [open $idx r]} err]} {
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message $err
        exit 1
 }
@@ -713,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]} {
@@ -721,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 "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
        }
 }
@@ -1649,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
@@ -1695,7 +1708,7 @@ if {[is_enabled branch]} {
        .mbar add cascade -label [mc Branch] -menu .mbar.branch
 }
 if {[is_enabled multicommit] || [is_enabled singlecommit]} {
-       .mbar add cascade -label [mc Commit] -menu .mbar.commit
+       .mbar add cascade -label [mc Commit@@noun] -menu .mbar.commit
 }
 if {[is_enabled transport]} {
        .mbar add cascade -label [mc Merge] -menu .mbar.merge
@@ -1882,7 +1895,7 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
                -command do_signoff \
                -accelerator $M1T-S
 
-       .mbar.commit add command -label [mc Commit] \
+       .mbar.commit add command -label [mc Commit@@verb] \
                -command do_commit \
                -accelerator $M1T-Return
        lappend disable_on_lock \
@@ -2068,7 +2081,7 @@ blame {
        }
        blame   {
                if {$head eq {} && ![file exists $path]} {
-                       puts stderr "fatal: cannot stat path $path: No such file or directory"
+                       puts stderr [mc "fatal: cannot stat path %s: No such file or directory" $path]
                        exit 1
                }
                blame::new $head $path
@@ -2198,7 +2211,7 @@ button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
        -command do_signoff
 pack .vpane.lower.commarea.buttons.signoff -side top -fill x
 
-button .vpane.lower.commarea.buttons.commit -text [mc Commit] \
+button .vpane.lower.commarea.buttons.commit -text [mc Commit@@verb] \
        -command do_commit
 pack .vpane.lower.commarea.buttons.commit -side top -fill x
 lappend disable_on_lock \
@@ -2579,13 +2592,13 @@ focus -force $ui_comm
 if {[is_Cygwin]} {
        set ignored_env 0
        set suggest_user {}
-       set msg "Possible environment issues exist.
+       set msg [mc "Possible environment issues exist.
 
 The following environment variables are probably
 going to be ignored by any Git subprocess run
-by [appname]:
+by %s:
 
-"
+" [appname]]
        foreach name [array names env] {
                switch -regexp -- $name {
                {^GIT_INDEX_FILE$} -
@@ -2609,18 +2622,18 @@ by [appname]:
                }
        }
        if {$ignored_env > 0} {
-               append msg "
+               append msg [mc "
 This is due to a known issue with the
-Tcl binary distributed by Cygwin."
+Tcl binary distributed by Cygwin."]
 
                if {$suggest_user ne {}} {
-                       append msg "
+                       append msg [mc "
 
-A good replacement for $suggest_user
+A good replacement for %s
 is placing values for the user.name and
 user.email settings into your personal
 ~/.gitconfig file.
-"
+" $suggest_user]
                }
                warn_popup $msg
        }