git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] git-gui i18n: mark strings for translation
@ 2016-05-08 10:52 Vasco Almeida
  2016-05-08 10:52 ` [PATCH 2/5] git-gui i18n: internationalize use of colon punctuation Vasco Almeida
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Vasco Almeida @ 2016-05-08 10:52 UTC (permalink / raw)
  To: git; +Cc: Vasco Almeida, Shawn O . Pearce, Pat Thoyts

Mark strings for translation in lib/index.tcl that were seemingly
left behind by 700e560 ("git-gui: Mark forgotten strings for
translation.", 2008-09-04) which marks string in do_revert_selection
procedure.
These strings are passed to unstage_help and add_helper procedures.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 lib/index.tcl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/index.tcl b/lib/index.tcl
index 74a81a7..3a3e534 100644
--- a/lib/index.tcl
+++ b/lib/index.tcl
@@ -291,7 +291,7 @@ proc do_unstage_selection {} {
 
 	if {[array size selected_paths] > 0} {
 		unstage_helper \
-			{Unstaging selected files from commit} \
+			[mc "Unstaging selected files from commit"] \
 			[array names selected_paths]
 	} elseif {$current_diff_path ne {}} {
 		unstage_helper \
@@ -343,7 +343,7 @@ proc do_add_selection {} {
 
 	if {[array size selected_paths] > 0} {
 		add_helper \
-			{Adding selected files} \
+			[mc "Adding selected files"] \
 			[array names selected_paths]
 	} elseif {$current_diff_path ne {}} {
 		add_helper \
@@ -385,7 +385,7 @@ proc do_add_all {} {
 			set paths [concat $paths $untracked_paths]
 		}
 	}
-	add_helper {Adding all changed files} $paths
+	add_helper [mc "Adding all changed files"] $paths
 }
 
 proc revert_helper {txt paths} {
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] git-gui i18n: internationalize use of colon punctuation
  2016-05-08 10:52 [PATCH 1/5] git-gui i18n: mark strings for translation Vasco Almeida
@ 2016-05-08 10:52 ` Vasco Almeida
  2016-05-08 10:52 ` [PATCH 3/5] git-gui i18n: mark "usage:" strings for translation Vasco Almeida
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Vasco Almeida @ 2016-05-08 10:52 UTC (permalink / raw)
  To: git; +Cc: Vasco Almeida, Shawn O . Pearce, Pat Thoyts

Internationalize use of colon punctuation ':' in options window, windows
titles, database statistics window. Some languages might use a different
style, for instance French uses "User Name :" (space before colon).

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 lib/branch_delete.tcl | 2 +-
 lib/database.tcl      | 2 +-
 lib/error.tcl         | 2 +-
 lib/option.tcl        | 8 ++++----
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/branch_delete.tcl b/lib/branch_delete.tcl
index 867938e..9aef0c9 100644
--- a/lib/branch_delete.tcl
+++ b/lib/branch_delete.tcl
@@ -128,7 +128,7 @@ method _delete {} {
 		set b [lindex $i 0]
 		set o [lindex $i 1]
 		if {[catch {git branch -D $b} err]} {
-			append failed " - $b: $err\n"
+			append failed [mc " - %s:" $b] " $err\n"
 		}
 	}
 
diff --git a/lib/database.tcl b/lib/database.tcl
index 1f187ed..8bd4b8e 100644
--- a/lib/database.tcl
+++ b/lib/database.tcl
@@ -54,7 +54,7 @@ proc do_stats {} {
 			set value "$value[lindex $s 2]"
 		}
 
-		${NS}::label $w.stat.l_$name -text "$label:" -anchor w
+		${NS}::label $w.stat.l_$name -text [mc "%s:" $label] -anchor w
 		${NS}::label $w.stat.v_$name -text $value -anchor w
 		grid $w.stat.l_$name $w.stat.v_$name -sticky we -padx {0 5}
 	}
diff --git a/lib/error.tcl b/lib/error.tcl
index c0fa69a..9b7d229 100644
--- a/lib/error.tcl
+++ b/lib/error.tcl
@@ -113,7 +113,7 @@ proc hook_failed_popup {hook msg {is_fatal 1}} {
 
 	bind $w <Visibility> "grab $w; focus $w"
 	bind $w <Key-Return> "destroy $w"
-	wm title $w [strcat "[appname] ([reponame]): " [mc "error"]]
+	wm title $w [mc "%s (%s): error" [appname] [reponame]]
 	wm deiconify $w
 	tkwait window $w
 }
diff --git a/lib/option.tcl b/lib/option.tcl
index b5b6b2f..e43971b 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -179,7 +179,7 @@ proc do_options {} {
 			i-* {
 				regexp -- {-(\d+)\.\.(\d+)$} $type _junk min max
 				${NS}::frame $w.$f.$optid
-				${NS}::label $w.$f.$optid.l -text "$text:"
+				${NS}::label $w.$f.$optid.l -text [mc "%s:" $text]
 				pack $w.$f.$optid.l -side left -anchor w -fill x
 				tspinbox $w.$f.$optid.v \
 					-textvariable ${f}_config_new($name) \
@@ -194,7 +194,7 @@ proc do_options {} {
 			c -
 			t {
 				${NS}::frame $w.$f.$optid
-				${NS}::label $w.$f.$optid.l -text "$text:"
+				${NS}::label $w.$f.$optid.l -text [mc "%s:" $text]
 				${NS}::entry $w.$f.$optid.v \
 					-width 20 \
 					-textvariable ${f}_config_new($name)
@@ -217,7 +217,7 @@ proc do_options {} {
 			s {
 				set opts [eval [lindex $option 3]]
 				${NS}::frame $w.$f.$optid
-				${NS}::label $w.$f.$optid.l -text "$text:"
+				${NS}::label $w.$f.$optid.l -text [mc "%s:" $text]
 				if {$use_ttk} {
 					ttk::combobox $w.$f.$optid.v \
 						-textvariable ${f}_config_new($name) \
@@ -279,7 +279,7 @@ proc do_options {} {
 			[font configure $font -size]
 
 		${NS}::frame $w.global.$name
-		${NS}::label $w.global.$name.l -text "$text:"
+		${NS}::label $w.global.$name.l -text [mc "%s:" $text]
 		${NS}::button $w.global.$name.b \
 			-text [mc "Change Font"] \
 			-command [list \
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] git-gui i18n: mark "usage:" strings for translation
  2016-05-08 10:52 [PATCH 1/5] git-gui i18n: mark strings for translation Vasco Almeida
  2016-05-08 10:52 ` [PATCH 2/5] git-gui i18n: internationalize use of colon punctuation Vasco Almeida
@ 2016-05-08 10:52 ` Vasco Almeida
  2016-05-08 10:52 ` [PATCH 4/5] git-gui: fix incorrect use of Tcl append command Vasco Almeida
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Vasco Almeida @ 2016-05-08 10:52 UTC (permalink / raw)
  To: git; +Cc: Vasco Almeida, Shawn O . Pearce, Pat Thoyts

Mark command-line "usage:" string for translation in git-gui.sh.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 git-gui.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 11048c7..4ae344f 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3007,7 +3007,7 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
 
 set subcommand_args {}
 proc usage {} {
-	set s "usage: $::argv0 $::subcommand $::subcommand_args"
+	set s "[mc usage:] $::argv0 $::subcommand $::subcommand_args"
 	if {[tk windowingsystem] eq "win32"} {
 		wm withdraw .
 		tk_messageBox -icon info -message $s \
@@ -3139,7 +3139,7 @@ gui {
 	# fall through to setup UI for commits
 }
 default {
-	set err "usage: $argv0 \[{blame|browser|citool}\]"
+	set err "[mc usage:] $argv0 \[{blame|browser|citool}\]"
 	if {[tk windowingsystem] eq "win32"} {
 		wm withdraw .
 		tk_messageBox -icon error -message $err \
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] git-gui: fix incorrect use of Tcl append command
  2016-05-08 10:52 [PATCH 1/5] git-gui i18n: mark strings for translation Vasco Almeida
  2016-05-08 10:52 ` [PATCH 2/5] git-gui i18n: internationalize use of colon punctuation Vasco Almeida
  2016-05-08 10:52 ` [PATCH 3/5] git-gui i18n: mark "usage:" strings for translation Vasco Almeida
@ 2016-05-08 10:52 ` Vasco Almeida
  2016-10-03 10:23   ` Pat Thoyts
  2016-05-08 10:52 ` [PATCH 5/5] git-gui i18n: mark string in lib/error.tcl for translation Vasco Almeida
  2016-10-03 10:30 ` [PATCH 1/5] git-gui i18n: mark strings " Pat Thoyts
  4 siblings, 1 reply; 8+ messages in thread
From: Vasco Almeida @ 2016-05-08 10:52 UTC (permalink / raw)
  To: git; +Cc: Vasco Almeida, Shawn O . Pearce, Pat Thoyts

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>
---
 lib/blame.tcl                |  2 +-
 lib/branch_checkout.tcl      |  2 +-
 lib/branch_create.tcl        |  2 +-
 lib/branch_delete.tcl        |  2 +-
 lib/branch_rename.tcl        |  2 +-
 lib/browser.tcl              |  4 ++--
 lib/database.tcl             |  2 +-
 lib/diff.tcl                 | 11 +++++------
 lib/error.tcl                |  4 ++--
 lib/merge.tcl                |  2 +-
 lib/remote_add.tcl           |  2 +-
 lib/remote_branch_delete.tcl |  2 +-
 lib/shortcut.tcl             |  6 +++---
 lib/tools_dlg.tcl            |  6 +++---
 lib/transport.tcl            |  2 +-
 15 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/lib/blame.tcl b/lib/blame.tcl
index b1d15f4..a1aeb8b 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -70,7 +70,7 @@ constructor new {i_commit i_path i_jump} {
 	set path   $i_path
 
 	make_toplevel top w
-	wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]]
+	wm title $top [mc "%s (%s): File Viewer" [appname] [reponame]]
 
 	set font_w [font measure font_diff "0"]
 
diff --git a/lib/branch_checkout.tcl b/lib/branch_checkout.tcl
index 2e459a8..d06037d 100644
--- a/lib/branch_checkout.tcl
+++ b/lib/branch_checkout.tcl
@@ -13,7 +13,7 @@ constructor dialog {} {
 	global use_ttk NS
 	make_dialog top w
 	wm withdraw $w
-	wm title $top [append "[appname] ([reponame]): " [mc "Checkout Branch"]]
+	wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
diff --git a/lib/branch_create.tcl b/lib/branch_create.tcl
index 4bb9077..ba367d5 100644
--- a/lib/branch_create.tcl
+++ b/lib/branch_create.tcl
@@ -20,7 +20,7 @@ constructor dialog {} {
 
 	make_dialog top w
 	wm withdraw $w
-	wm title $top [append "[appname] ([reponame]): " [mc "Create Branch"]]
+	wm title $top [mc "%s (%s): Create Branch" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
diff --git a/lib/branch_delete.tcl b/lib/branch_delete.tcl
index 9aef0c9..a505163 100644
--- a/lib/branch_delete.tcl
+++ b/lib/branch_delete.tcl
@@ -13,7 +13,7 @@ constructor dialog {} {
 
 	make_dialog top w
 	wm withdraw $w
-	wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch"]]
+	wm title $top [mc "%s (%s): Delete Branch" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
diff --git a/lib/branch_rename.tcl b/lib/branch_rename.tcl
index 6e510ec..3a2d79a 100644
--- a/lib/branch_rename.tcl
+++ b/lib/branch_rename.tcl
@@ -12,7 +12,7 @@ constructor dialog {} {
 
 	make_dialog top w
 	wm withdraw $w
-	wm title $top [append "[appname] ([reponame]): " [mc "Rename Branch"]]
+	wm title $top [mc "%s (%s): Rename Branch" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
diff --git a/lib/browser.tcl b/lib/browser.tcl
index 0328338..1580493 100644
--- a/lib/browser.tcl
+++ b/lib/browser.tcl
@@ -24,7 +24,7 @@ constructor new {commit {path {}}} {
 	global cursor_ptr M1B use_ttk NS
 	make_dialog top w
 	wm withdraw $top
-	wm title $top [append "[appname] ([reponame]): " [mc "File Browser"]]
+	wm title $top [mc "%s (%s): File Browser" [appname] [reponame]]
 
 	if {$path ne {}} {
 		if {[string index $path end] ne {/}} {
@@ -272,7 +272,7 @@ constructor dialog {} {
 	global use_ttk NS
 	make_dialog top w
 	wm withdraw $top
-	wm title $top [append "[appname] ([reponame]): " [mc "Browse Branch Files"]]
+	wm title $top [mc "%s (%s): Browse Branch Files" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 		wm transient $top .
diff --git a/lib/database.tcl b/lib/database.tcl
index 8bd4b8e..8578308 100644
--- a/lib/database.tcl
+++ b/lib/database.tcl
@@ -63,7 +63,7 @@ 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 [append "[appname] ([reponame]): " [mc "Database Statistics"]]
+	wm title $w [mc "%s (%s): Database Statistics" [appname] [reponame]]
 	wm deiconify $w
 	tkwait window $w
 }
diff --git a/lib/diff.tcl b/lib/diff.tcl
index 0d56986..1228ce2 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -220,10 +220,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]} {
@@ -608,7 +607,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
 	}
@@ -826,7 +825,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
diff --git a/lib/error.tcl b/lib/error.tcl
index 9b7d229..71dc860 100644
--- a/lib/error.tcl
+++ b/lib/error.tcl
@@ -17,7 +17,7 @@ proc error_popup {msg} {
 	set cmd [list tk_messageBox \
 		-icon error \
 		-type ok \
-		-title [append "$title: " [mc "error"]] \
+		-title [mc "%s: error" $title] \
 		-message $msg]
 	if {[winfo ismapped [_error_parent]]} {
 		lappend cmd -parent [_error_parent]
@@ -33,7 +33,7 @@ proc warn_popup {msg} {
 	set cmd [list tk_messageBox \
 		-icon warning \
 		-type ok \
-		-title [append "$title: " [mc "warning"]] \
+		-title [mc "%s: warning" $title] \
 		-message $msg]
 	if {[winfo ismapped [_error_parent]]} {
 		lappend cmd -parent [_error_parent]
diff --git a/lib/merge.tcl b/lib/merge.tcl
index 460d32f..b2de109 100644
--- a/lib/merge.tcl
+++ b/lib/merge.tcl
@@ -149,7 +149,7 @@ constructor dialog {} {
 	}
 
 	make_dialog top w
-	wm title $top [append "[appname] ([reponame]): " [mc "Merge"]]
+	wm title $top [mc "%s (%s): Merge" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
diff --git a/lib/remote_add.tcl b/lib/remote_add.tcl
index 50029d0..480a6b3 100644
--- a/lib/remote_add.tcl
+++ b/lib/remote_add.tcl
@@ -17,7 +17,7 @@ constructor dialog {} {
 
 	make_dialog top w
 	wm withdraw $top
-	wm title $top [append "[appname] ([reponame]): " [mc "Add Remote"]]
+	wm title $top [mc "%s (%s): Add Remote" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
diff --git a/lib/remote_branch_delete.tcl b/lib/remote_branch_delete.tcl
index fcc06d0..5ba9fca 100644
--- a/lib/remote_branch_delete.tcl
+++ b/lib/remote_branch_delete.tcl
@@ -26,7 +26,7 @@ constructor dialog {} {
 	global all_remotes M1B use_ttk NS
 
 	make_dialog top w
-	wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch Remotely"]]
+	wm title $top [mc "%s (%s): Delete Branch Remotely" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 	}
diff --git a/lib/shortcut.tcl b/lib/shortcut.tcl
index 78878ef..135086b 100644
--- a/lib/shortcut.tcl
+++ b/lib/shortcut.tcl
@@ -5,7 +5,7 @@ proc do_windows_shortcut {} {
 	global _gitworktree
 	set fn [tk_getSaveFile \
 		-parent . \
-		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
+		-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
 		-initialfile "Git [reponame].lnk"]
 	if {$fn != {}} {
 		if {[file extension $fn] ne {.lnk}} {
@@ -37,7 +37,7 @@ proc do_cygwin_shortcut {} {
 	}
 	set fn [tk_getSaveFile \
 		-parent . \
-		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
+		-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
 		-initialdir $desktop \
 		-initialfile "Git [reponame].lnk"]
 	if {$fn != {}} {
@@ -69,7 +69,7 @@ proc do_macosx_app {} {
 
 	set fn [tk_getSaveFile \
 		-parent . \
-		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
+		-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
 		-initialdir [file join $env(HOME) Desktop] \
 		-initialfile "Git [reponame].app"]
 	if {$fn != {}} {
diff --git a/lib/tools_dlg.tcl b/lib/tools_dlg.tcl
index 7eeda9d..c05413c 100644
--- a/lib/tools_dlg.tcl
+++ b/lib/tools_dlg.tcl
@@ -19,7 +19,7 @@ constructor dialog {} {
 	global repo_config use_ttk NS
 
 	make_dialog top w
-	wm title $top [append "[appname] ([reponame]): " [mc "Add Tool"]]
+	wm title $top [mc "%s (%s): Add Tool" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 		wm transient $top .
@@ -184,7 +184,7 @@ constructor dialog {} {
 	load_config 1
 
 	make_dialog top w
-	wm title $top [append "[appname] ([reponame]): " [mc "Remove Tool"]]
+	wm title $top [mc "%s (%s): Remove Tool" [appname] [reponame]]
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 		wm transient $top .
@@ -280,7 +280,7 @@ constructor dialog {fullname} {
 	}
 
 	make_dialog top w -autodelete 0
-	wm title $top [append "[appname] ([reponame]): " $title]
+	wm title $top "[mc "%s (%s):" [appname] [reponame]] $title"
 	if {$top ne {.}} {
 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
 		wm transient $top .
diff --git a/lib/transport.tcl b/lib/transport.tcl
index e5d211e..a1a424a 100644
--- a/lib/transport.tcl
+++ b/lib/transport.tcl
@@ -226,7 +226,7 @@ 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 [append "[appname] ([reponame]): " [mc "Push"]]
+	wm title $w [mc "%s (%s): Push" [appname] [reponame]]
 	wm deiconify $w
 	tkwait window $w
 }
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] git-gui i18n: mark string in lib/error.tcl for translation
  2016-05-08 10:52 [PATCH 1/5] git-gui i18n: mark strings for translation Vasco Almeida
                   ` (2 preceding siblings ...)
  2016-05-08 10:52 ` [PATCH 4/5] git-gui: fix incorrect use of Tcl append command Vasco Almeida
@ 2016-05-08 10:52 ` Vasco Almeida
  2016-10-03 10:30 ` [PATCH 1/5] git-gui i18n: mark strings " Pat Thoyts
  4 siblings, 0 replies; 8+ messages in thread
From: Vasco Almeida @ 2016-05-08 10:52 UTC (permalink / raw)
  To: git; +Cc: Vasco Almeida, Shawn O . Pearce, Pat Thoyts

Mark string "$hook hook failed:" in lib/error.tcl for translation.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 lib/error.tcl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/error.tcl b/lib/error.tcl
index 71dc860..8968a57 100644
--- a/lib/error.tcl
+++ b/lib/error.tcl
@@ -77,7 +77,7 @@ proc hook_failed_popup {hook msg {is_fatal 1}} {
 	wm withdraw $w
 
 	${NS}::frame $w.m
-	${NS}::label $w.m.l1 -text "$hook hook failed:" \
+	${NS}::label $w.m.l1 -text [mc "%s hook failed:" $hook] \
 		-anchor w \
 		-justify left \
 		-font font_uibold
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] git-gui: fix incorrect use of Tcl append command
  2016-05-08 10:52 ` [PATCH 4/5] git-gui: fix incorrect use of Tcl append command Vasco Almeida
@ 2016-10-03 10:23   ` Pat Thoyts
  0 siblings, 0 replies; 8+ messages in thread
From: Pat Thoyts @ 2016-10-03 10:23 UTC (permalink / raw)
  To: Vasco Almeida; +Cc: git, Shawn O . Pearce

Vasco Almeida <vascomalmeida@sapo.pt> writes:

>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>
>---
> lib/blame.tcl                |  2 +-
> lib/branch_checkout.tcl      |  2 +-
> lib/branch_create.tcl        |  2 +-
> lib/branch_delete.tcl        |  2 +-
> lib/branch_rename.tcl        |  2 +-
> lib/browser.tcl              |  4 ++--
> lib/database.tcl             |  2 +-
> lib/diff.tcl                 | 11 +++++------
> lib/error.tcl                |  4 ++--
> lib/merge.tcl                |  2 +-
> lib/remote_add.tcl           |  2 +-
> lib/remote_branch_delete.tcl |  2 +-
> lib/shortcut.tcl             |  6 +++---
> lib/tools_dlg.tcl            |  6 +++---
> lib/transport.tcl            |  2 +-
> 15 files changed, 25 insertions(+), 26 deletions(-)
>
>diff --git a/lib/blame.tcl b/lib/blame.tcl
>index b1d15f4..a1aeb8b 100644
>--- a/lib/blame.tcl
>+++ b/lib/blame.tcl
>@@ -70,7 +70,7 @@ constructor new {i_commit i_path i_jump} {
> 	set path   $i_path
> 
> 	make_toplevel top w
>-	wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]]
>+	wm title $top [mc "%s (%s): File Viewer" [appname] [reponame]]
> 
> 	set font_w [font measure font_diff "0"]
> 
>diff --git a/lib/branch_checkout.tcl b/lib/branch_checkout.tcl
>index 2e459a8..d06037d 100644
>--- a/lib/branch_checkout.tcl
>+++ b/lib/branch_checkout.tcl
>@@ -13,7 +13,7 @@ constructor dialog {} {
> 	global use_ttk NS
> 	make_dialog top w
> 	wm withdraw $w
>-	wm title $top [append "[appname] ([reponame]): " [mc "Checkout Branch"]]
>+	wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 	}
>diff --git a/lib/branch_create.tcl b/lib/branch_create.tcl
>index 4bb9077..ba367d5 100644
>--- a/lib/branch_create.tcl
>+++ b/lib/branch_create.tcl
>@@ -20,7 +20,7 @@ constructor dialog {} {
> 
> 	make_dialog top w
> 	wm withdraw $w
>-	wm title $top [append "[appname] ([reponame]): " [mc "Create Branch"]]
>+	wm title $top [mc "%s (%s): Create Branch" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 	}
>diff --git a/lib/branch_delete.tcl b/lib/branch_delete.tcl
>index 9aef0c9..a505163 100644
>--- a/lib/branch_delete.tcl
>+++ b/lib/branch_delete.tcl
>@@ -13,7 +13,7 @@ constructor dialog {} {
> 
> 	make_dialog top w
> 	wm withdraw $w
>-	wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch"]]
>+	wm title $top [mc "%s (%s): Delete Branch" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 	}
>diff --git a/lib/branch_rename.tcl b/lib/branch_rename.tcl
>index 6e510ec..3a2d79a 100644
>--- a/lib/branch_rename.tcl
>+++ b/lib/branch_rename.tcl
>@@ -12,7 +12,7 @@ constructor dialog {} {
> 
> 	make_dialog top w
> 	wm withdraw $w
>-	wm title $top [append "[appname] ([reponame]): " [mc "Rename Branch"]]
>+	wm title $top [mc "%s (%s): Rename Branch" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 	}
>diff --git a/lib/browser.tcl b/lib/browser.tcl
>index 0328338..1580493 100644
>--- a/lib/browser.tcl
>+++ b/lib/browser.tcl
>@@ -24,7 +24,7 @@ constructor new {commit {path {}}} {
> 	global cursor_ptr M1B use_ttk NS
> 	make_dialog top w
> 	wm withdraw $top
>-	wm title $top [append "[appname] ([reponame]): " [mc "File Browser"]]
>+	wm title $top [mc "%s (%s): File Browser" [appname] [reponame]]
> 
> 	if {$path ne {}} {
> 		if {[string index $path end] ne {/}} {
>@@ -272,7 +272,7 @@ constructor dialog {} {
> 	global use_ttk NS
> 	make_dialog top w
> 	wm withdraw $top
>-	wm title $top [append "[appname] ([reponame]): " [mc "Browse Branch Files"]]
>+	wm title $top [mc "%s (%s): Browse Branch Files" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 		wm transient $top .
>diff --git a/lib/database.tcl b/lib/database.tcl
>index 8bd4b8e..8578308 100644
>--- a/lib/database.tcl
>+++ b/lib/database.tcl
>@@ -63,7 +63,7 @@ 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 [append "[appname] ([reponame]): " [mc "Database Statistics"]]
>+	wm title $w [mc "%s (%s): Database Statistics" [appname] [reponame]]
> 	wm deiconify $w
> 	tkwait window $w
> }
>diff --git a/lib/diff.tcl b/lib/diff.tcl
>index 0d56986..1228ce2 100644
>--- a/lib/diff.tcl
>+++ b/lib/diff.tcl
>@@ -220,10 +220,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]} {
>@@ -608,7 +607,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
> 	}
>@@ -826,7 +825,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
>diff --git a/lib/error.tcl b/lib/error.tcl
>index 9b7d229..71dc860 100644
>--- a/lib/error.tcl
>+++ b/lib/error.tcl
>@@ -17,7 +17,7 @@ proc error_popup {msg} {
> 	set cmd [list tk_messageBox \
> 		-icon error \
> 		-type ok \
>-		-title [append "$title: " [mc "error"]] \
>+		-title [mc "%s: error" $title] \
> 		-message $msg]
> 	if {[winfo ismapped [_error_parent]]} {
> 		lappend cmd -parent [_error_parent]
>@@ -33,7 +33,7 @@ proc warn_popup {msg} {
> 	set cmd [list tk_messageBox \
> 		-icon warning \
> 		-type ok \
>-		-title [append "$title: " [mc "warning"]] \
>+		-title [mc "%s: warning" $title] \
> 		-message $msg]
> 	if {[winfo ismapped [_error_parent]]} {
> 		lappend cmd -parent [_error_parent]
>diff --git a/lib/merge.tcl b/lib/merge.tcl
>index 460d32f..b2de109 100644
>--- a/lib/merge.tcl
>+++ b/lib/merge.tcl
>@@ -149,7 +149,7 @@ constructor dialog {} {
> 	}
> 
> 	make_dialog top w
>-	wm title $top [append "[appname] ([reponame]): " [mc "Merge"]]
>+	wm title $top [mc "%s (%s): Merge" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 	}
>diff --git a/lib/remote_add.tcl b/lib/remote_add.tcl
>index 50029d0..480a6b3 100644
>--- a/lib/remote_add.tcl
>+++ b/lib/remote_add.tcl
>@@ -17,7 +17,7 @@ constructor dialog {} {
> 
> 	make_dialog top w
> 	wm withdraw $top
>-	wm title $top [append "[appname] ([reponame]): " [mc "Add Remote"]]
>+	wm title $top [mc "%s (%s): Add Remote" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 	}
>diff --git a/lib/remote_branch_delete.tcl b/lib/remote_branch_delete.tcl
>index fcc06d0..5ba9fca 100644
>--- a/lib/remote_branch_delete.tcl
>+++ b/lib/remote_branch_delete.tcl
>@@ -26,7 +26,7 @@ constructor dialog {} {
> 	global all_remotes M1B use_ttk NS
> 
> 	make_dialog top w
>-	wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch Remotely"]]
>+	wm title $top [mc "%s (%s): Delete Branch Remotely" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 	}
>diff --git a/lib/shortcut.tcl b/lib/shortcut.tcl
>index 78878ef..135086b 100644
>--- a/lib/shortcut.tcl
>+++ b/lib/shortcut.tcl
>@@ -5,7 +5,7 @@ proc do_windows_shortcut {} {
> 	global _gitworktree
> 	set fn [tk_getSaveFile \
> 		-parent . \
>-		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
>+		-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
> 		-initialfile "Git [reponame].lnk"]
> 	if {$fn != {}} {
> 		if {[file extension $fn] ne {.lnk}} {
>@@ -37,7 +37,7 @@ proc do_cygwin_shortcut {} {
> 	}
> 	set fn [tk_getSaveFile \
> 		-parent . \
>-		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
>+		-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
> 		-initialdir $desktop \
> 		-initialfile "Git [reponame].lnk"]
> 	if {$fn != {}} {
>@@ -69,7 +69,7 @@ proc do_macosx_app {} {
> 
> 	set fn [tk_getSaveFile \
> 		-parent . \
>-		-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
>+		-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
> 		-initialdir [file join $env(HOME) Desktop] \
> 		-initialfile "Git [reponame].app"]
> 	if {$fn != {}} {
>diff --git a/lib/tools_dlg.tcl b/lib/tools_dlg.tcl
>index 7eeda9d..c05413c 100644
>--- a/lib/tools_dlg.tcl
>+++ b/lib/tools_dlg.tcl
>@@ -19,7 +19,7 @@ constructor dialog {} {
> 	global repo_config use_ttk NS
> 
> 	make_dialog top w
>-	wm title $top [append "[appname] ([reponame]): " [mc "Add Tool"]]
>+	wm title $top [mc "%s (%s): Add Tool" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 		wm transient $top .
>@@ -184,7 +184,7 @@ constructor dialog {} {
> 	load_config 1
> 
> 	make_dialog top w
>-	wm title $top [append "[appname] ([reponame]): " [mc "Remove Tool"]]
>+	wm title $top [mc "%s (%s): Remove Tool" [appname] [reponame]]
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 		wm transient $top .
>@@ -280,7 +280,7 @@ constructor dialog {fullname} {
> 	}
> 
> 	make_dialog top w -autodelete 0
>-	wm title $top [append "[appname] ([reponame]): " $title]
>+	wm title $top "[mc "%s (%s):" [appname] [reponame]] $title"
> 	if {$top ne {.}} {
> 		wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
> 		wm transient $top .
>diff --git a/lib/transport.tcl b/lib/transport.tcl
>index e5d211e..a1a424a 100644
>--- a/lib/transport.tcl
>+++ b/lib/transport.tcl
>@@ -226,7 +226,7 @@ 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 [append "[appname] ([reponame]): " [mc "Push"]]
>+	wm title $w [mc "%s (%s): Push" [appname] [reponame]]
> 	wm deiconify $w
> 	tkwait window $w
> }

Well spotted!

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] git-gui i18n: mark strings for translation
  2016-05-08 10:52 [PATCH 1/5] git-gui i18n: mark strings for translation Vasco Almeida
                   ` (3 preceding siblings ...)
  2016-05-08 10:52 ` [PATCH 5/5] git-gui i18n: mark string in lib/error.tcl for translation Vasco Almeida
@ 2016-10-03 10:30 ` Pat Thoyts
  2016-10-03 12:57   ` Vasco Almeida
  4 siblings, 1 reply; 8+ messages in thread
From: Pat Thoyts @ 2016-10-03 10:30 UTC (permalink / raw)
  To: Vasco Almeida; +Cc: git, Shawn O . Pearce

Vasco Almeida <vascomalmeida@sapo.pt> writes:

>Mark strings for translation in lib/index.tcl that were seemingly
>left behind by 700e560 ("git-gui: Mark forgotten strings for
>translation.", 2008-09-04) which marks string in do_revert_selection
>procedure.
>These strings are passed to unstage_help and add_helper procedures.
>
>Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
>---
> lib/index.tcl | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/lib/index.tcl b/lib/index.tcl
>index 74a81a7..3a3e534 100644
>--- a/lib/index.tcl
>+++ b/lib/index.tcl
>@@ -291,7 +291,7 @@ proc do_unstage_selection {} {
> 
> 	if {[array size selected_paths] > 0} {
> 		unstage_helper \
>-			{Unstaging selected files from commit} \
>+			[mc "Unstaging selected files from commit"] \
> 			[array names selected_paths]
> 	} elseif {$current_diff_path ne {}} {
> 		unstage_helper \
>@@ -343,7 +343,7 @@ proc do_add_selection {} {
> 
> 	if {[array size selected_paths] > 0} {
> 		add_helper \
>-			{Adding selected files} \
>+			[mc "Adding selected files"] \
> 			[array names selected_paths]
> 	} elseif {$current_diff_path ne {}} {
> 		add_helper \
>@@ -385,7 +385,7 @@ proc do_add_all {} {
> 			set paths [concat $paths $untracked_paths]
> 		}
> 	}
>-	add_helper {Adding all changed files} $paths
>+	add_helper [mc "Adding all changed files"] $paths
> }
> 
> proc revert_helper {txt paths} {

This series looks good. Especially noticing the misuse of the append
command. Applied to my pu for now.
Thank you,

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] git-gui i18n: mark strings for translation
  2016-10-03 10:30 ` [PATCH 1/5] git-gui i18n: mark strings " Pat Thoyts
@ 2016-10-03 12:57   ` Vasco Almeida
  0 siblings, 0 replies; 8+ messages in thread
From: Vasco Almeida @ 2016-10-03 12:57 UTC (permalink / raw)
  To: patthoyts; +Cc: git, Shawn O . Pearce

A Seg, 03-10-2016 às 11:30 +0100, Pat Thoyts escreveu:
> Vasco Almeida <vascomalmeida@sapo.pt> writes:
> 
> > 
> > Mark strings for translation in lib/index.tcl that were seemingly
> > left behind by 700e560 ("git-gui: Mark forgotten strings for
> > translation.", 2008-09-04) which marks string in
> > do_revert_selection
> > procedure.
> > These strings are passed to unstage_help and add_helper procedures.
> > 
> > Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
> > ---
> > lib/index.tcl | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lib/index.tcl b/lib/index.tcl
> > index 74a81a7..3a3e534 100644
> > --- a/lib/index.tcl
> > +++ b/lib/index.tcl
> > @@ -291,7 +291,7 @@ proc do_unstage_selection {} {
> > 
> > 	if {[array size selected_paths] > 0} {
> > 		unstage_helper \
> > -			{Unstaging selected files from commit} \
> > +			[mc "Unstaging selected files from
> > commit"] \
> > 			[array names selected_paths]
> > 	} elseif {$current_diff_path ne {}} {
> > 		unstage_helper \
> > @@ -343,7 +343,7 @@ proc do_add_selection {} {
> > 
> > 	if {[array size selected_paths] > 0} {
> > 		add_helper \
> > -			{Adding selected files} \
> > +			[mc "Adding selected files"] \
> > 			[array names selected_paths]
> > 	} elseif {$current_diff_path ne {}} {
> > 		add_helper \
> > @@ -385,7 +385,7 @@ proc do_add_all {} {
> > 			set paths [concat $paths $untracked_paths]
> > 		}
> > 	}
> > -	add_helper {Adding all changed files} $paths
> > +	add_helper [mc "Adding all changed files"] $paths
> > }
> > 
> > proc revert_helper {txt paths} {
> 
> This series looks good. Especially noticing the misuse of the append
> command. Applied to my pu for now.
> Thank you,

I think Junio Hamano added PATCH 1/5 of this series to Git 'next'
branch and added the Portuguese translation of git-gui too.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-10-03 12:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-08 10:52 [PATCH 1/5] git-gui i18n: mark strings for translation Vasco Almeida
2016-05-08 10:52 ` [PATCH 2/5] git-gui i18n: internationalize use of colon punctuation Vasco Almeida
2016-05-08 10:52 ` [PATCH 3/5] git-gui i18n: mark "usage:" strings for translation Vasco Almeida
2016-05-08 10:52 ` [PATCH 4/5] git-gui: fix incorrect use of Tcl append command Vasco Almeida
2016-10-03 10:23   ` Pat Thoyts
2016-05-08 10:52 ` [PATCH 5/5] git-gui i18n: mark string in lib/error.tcl for translation Vasco Almeida
2016-10-03 10:30 ` [PATCH 1/5] git-gui i18n: mark strings " Pat Thoyts
2016-10-03 12:57   ` Vasco Almeida

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).