* [PATCH v2] gitk: Remove mc parameter from proc show_error
@ 2015-04-06 5:06 Alex Henrie
0 siblings, 0 replies; 4+ messages in thread
From: Alex Henrie @ 2015-04-06 5:06 UTC (permalink / raw)
To: paulus, bernt, git; +Cc: Alex Henrie
This is a better fix for 8d849957d81fc0480a52570d66cc3c2a688ecb1b.
All that was required to fix the original issue was to remove the extra
mc call, i.e. change [mc "Sorry, gitk cannot run..."] to simply
"Sorry, gitk cannot run..." Changing the signature of proc show_error
was unnecessary and introduced two new bugs: It made "OK" untranslatable
and "mc" translatable when the opposite should be true.
This new fix makes the string "OK" translatable and the string "mc" not
translatable, while leaving the string "Sorry, gitk cannot run..." not
translatable. It will take effect the next time `make update-po` is run.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
gitk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gitk b/gitk
index 30fcd30..096389f 100755
--- a/gitk
+++ b/gitk
@@ -1894,13 +1894,13 @@ proc make_transient {window origin} {
}
}
-proc show_error {w top msg {mc mc}} {
+proc show_error {w top msg} {
global NS
if {![info exists NS]} {set NS ""}
if {[wm state $top] eq "withdrawn"} { wm deiconify $top }
message $w.m -text $msg -justify center -aspect 400
pack $w.m -side top -fill x -padx 20 -pady 20
- ${NS}::button $w.ok -default active -text [$mc OK] -command "destroy $top"
+ ${NS}::button $w.ok -default active -text [mc OK] -command "destroy $top"
pack $w.ok -side bottom -fill x
bind $top <Visibility> "grab $top; focus $top"
bind $top <Key-Return> "destroy $top"
@@ -12011,7 +12011,7 @@ proc get_path_encoding {path} {
# First check that Tcl/Tk is recent enough
if {[catch {package require Tk 8.4} err]} {
show_error {} . "Sorry, gitk cannot run with this version of Tcl/Tk.\n\
- Gitk requires at least Tcl/Tk 8.4." list
+ Gitk requires at least Tcl/Tk 8.4."
exit 1
}
--
2.3.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] gitk: Remove mc parameter from proc show_error
@ 2015-05-11 19:26 Alex Henrie
2015-05-17 0:52 ` Paul Mackerras
0 siblings, 1 reply; 4+ messages in thread
From: Alex Henrie @ 2015-05-11 19:26 UTC (permalink / raw)
To: paulus, bernt, git; +Cc: Alex Henrie
This is a better fix for 8d849957d81fc0480a52570d66cc3c2a688ecb1b.
This new fix makes the strings "Sorry, gitk cannot run..." and "OK"
translatable and the string "mc" not translatable. It will take effect
the next time `make update-po` is run.
msgcat is now imported before the Tcl/Tk version check so that the mc
function is available even if the version check fails. This should not
be a problem because msgcat and ::msgcat::mc were officially added in
Tcl 8.1 (released April 29, 1999) and we are not trying to support
versions of Tcl older than that.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
gitk | 46 +++++++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/gitk b/gitk
index c186704..78baeb5 100755
--- a/gitk
+++ b/gitk
@@ -1894,13 +1894,13 @@ proc make_transient {window origin} {
}
}
-proc show_error {w top msg {mc mc}} {
+proc show_error {w top msg} {
global NS
if {![info exists NS]} {set NS ""}
if {[wm state $top] eq "withdrawn"} { wm deiconify $top }
message $w.m -text $msg -justify center -aspect 400
pack $w.m -side top -fill x -padx 20 -pady 20
- ${NS}::button $w.ok -default active -text [$mc OK] -command "destroy $top"
+ ${NS}::button $w.ok -default active -text [mc OK] -command "destroy $top"
pack $w.ok -side bottom -fill x
bind $top <Visibility> "grab $top; focus $top"
bind $top <Key-Return> "destroy $top"
@@ -12016,10 +12016,29 @@ proc get_path_encoding {path} {
return $tcl_enc
}
+## For msgcat loading, first locate the installation location.
+if { [info exists ::env(GITK_MSGSDIR)] } {
+ ## Msgsdir was manually set in the environment.
+ set gitk_msgsdir $::env(GITK_MSGSDIR)
+} else {
+ ## Let's guess the prefix from argv0.
+ set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]
+ set gitk_libdir [file join $gitk_prefix share gitk lib]
+ set gitk_msgsdir [file join $gitk_libdir msgs]
+ unset gitk_prefix
+}
+
+## Internationalization (i18n) through msgcat and gettext. See
+## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
+package require msgcat
+namespace import ::msgcat::mc
+## And eventually load the actual message catalog
+::msgcat::mcload $gitk_msgsdir
+
# First check that Tcl/Tk is recent enough
if {[catch {package require Tk 8.4} err]} {
- show_error {} . "Sorry, gitk cannot run with this version of Tcl/Tk.\n\
- Gitk requires at least Tcl/Tk 8.4." list
+ show_error {} . [mc "Sorry, gitk cannot run with this version of Tcl/Tk.\n\
+ Gitk requires at least Tcl/Tk 8.4."]
exit 1
}
@@ -12169,25 +12188,6 @@ if {[tk windowingsystem] eq "aqua"} {
set ctxbut <Button-3>
}
-## For msgcat loading, first locate the installation location.
-if { [info exists ::env(GITK_MSGSDIR)] } {
- ## Msgsdir was manually set in the environment.
- set gitk_msgsdir $::env(GITK_MSGSDIR)
-} else {
- ## Let's guess the prefix from argv0.
- set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]
- set gitk_libdir [file join $gitk_prefix share gitk lib]
- set gitk_msgsdir [file join $gitk_libdir msgs]
- unset gitk_prefix
-}
-
-## Internationalization (i18n) through msgcat and gettext. See
-## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
-package require msgcat
-namespace import ::msgcat::mc
-## And eventually load the actual message catalog
-::msgcat::mcload $gitk_msgsdir
-
catch {
# follow the XDG base directory specification by default. See
# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
--
2.4.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] gitk: Remove mc parameter from proc show_error
2015-05-11 19:26 Alex Henrie
@ 2015-05-17 0:52 ` Paul Mackerras
2015-05-17 4:30 ` Alex Henrie
0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2015-05-17 0:52 UTC (permalink / raw)
To: Alex Henrie; +Cc: bernt, git
On Mon, May 11, 2015 at 01:26:41PM -0600, Alex Henrie wrote:
> This is a better fix for 8d849957d81fc0480a52570d66cc3c2a688ecb1b.
>
> This new fix makes the strings "Sorry, gitk cannot run..." and "OK"
> translatable and the string "mc" not translatable. It will take effect
> the next time `make update-po` is run.
>
> msgcat is now imported before the Tcl/Tk version check so that the mc
> function is available even if the version check fails. This should not
> be a problem because msgcat and ::msgcat::mc were officially added in
> Tcl 8.1 (released April 29, 1999) and we are not trying to support
> versions of Tcl older than that.
>
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Thanks, applied.
Paul.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-17 4:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-06 5:06 [PATCH v2] gitk: Remove mc parameter from proc show_error Alex Henrie
-- strict thread matches above, loose matches on Subject: below --
2015-05-11 19:26 Alex Henrie
2015-05-17 0:52 ` Paul Mackerras
2015-05-17 4:30 ` Alex Henrie
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).