Skip to contentSkip to conversation

Mark many more strings for i18n.

PATCH New Christian Stimming 1 participant 1 message Jun 15, 2016 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Mark many more strings for i18n.

---
Has already been applied to the "mob" branch of git-gui-i18n.git. Now we surpass the 250 messages - the translation is actually getting interesting by now.

Note that many strings with variables in them had to be rewritten because the variable evaluation has to come after the passing through [mc], not before.

Also, the structure of most of the error message is
"Some verbose text: \n\n git's error message" and the only i18n'able part of this is the part before the colon. In this patch I propose to translate the first part *including* the colon. Alternatively, the structure could be changed into
[append [mc "Some verbose text."] " " [mc "Git error message was:"] "\n\n$err"] and only the very first part is changed but the rest is unchanged for all error messages.

 git-gui.sh                   |   28 +++++++++---------
 lib/blame.tcl                |   10 +++---
 lib/branch_checkout.tcl      |   14 ++++----
 lib/branch_create.tcl        |   36 ++++++++++++------------
 lib/branch_delete.tcl        |   20 ++++++-------
 lib/branch_rename.tcl        |   22 +++++++-------
 lib/browser.tcl              |   20 ++++++------
 lib/checkout_op.tcl          |   46 +++++++++++++++---------------
 lib/choose_rev.tcl           |   16 +++++-----
 lib/commit.tcl               |   52 +++++++++++++++++-----------------
 lib/console.tcl              |   14 ++++----
 lib/database.tcl             |   26 ++++++++--------
 lib/diff.tcl                 |   12 ++++----
 lib/error.tcl                |    8 ++--
 lib/index.tcl                |    8 ++--
 lib/merge.tcl                |   64 ++++++++++++++++++++++-------------------
 lib/option.tcl               |   46 +++++++++++++++---------------
 lib/remote.tcl               |    4 +-
 lib/remote_branch_delete.tcl |   42 +++++++++++++--------------
 lib/shortcut.tcl             |   12 ++++----
 lib/status_bar.tcl           |    2 +-
 lib/transport.tcl            |   30 ++++++++++----------
 22 files changed, 266 insertions(+), 266 deletions(-)
git-gui.sh +14 -14
index 52170ee..fa510b9 100755
@@ -528,7 +528,7 @@ proc tk_optionMenu {w varName args} {
 set _git  [_which git]
 if {$_git eq {}} {
 	catch {wm withdraw .}
-	error_popup "Cannot find git in PATH."
+	error_popup [mc "Cannot find git in PATH."]
 	exit 1
 }
 
@@ -547,7 +547,7 @@ $err
 }
 if {![regsub {^git version } $_git_version {} _git_version]} {
 	catch {wm withdraw .}
-	error_popup "Cannot parse Git version string:\n\n$_git_version"
+	error_popup [append [mc "Cannot parse Git version string:"] "\n\n$_git_version"]
 	exit 1
 }
 
@@ -686,7 +686,7 @@ if {[catch {
 		set _prefix [git rev-parse --show-prefix]
 	} err]} {
 	catch {wm withdraw .}
-	error_popup "Cannot find the git directory:\n\n$err"
+	error_popup [append [mc "Cannot find the git directory:"] "\n\n$err"]
 	exit 1
 }
 if {![file isdirectory $_gitdir] && [is_Cygwin]} {
@@ -694,18 +694,18 @@ if {![file isdirectory $_gitdir] && [is_Cygwin]} {
 }
 if {![file isdirectory $_gitdir]} {
 	catch {wm withdraw .}
-	error_popup "Git directory not found:\n\n$_gitdir"
+	error_popup [append [mc "Git directory not found:"] "\n\n$_gitdir"]
 	exit 1
 }
 if {![is_enabled bare]} {
 	if {[lindex [file split $_gitdir] end] ne {.git}} {
 		catch {wm withdraw .}
-		error_popup "Cannot use funny .git directory:\n\n$_gitdir"
+		error_popup [append [mc "Cannot use funny .git directory:"] "\n\n$_gitdir"]
 		exit 1
 	}
 	if {[catch {cd [file dirname $_gitdir]} err]} {
 		catch {wm withdraw .}
-		error_popup "No working directory [file dirname $_gitdir]:\n\n$err"
+		error_popup [append [mc "No working directory"] " [file dirname $_gitdir]:\n\n$err"]
 		exit 1
 	}
 }
@@ -850,7 +850,7 @@ proc rescan {after {honor_trustmtime 1}} {
 		rescan_stage2 {} $after
 	} else {
 		set rescan_active 1
-		ui_status {Refreshing file status...}
+		ui_status [mc "Refreshing file status..."]
 		set fd_rf [git_read update-index \
 			-q \
 			--unmerged \
@@ -883,7 +883,7 @@ proc rescan_stage2 {fd after} {
 	set buf_rlo {}
 
 	set rescan_active 3
-	ui_status {Scanning for modified files ...}
+	ui_status [mc "Scanning for modified files ..."]
 	set fd_di [git_read diff-index --cached -z [PARENT]]
 	set fd_df [git_read diff-files -z]
 	set fd_lo [eval git_read ls-files --others -z $ls_others]
@@ -1049,7 +1049,7 @@ proc ui_status {msg} {
 }
 
 proc ui_ready {{test {}}} {
-	$::main_status show {Ready.} $test
+	$::main_status show [mc "Ready."] $test
 }
 
 proc escape_path {path} {
@@ -1400,7 +1400,7 @@ proc incr_font_size {font {amt 1}} {
 ##
 ## ui commands
 
-set starting_gitk_msg {Starting gitk... please wait...}
+set starting_gitk_msg [mc "Starting gitk... please wait..."]
 
 proc do_gitk {revs} {
 	# -- Always start gitk through whatever we were loaded with.  This
@@ -1409,7 +1409,7 @@ proc do_gitk {revs} {
 	set exe [file join [file dirname $::_git] gitk]
 	set cmd [list [info nameofexecutable] $exe]
 	if {! [file exists $exe]} {
-		error_popup "Unable to start gitk:\n\n$exe does not exist"
+		error_popup [mc "Unable to start gitk:\n\n%s does not exist" $exe]
 	} else {
 		eval exec $cmd $revs &
 		ui_status $::starting_gitk_msg
@@ -1626,7 +1626,7 @@ proc apply_config {} {
 				font configure $font $cn $cv
 			}
 			} err]} {
-			error_popup "Invalid font specified in gui.$name:\n\n$err"
+			error_popup [mc "Invalid font specified in gui.%s:\n\n%s" $name $err]
 		}
 		foreach {cn cv} [font configure $font] {
 			font configure ${font}bold $cn $cv
@@ -1913,7 +1913,7 @@ if {[is_MacOSX]} {
 		set miga_fd [open "|$cmd" r]
 		fconfigure $miga_fd -blocking 0
 		fileevent $miga_fd readable [list miga_done $miga_fd]
-		ui_status {Running miga...}
+		ui_status [mc "Running miga..."]
 	}
 	proc miga_done {fd} {
 		read $fd 512
@@ -2469,7 +2469,7 @@ unset ui_diff_applyhunk
 #
 set main_status [::status_bar::new .status]
 pack .status -anchor w -side bottom -fill x
-$main_status show {Initializing...}
+$main_status show [mc "Initializing..."]
 
 # -- Load geometry
 #
lib/blame.tcl +5 -5
index 9607284..b5fdad5 100644
@@ -74,11 +74,11 @@ constructor new {i_commit i_path} {
 	set path   $i_path
 
 	make_toplevel top w
-	wm title $top "[appname] ([reponame]): File Viewer"
+	wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]]
 
 	frame $w.header -background gold
 	label $w.header.commit_l \
-		-text {Commit:} \
+		-text [mc "Commit:"] \
 		-background gold \
 		-anchor w \
 		-justify left
@@ -101,7 +101,7 @@ constructor new {i_commit i_path} {
 		-anchor w \
 		-justify left
 	label $w.header.path_l \
-		-text {File:} \
+		-text [mc "File:"] \
 		-background gold \
 		-anchor w \
 		-justify left
@@ -246,7 +246,7 @@ constructor new {i_commit i_path} {
 
 	menu $w.ctxm -tearoff 0
 	$w.ctxm add command \
-		-label "Copy Commit" \
+		-label [mc "Copy Commit"] \
 		-command [cb _copycommit]
 
 	foreach i $w_columns {
@@ -366,7 +366,7 @@ method _load {jump} {
 	set amov_data [list [list]]
 	set asim_data [list [list]]
 
-	$status show "Reading $commit:[escape_path $path]..."
+	$status show [mc "Reading %s..." "$commit:[escape_path $path]"]
 	$w_path conf -text [escape_path $path]
 	if {$commit eq {}} {
 		set fd [open $path r]
lib/branch_checkout.tcl +7 -7
index 72c45b4..c727437 100644
@@ -11,20 +11,20 @@ field opt_detach    0; # force a detached head case?
 
 constructor dialog {} {
 	make_toplevel top w
-	wm title $top "[appname] ([reponame]): Checkout Branch"
+    wm title $top [append "[appname] ([reponame]): " [mc "Checkout Branch"]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
 
-	label $w.header -text {Checkout Branch} -font font_uibold
+	label $w.header -text [mc "Checkout Branch"] -font font_uibold
 	pack $w.header -side top -fill x
 
 	frame $w.buttons
-	button $w.buttons.create -text Checkout \
+	button $w.buttons.create -text [mc Checkout] \
 		-default active \
 		-command [cb _checkout]
 	pack $w.buttons.create -side right
-	button $w.buttons.cancel -text {Cancel} \
+	button $w.buttons.cancel -text [mc Cancel] \
 		-command [list destroy $w]
 	pack $w.buttons.cancel -side right -padx 5
 	pack $w.buttons -side bottom -fill x -pady 10 -padx 10
@@ -33,15 +33,15 @@ constructor dialog {} {
 	$w_rev bind_listbox <Double-Button-1> [cb _checkout]
 	pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
 
-	labelframe $w.options -text {Options}
+	labelframe $w.options -text [mc Options]
 
 	checkbutton $w.options.fetch \
-		-text {Fetch Tracking Branch} \
+		-text [mc "Fetch Tracking Branch"] \
 		-variable @opt_fetch
 	pack $w.options.fetch -anchor nw
 
 	checkbutton $w.options.detach \
-		-text {Detach From Local Branch} \
+		-text [mc "Detach From Local Branch"] \
 		-variable @opt_detach
 	pack $w.options.detach -anchor nw
 
lib/branch_create.tcl +18 -18
index def615d..acfe411 100644
@@ -19,28 +19,28 @@ constructor dialog {} {
 	global repo_config
 
 	make_toplevel top w
-	wm title $top "[appname] ([reponame]): Create Branch"
+	wm title $top [append "[appname] ([reponame]): " [mc "Create Branch"]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
 
-	label $w.header -text {Create New Branch} -font font_uibold
+	label $w.header -text [mc "Create New Branch"] -font font_uibold
 	pack $w.header -side top -fill x
 
 	frame $w.buttons
-	button $w.buttons.create -text Create \
+	button $w.buttons.create -text [mc Create] \
 		-default active \
 		-command [cb _create]
 	pack $w.buttons.create -side right
-	button $w.buttons.cancel -text {Cancel} \
+	button $w.buttons.cancel -text [mc Cancel] \
 		-command [list destroy $w]
 	pack $w.buttons.cancel -side right -padx 5
 	pack $w.buttons -side bottom -fill x -pady 10 -padx 10
 
-	labelframe $w.desc -text {Branch Name}
+	labelframe $w.desc -text [mc "Branch Name"]
 	radiobutton $w.desc.name_r \
 		-anchor w \
-		-text {Name:} \
+		-text [mc "Name:"] \
 		-value user \
 		-variable @name_type
 	set w_name $w.desc.name_t
@@ -55,7 +55,7 @@ constructor dialog {} {
 
 	radiobutton $w.desc.match_r \
 		-anchor w \
-		-text {Match Tracking Branch Name} \
+		-text [mc "Match Tracking Branch Name"] \
 		-value match \
 		-variable @name_type
 	grid $w.desc.match_r -sticky we -padx {0 5} -columnspan 2
@@ -66,35 +66,35 @@ constructor dialog {} {
 	set w_rev [::choose_rev::new $w.rev {Starting Revision}]
 	pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
 
-	labelframe $w.options -text {Options}
+	labelframe $w.options -text [mc Options]
 
 	frame $w.options.merge
-	label $w.options.merge.l -text {Update Existing Branch:}
+	label $w.options.merge.l -text [mc "Update Existing Branch:"]
 	pack $w.options.merge.l -side left
 	radiobutton $w.options.merge.no \
-		-text No \
+		-text [mc No] \
 		-value none \
 		-variable @opt_merge
 	pack $w.options.merge.no -side left
 	radiobutton $w.options.merge.ff \
-		-text {Fast Forward Only} \
+		-text [mc "Fast Forward Only"] \
 		-value ff \
 		-variable @opt_merge
 	pack $w.options.merge.ff -side left
 	radiobutton $w.options.merge.reset \
-		-text {Reset} \
+		-text [mc Reset] \
 		-value reset \
 		-variable @opt_merge
 	pack $w.options.merge.reset -side left
 	pack $w.options.merge -anchor nw
 
 	checkbutton $w.options.fetch \
-		-text {Fetch Tracking Branch} \
+		-text [mc "Fetch Tracking Branch"] \
 		-variable @opt_fetch
 	pack $w.options.fetch -anchor nw
 
 	checkbutton $w.options.checkout \
-		-text {Checkout After Creation} \
+		-text [mc "Checkout After Creation"] \
 		-variable @opt_checkout
 	pack $w.options.checkout -anchor nw
 	pack $w.options -anchor nw -fill x -pady 5 -padx 5
@@ -128,7 +128,7 @@ method _create {} {
 				-type ok \
 				-title [wm title $w] \
 				-parent $w \
-				-message "Please select a tracking branch."
+				-message [mc "Please select a tracking branch."]
 			return
 		}
 		if {![regsub ^refs/heads/ [lindex $spec 2] {} newbranch]} {
@@ -137,7 +137,7 @@ method _create {} {
 				-type ok \
 				-title [wm title $w] \
 				-parent $w \
-				-message "Tracking branch [$w get] is not a branch in the remote repository."
+				-message [mc "Tracking branch %s is not a branch in the remote repository." [$w get]]
 			return
 		}
 	}
@@ -150,7 +150,7 @@ method _create {} {
 			-type ok \
 			-title [wm title $w] \
 			-parent $w \
-			-message "Please supply a branch name."
+			-message [mc "Please supply a branch name."]
 		focus $w_name
 		return
 	}
@@ -161,7 +161,7 @@ method _create {} {
 			-type ok \
 			-title [wm title $w] \
 			-parent $w \
-			-message "'$newbranch' is not an acceptable branch name."
+			-message [mc "'%s' is not an acceptable branch name." $newbranch]
 		focus $w_name
 		return
 	}
lib/branch_delete.tcl +9 -11
index c7573c6..7ac5f8a 100644
@@ -12,29 +12,29 @@ constructor dialog {} {
 	global current_branch
 
 	make_toplevel top w
-	wm title $top "[appname] ([reponame]): Delete Branch"
+	wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch"]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
 
-	label $w.header -text {Delete Local Branch} -font font_uibold
+	label $w.header -text [mc "Delete Local Branch"] -font font_uibold
 	pack $w.header -side top -fill x
 
 	frame $w.buttons
 	set w_delete $w.buttons.delete
 	button $w_delete \
-		-text Delete \
+		-text [mc Delete] \
 		-default active \
 		-state disabled \
 		-command [cb _delete]
 	pack $w_delete -side right
 	button $w.buttons.cancel \
-		-text {Cancel} \
+		-text [mc Cancel] \
 		-command [list destroy $w]
 	pack $w.buttons.cancel -side right -padx 5
 	pack $w.buttons -side bottom -fill x -pady 10 -padx 10
 
-	labelframe $w.list -text {Local Branches}
+	labelframe $w.list -text [mc "Local Branches"]
 	set w_heads $w.list.l
 	listbox $w_heads \
 		-height 10 \
@@ -49,9 +49,9 @@ constructor dialog {} {
 
 	set w_check [choose_rev::new \
 		$w.check \
-		{Delete Only If Merged Into} \
+		[mc "Delete Only If Merged Into"] \
 		]
-	$w_check none {Always (Do not perform merge test.)}
+	$w_check none [mc "Always (Do not perform merge test.)"]
 	pack $w.check -anchor nw -fill x -pady 5 -padx 5
 
 	foreach h [load_all_heads] {
@@ -112,9 +112,7 @@ method _delete {} {
 	}
 	if {$to_delete eq {}} return
 	if {$check_cmt eq {}} {
-		set msg {Recovering deleted branches is difficult.
-
-Delete the selected branches?}
+		set msg [mc "Recovering deleted branches is difficult. \n\n Delete the selected branches?"]
 		if {[tk_messageBox \
 			-icon warning \
 			-type yesno \
@@ -140,7 +138,7 @@ Delete the selected branches?}
 			-type ok \
 			-title [wm title $w] \
 			-parent $w \
-			-message "Failed to delete branches:\n$failed"
+			-message [mc "Failed to delete branches:\n%s" $failed]
 	}
 
 	destroy $w
lib/branch_rename.tcl +11 -11
index 1cadc31..e8592af 100644
@@ -11,7 +11,7 @@ constructor dialog {} {
 	global current_branch
 
 	make_toplevel top w
-	wm title $top "[appname] ([reponame]): Rename Branch"
+	wm title $top [append "[appname] ([reponame]): " [mc "Rename Branch"]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
@@ -19,24 +19,24 @@ constructor dialog {} {
 	set oldname $current_branch
 	set newname [get_config gui.newbranchtemplate]
 
-	label $w.header -text {Rename Branch} -font font_uibold
+	label $w.header -text [mc "Rename Branch"] -font font_uibold
 	pack $w.header -side top -fill x
 
 	frame $w.buttons
-	button $w.buttons.rename -text Rename \
+	button $w.buttons.rename -text [mc Rename] \
 		-default active \
 		-command [cb _rename]
 	pack $w.buttons.rename -side right
-	button $w.buttons.cancel -text {Cancel} \
+	button $w.buttons.cancel -text [mc Cancel] \
 		-command [list destroy $w]
 	pack $w.buttons.cancel -side right -padx 5
 	pack $w.buttons -side bottom -fill x -pady 10 -padx 10
 
 	frame $w.rename
-	label $w.rename.oldname_l -text {Branch:}
+	label $w.rename.oldname_l -text [mc "Branch:"]
 	eval tk_optionMenu $w.rename.oldname_m @oldname [load_all_heads]
 
-	label $w.rename.newname_l -text {New Name:}
+	label $w.rename.newname_l -text [mc "New Name:"]
 	entry $w.rename.newname_t \
 		-borderwidth 1 \
 		-relief sunken \
@@ -72,7 +72,7 @@ method _rename {} {
 			-type ok \
 			-title [wm title $w] \
 			-parent $w \
-			-message "Please select a branch to rename."
+			-message [mc "Please select a branch to rename."]
 		focus $w.rename.oldname_m
 		return
 	}
@@ -83,7 +83,7 @@ method _rename {} {
 			-type ok \
 			-title [wm title $w] \
 			-parent $w \
-			-message "Please supply a branch name."
+			-message [mc "Please supply a branch name."]
 		focus $w.rename.newname_t
 		return
 	}
@@ -93,7 +93,7 @@ method _rename {} {
 			-type ok \
 			-title [wm title $w] \
 			-parent $w \
-			-message "Branch '$newname' already exists."
+			-message [mc "Branch '%s' already exists." $newname]
 		focus $w.rename.newname_t
 		return
 	}
@@ -103,7 +103,7 @@ method _rename {} {
 			-type ok \
 			-title [wm title $w] \
 			-parent $w \
-			-message "We do not like '$newname' as a branch name."
+			-message [mc "We do not like '%s' as a branch name." $newname]
 		focus $w.rename.newname_t
 		return
 	}
@@ -114,7 +114,7 @@ method _rename {} {
 			-type ok \
 			-title [wm title $w] \
 			-parent $w \
-			-message "Failed to rename '$oldname'.\n\n$err"
+			-message [mc "Failed to rename '%s'.\n\n%s" $oldname $err]
 		return
 	}
 
lib/browser.tcl +10 -10
index b684c67..9435e67 100644
@@ -7,7 +7,7 @@ field w
 field browser_commit
 field browser_path
 field browser_files  {}
-field browser_status {Starting...}
+field browser_status [mc "Starting..."]
 field browser_stack  {}
 field browser_busy   1
 
@@ -16,7 +16,7 @@ field ls_buf     {}; # Buffered record output from ls-tree
 constructor new {commit {path {}}} {
 	global cursor_ptr M1B
 	make_toplevel top w
-	wm title $top "[appname] ([reponame]): File Browser"
+	wm title $top [append "[appname] ([reponame]): " [mc "File Browser"]]
 
 	set browser_commit $commit
 	set browser_path $browser_commit:$path
@@ -117,7 +117,7 @@ method _parent {} {
 		} else {
 			regsub {/[^/]+$} $browser_path {} browser_path
 		}
-		set browser_status "Loading $browser_path..."
+		set browser_status [mc "Loading %s..." $browser_path]
 		_ls $this [lindex $parent 0] [lindex $parent 1]
 	}
 }
@@ -134,7 +134,7 @@ method _enter {} {
 		tree {
 			set name [lindex $info 2]
 			set escn [escape_path $name]
-			set browser_status "Loading $escn..."
+			set browser_status [mc "Loading %s..." $escn]
 			append browser_path $escn
 			_ls $this [lindex $info 1] $name
 		}
@@ -178,7 +178,7 @@ method _ls {tree_id {name {}}} {
 			-align center -padx 5 -pady 1 \
 			-name icon0 \
 			-image file_uplevel
-		$w insert end {[Up To Parent]}
+		$w insert end [mc "[Up To Parent]"]
 		lappend browser_files parent
 	}
 	lappend browser_stack [list $tree_id $name]
@@ -230,7 +230,7 @@ method _read {fd} {
 
 	if {[eof $fd]} {
 		close $fd
-		set browser_status Ready.
+		set browser_status [mc "Ready."]
 		set browser_busy 0
 		set ls_buf {}
 		if {$n > 0} {
@@ -251,22 +251,22 @@ field w_rev          ; # mega-widget to pick the initial revision
 
 constructor dialog {} {
 	make_toplevel top w
-	wm title $top "[appname] ([reponame]): Browse Branch Files"
+	wm title $top [append "[appname] ([reponame]): " [mc "Browse Branch Files"]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
 
 	label $w.header \
-		-text {Browse Branch Files} \
+		-text [mc "Browse Branch Files"] \
 		-font font_uibold
 	pack $w.header -side top -fill x
 
 	frame $w.buttons
-	button $w.buttons.browse -text Browse \
+	button $w.buttons.browse -text [mc Browse] \
 		-default active \
 		-command [cb _open]
 	pack $w.buttons.browse -side right
-	button $w.buttons.cancel -text {Cancel} \
+	button $w.buttons.cancel -text [mc Cancel] \
 		-command [list destroy $w]
 	pack $w.buttons.cancel -side right -padx 5
 	pack $w.buttons -side bottom -fill x -pady 10 -padx 10
lib/checkout_op.tcl +23 -23

153 lines not on this page · raw message

lib/choose_rev.tcl +8 -8
index 6c4c318..1e82990 100644
@@ -32,14 +32,14 @@ constructor new {path {title {}}} {
 	if {$is_detached} {
 		radiobutton $w.detachedhead_r \
 			-anchor w \
-			-text {This Detached Checkout} \
+			-text [mc "This Detached Checkout"] \
 			-value HEAD \
 			-variable @revtype
 		grid $w.detachedhead_r -sticky we -padx {0 5} -columnspan 2
 	}
 
 	radiobutton $w.expr_r \
-		-text {Revision Expression:} \
+		-text [mc "Revision Expression:"] \
 		-value expr \
 		-variable @revtype
 	entry $w.expr_t \
@@ -53,17 +53,17 @@ constructor new {path {title {}}} {
 
 	frame $w.types
 	radiobutton $w.types.head_r \
-		-text {Local Branch} \
+		-text [mc "Local Branch"] \
 		-value head \
 		-variable @revtype
 	pack $w.types.head_r -side left
 	radiobutton $w.types.trck_r \
-		-text {Tracking Branch} \
+		-text [mc "Tracking Branch"] \
 		-value trck \
 		-variable @revtype
 	pack $w.types.trck_r -side left
 	radiobutton $w.types.tag_r \
-		-text {Tag} \
+		-text [mc "Tag"] \
 		-value tag \
 		-variable @revtype
 	pack $w.types.tag_r -side left
@@ -224,7 +224,7 @@ method commit_or_die {} {
 		}
 
 		set top [winfo toplevel $w]
-		set msg "Invalid revision: [get $this]\n\n$err"
+		set msg [mc "Invalid revision: %s\n\n%s" [get $this] $err]
 		tk_messageBox \
 			-icon error \
 			-type ok \
@@ -245,7 +245,7 @@ method _expr {} {
 		if {$i ne {}} {
 			return [lindex $cur_specs $i 1]
 		} else {
-			error "No revision selected."
+			error [mc "No revision selected."]
 		}
 	}
 
@@ -253,7 +253,7 @@ method _expr {} {
 		if {$c_expr ne {}} {
 			return $c_expr
 		} else {
-			error "Revision expression is empty."
+			error [mc "Revision expression is empty."]
 		}
 	}
 	HEAD { return HEAD                     }
lib/commit.tcl +26 -26

156 lines not on this page · raw message

lib/console.tcl +7 -7
index 6f718fb..e5f9ba4 100644
@@ -52,7 +52,7 @@ method _init {} {
 		-state disabled \
 		-xscrollcommand [list $w.m.sbx set] \
 		-yscrollcommand [list $w.m.sby set]
-	label $w.m.s -text {Working... please wait...} \
+	label $w.m.s -text [mc "Working... please wait..."] \
 		-anchor w \
 		-justify left \
 		-font font_uibold
@@ -66,11 +66,11 @@ method _init {} {
 	pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10
 
 	menu $w.ctxm -tearoff 0
-	$w.ctxm add command -label "Copy" \
+	$w.ctxm add command -label [mc "Copy"] \
 		-command "tk_textCopy $w.m.t"
-	$w.ctxm add command -label "Select All" \
+	$w.ctxm add command -label [mc "Select All"] \
 		-command "focus $w.m.t;$w.m.t tag add sel 0.0 end"
-	$w.ctxm add command -label "Copy All" \
+	$w.ctxm add command -label [mc "Copy All"] \
 		-command "
 			$w.m.t tag add sel 0.0 end
 			tk_textCopy $w.m.t
@@ -78,7 +78,7 @@ method _init {} {
 		"
 
 	if {$is_toplevel} {
-		button $w.ok -text {Close} \
+		button $w.ok -text [mc "Close"] \
 			-state disabled \
 			-command [list destroy $w]
 		pack $w.ok -side bottom -anchor e -pady 10 -padx 10
@@ -181,7 +181,7 @@ method insert {txt} {
 method done {ok} {
 	if {$ok} {
 		if {[winfo exists $w.m.s]} {
-			$w.m.s conf -background green -text {Success}
+			$w.m.s conf -background green -text [mc "Success"]
 			if {$is_toplevel} {
 				$w.ok conf -state normal
 				focus $w.ok
@@ -191,7 +191,7 @@ method done {ok} {
 		if {![winfo exists $w.m.s]} {
 			_init $this
 		}
-		$w.m.s conf -background red -text {Error: Command Failed}
+		$w.m.s conf -background red -text [mc "Error: Command Failed"]
 		if {$is_toplevel} {
 			$w.ok conf -state normal
 			focus $w.ok
lib/database.tcl +13 -13
index 0657cc2..8dda9af 100644
@@ -24,14 +24,14 @@ proc do_stats {} {
 	toplevel $w
 	wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
 
-	label $w.header -text {Database Statistics}
+	label $w.header -text [mc "Database Statistics"]
 	pack $w.header -side top -fill x
 
 	frame $w.buttons -border 1
-	button $w.buttons.close -text Close \
+	button $w.buttons.close -text [mc Close] \
 		-default active \
 		-command [list destroy $w]
-	button $w.buttons.gc -text {Compress Database} \
+	button $w.buttons.gc -text [mc "Compress Database"] \
 		-default normal \
 		-command "destroy $w;do_gc"
 	pack $w.buttons.close -side right
@@ -40,13 +40,13 @@ proc do_stats {} {
 
 	frame $w.stat -borderwidth 1 -relief solid
 	foreach s {
-		{count           {Number of loose objects}}
-		{size            {Disk space used by loose objects} { KiB}}
-		{in-pack         {Number of packed objects}}
-		{packs           {Number of packs}}
-		{size-pack       {Disk space used by packed objects} { KiB}}
-		{prune-packable  {Packed objects waiting for pruning}}
-		{garbage         {Garbage files}}
+		{count           [mc "Number of loose objects"]}
+		{size            [mc "Disk space used by loose objects"] { KiB}}
+		{in-pack         [mc "Number of packed objects"]}
+		{packs           [mc "Number of packs"]}
+		{size-pack       [mc "Disk space used by packed objects"] { KiB}}
+		{prune-packable  [mc "Packed objects waiting for pruning"]}
+		{garbage         [mc "Garbage files"]}
 		} {
 		set name [lindex $s 0]
 		set label [lindex $s 1]
@@ -64,12 +64,12 @@ proc do_stats {} {
 	bind $w <Visibility> "grab $w; focus $w.buttons.close"
 	bind $w <Key-Escape> [list destroy $w]
 	bind $w <Key-Return> [list destroy $w]
-	wm title $w "[appname] ([reponame]): Database Statistics"
+	wm title $w [append "[appname] ([reponame]): " [mc "Database Statistics"]]
 	tkwait window $w
 }
 
 proc do_gc {} {
-	set w [console::new {gc} {Compressing the object database}]
+	set w [console::new {gc} [mc "Compressing the object database"]]
 	console::chain $w {
 		{exec git pack-refs --prune}
 		{exec git reflog expire --all}
@@ -80,7 +80,7 @@ proc do_gc {} {
 
 proc do_fsck_objects {} {
 	set w [console::new {fsck-objects} \
-		{Verifying the object database with fsck-objects}]
+		[mc "Verifying the object database with fsck-objects"]]
 	set cmd [list git fsck-objects]
 	lappend cmd --full
 	lappend cmd --cache
lib/diff.tcl +6 -6
index e09e125..d937e46 100644
@@ -39,13 +39,13 @@ proc handle_empty_diff {} {
 	set s $file_states($path)
 	if {[lindex $s 0] ne {_M}} return
 
-	info_popup "No differences detected.
+	info_popup [mc "No differences detected.
 
-[short_path $path] has no changes.
+%s has no changes.
 
 The modification date of this file was updated by another application, but the content within the file was not changed.
 
-A rescan will be automatically started to find other files which may have the same state."
+A rescan will be automatically started to find other files which may have the same state." [short_path $path]]
 
 	clear_diff
 	display_file $path __
@@ -94,7 +94,7 @@ proc show_diff {path w {lno {}}} {
 			set diff_active 0
 			unlock_index
 			ui_status "Unable to display [escape_path $path]"
-			error_popup "Error loading file:\n\n$err"
+ 		    error_popup [append [mc "Error loading file:"] "\n\n$err"]
 			return
 		}
 		$ui_diff conf -state normal
@@ -159,7 +159,7 @@ proc show_diff {path w {lno {}}} {
 		set diff_active 0
 		unlock_index
 		ui_status "Unable to display [escape_path $path]"
-		error_popup "Error loading diff:\n\n$err"
+		error_popup [append [mc "Error loading diff:"] "\n\n$err"]
 		return
 	}
 
@@ -307,7 +307,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 "Failed to $mode selected hunk.\n\n$err"
+		error_popup [append [mc "Failed to %s selected hunk." $mode] "\n\n$err"]
 		unlock_index
 		return
 	}
lib/error.tcl +4 -4
index 16a2218..13565b7 100644
@@ -9,7 +9,7 @@ proc error_popup {msg} {
 	set cmd [list tk_messageBox \
 		-icon error \
 		-type ok \
-		-title "$title: error" \
+		-title [append "$title: " [mc "error"]] \
 		-message $msg]
 	if {[winfo ismapped .]} {
 		lappend cmd -parent .
@@ -25,7 +25,7 @@ proc warn_popup {msg} {
 	set cmd [list tk_messageBox \
 		-icon warning \
 		-type ok \
-		-title "$title: warning" \
+		-title [append "$title: " [mc "warning"]] \
 		-message $msg]
 	if {[winfo ismapped .]} {
 		lappend cmd -parent .
@@ -78,7 +78,7 @@ proc hook_failed_popup {hook msg} {
 		-font font_diff \
 		-yscrollcommand [list $w.m.sby set]
 	label $w.m.l2 \
-		-text {You must correct the above errors before committing.} \
+		-text [mc "You must correct the above errors before committing."] \
 		-anchor w \
 		-justify left \
 		-font font_uibold
@@ -99,6 +99,6 @@ proc hook_failed_popup {hook msg} {
 
 	bind $w <Visibility> "grab $w; focus $w"
 	bind $w <Key-Return> "destroy $w"
-	wm title $w "[appname] ([reponame]): error"
+	wm title $w [append "[appname] ([reponame]): " [mc "error"]]
 	tkwait window $w
 }
lib/index.tcl +4 -4
index 3ea72e1..9080ac6 100644
@@ -358,13 +358,13 @@ proc revert_helper {txt paths} {
 	set reply [tk_dialog \
 		.confirm_revert \
 		"[appname] ([reponame])" \
-		"Revert changes in $s?
+		[mc "Revert changes in %s?
 
-Any unadded changes will be permanently lost by the revert." \
+Any unadded changes will be permanently lost by the revert." $s] \
 		question \
 		1 \
-		{Do Nothing} \
-		{Revert Changes} \
+		[mc "Do Nothing"] \
+		[mc "Revert Changes"] \
 		]
 	if {$reply == 1} {
 		checkout_index \
lib/merge.tcl +34 -30

162 lines not on this page · raw message

lib/option.tcl +23 -23

96 lines not on this page · raw message

lib/remote.tcl +2 -2
index e235ca8..c47ae50 100644
@@ -163,7 +163,7 @@ proc populate_fetch_menu {} {
 	}
 	foreach r $prune_list {
 		$m add command \
-			-label "Prune from $r..." \
+			-label [mc "Prune from %s..." $r] \
 			-command [list prune_from $r]
 	}
 }
@@ -197,7 +197,7 @@ proc populate_push_menu {} {
 				$m add separator
 			}
 			$m add command \
-				-label "Push to $r..." \
+				-label [mc "Push to %s..." $r] \
 				-command [list push_to $r]
 			incr fast_count
 		}
lib/remote_branch_delete.tcl +20 -22

136 lines not on this page · raw message

lib/shortcut.tcl +6 -6
index c36be2f..d0e63a3 100644
@@ -6,7 +6,7 @@ proc do_windows_shortcut {} {
 
 	set fn [tk_getSaveFile \
 		-parent . \
-		-title "[appname] ([reponame]): Create Desktop Icon" \
+		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
 		-initialfile "Git [reponame].bat"]
 	if {$fn != {}} {
 		if {[file extension $fn] ne {.bat}} {
@@ -23,7 +23,7 @@ proc do_windows_shortcut {} {
 				puts $fd " \"[file normalize $argv0]\""
 				close $fd
 			} err]} {
-			error_popup "Cannot write script:\n\n$err"
+			error_popup [append [mc "Cannot write script:"] "\n\n$err"]
 		}
 	}
 }
@@ -42,7 +42,7 @@ proc do_cygwin_shortcut {} {
 	}
 	set fn [tk_getSaveFile \
 		-parent . \
-		-title "[appname] ([reponame]): Create Desktop Icon" \
+		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
 		-initialdir $desktop \
 		-initialfile "Git [reponame].bat"]
 	if {$fn != {}} {
@@ -71,7 +71,7 @@ proc do_cygwin_shortcut {} {
 				puts $fd " &\""
 				close $fd
 			} err]} {
-			error_popup "Cannot write script:\n\n$err"
+			error_popup [append [mc "Cannot write script:"] "\n\n$err"]
 		}
 	}
 }
@@ -81,7 +81,7 @@ proc do_macosx_app {} {
 
 	set fn [tk_getSaveFile \
 		-parent . \
-		-title "[appname] ([reponame]): Create Desktop Icon" \
+		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
 		-initialdir [file join $env(HOME) Desktop] \
 		-initialfile "Git [reponame].app"]
 	if {$fn != {}} {
@@ -146,7 +146,7 @@ proc do_macosx_app {} {
 
 				file attributes $exe -permissions u+x,g+x,o+x
 			} err]} {
-			error_popup "Cannot write icon:\n\n$err"
+			error_popup [append [mc "Cannot write icon:"] "\n\n$err"]
 		}
 	}
 }
lib/status_bar.tcl +1 -1
index 72a8fe1..769ef81 100644
@@ -55,7 +55,7 @@ method update {have total} {
 		set pdone [expr {100 * $have / $total}]
 	}
 
-	set status [format "%s ... %i of %i %s (%2i%%)" \
+	set status [mc "%s ... %i of %i %s (%2i%%)" \
 		$prefix $have $total $units $pdone]
 	$w_c coords bar 0 0 $pdone 20
 }
lib/transport.tcl +15 -15
index 3a22bd4..1c7baef 100644
@@ -4,7 +4,7 @@
 proc fetch_from {remote} {
 	set w [console::new \
 		"fetch $remote" \
-		"Fetching new changes from $remote"]
+		[mc "Fetching new changes from %s" $remote]]
 	set cmds [list]
 	lappend cmds [list exec git fetch $remote]
 	if {[is_config_true gui.pruneduringfetch]} {
@@ -16,14 +16,14 @@ proc fetch_from {remote} {
 proc prune_from {remote} {
 	set w [console::new \
 		"remote prune $remote" \
-		"Pruning tracking branches deleted from $remote"]
+		[mc "Pruning tracking branches deleted from %s" $remote]]
 	console::exec $w [list git remote prune $remote]
 }
 
 proc push_to {remote} {
 	set w [console::new \
 		"push $remote" \
-		"Pushing changes to $remote"]
+		[mc "Pushing changes to %s" $remote]]
 	set cmd [list git push]
 	lappend cmd -v
 	lappend cmd $remote
@@ -65,7 +65,7 @@ proc start_push_anywhere_action {w} {
 
 	set cons [console::new \
 		"push $r_url" \
-		"Pushing $cnt $unit to $r_url"]
+		[mc "Pushing %s %s to %s" $cnt $unit $r_url]]
 	console::exec $cons $cmd
 	destroy $w
 }
@@ -81,21 +81,21 @@ proc do_push_anywhere {} {
 	toplevel $w
 	wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
 
-	label $w.header -text {Push Branches} -font font_uibold
+	label $w.header -text [mc "Push Branches"] -font font_uibold
 	pack $w.header -side top -fill x
 
 	frame $w.buttons
-	button $w.buttons.create -text Push \
+	button $w.buttons.create -text [mc Push] \
 		-default active \
 		-command [list start_push_anywhere_action $w]
 	pack $w.buttons.create -side right
-	button $w.buttons.cancel -text {Cancel} \
+	button $w.buttons.cancel -text [mc "Cancel"] \
 		-default normal \
 		-command [list destroy $w]
 	pack $w.buttons.cancel -side right -padx 5
 	pack $w.buttons -side bottom -fill x -pady 10 -padx 10
 
-	labelframe $w.source -text {Source Branches}
+	labelframe $w.source -text [mc "Source Branches"]
 	listbox $w.source.l \
 		-height 10 \
 		-width 70 \
@@ -112,10 +112,10 @@ proc do_push_anywhere {} {
 	pack $w.source.l -side left -fill both -expand 1
 	pack $w.source -fill both -expand 1 -pady 5 -padx 5
 
-	labelframe $w.dest -text {Destination Repository}
+	labelframe $w.dest -text [mc "Destination Repository"]
 	if {$all_remotes ne {}} {
 		radiobutton $w.dest.remote_r \
-			-text {Remote:} \
+			-text [mc "Remote:"] \
 			-value remote \
 			-variable push_urltype
 		eval tk_optionMenu $w.dest.remote_m push_remote $all_remotes
@@ -130,7 +130,7 @@ proc do_push_anywhere {} {
 		set push_urltype url
 	}
 	radiobutton $w.dest.url_r \
-		-text {Arbitrary URL:} \
+		-text [mc "Arbitrary URL:"] \
 		-value url \
 		-variable push_urltype
 	entry $w.dest.url_t \
@@ -150,13 +150,13 @@ proc do_push_anywhere {} {
 	grid columnconfigure $w.dest 1 -weight 1
 	pack $w.dest -anchor nw -fill x -pady 5 -padx 5
 
-	labelframe $w.options -text {Transfer Options}
+	labelframe $w.options -text [mc "Transfer Options"]
 	checkbutton $w.options.thin \
-		-text {Use thin pack (for slow network connections)} \
+		-text [mc "Use thin pack (for slow network connections)"] \
 		-variable push_thin
 	grid $w.options.thin -columnspan 2 -sticky w
 	checkbutton $w.options.tags \
-		-text {Include tags} \
+		-text [mc "Include tags"] \
 		-variable push_tags
 	grid $w.options.tags -columnspan 2 -sticky w
 	grid columnconfigure $w.options 1 -weight 1
@@ -169,6 +169,6 @@ proc do_push_anywhere {} {
 	bind $w <Visibility> "grab $w; focus $w.buttons.create"
 	bind $w <Key-Escape> "destroy $w"
 	bind $w <Key-Return> [list start_push_anywhere_action $w]
-	wm title $w "[appname] ([reponame]): Push"
+	wm title $w [append "[appname] ([reponame]): " [mc "Push"]]
 	tkwait window $w
 }
Signature · 1 line
1.5.2.3