From 3ddff72e581e5c7477aaeb8b97a17691f7ff55bf Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 22 Jan 2008 10:40:13 -0500 Subject: git-gui: Work around random missing scrollbar in revision list If the horizontal scrollbar isn't currently visible (because it has not been needed) but we get an update to the scroll port we may find the scrollbar window exists but the Tcl command doesn't. Apparently it is possible for Tk to have partially destroyed the scrollbar by removing the Tcl procedure name but still leaving the widget name in the window registry. Signed-off-by: Shawn O. Pearce diff --git a/lib/choose_rev.tcl b/lib/choose_rev.tcl index a063c5b..c8821c1 100644 --- a/lib/choose_rev.tcl +++ b/lib/choose_rev.tcl @@ -451,7 +451,8 @@ method _sb_set {sb orient first last} { focus $old_focus } } - $sb set $first $last + + catch {$sb set $first $last} } method _show_tooltip {pos} { -- cgit v0.10.2-6-g49f6 From 3470adabad8c02be152a8d536d23df692eb386d6 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 22 Jan 2008 23:44:36 -0500 Subject: git-gui: Fallback to Tcl based po2msg.sh if msgfmt isn't available If msgfmt fails with exit code 127 that typically means the program is not found in the user's PATH and thus cannot be executed by make. In such a case we can try to fallback to the Tcl based po2msg program that we distributed with git-gui, as it does a "good enough" job. We still don't default to po2msg.sh however as it does not perform a lot of the sanity checks that msgfmt does, and quite a few of those are too useful to give up. Signed-off-by: Shawn O. Pearce diff --git a/Makefile b/Makefile index 1baf4b0..5f1023e 100644 --- a/Makefile +++ b/Makefile @@ -198,6 +198,9 @@ ifdef NO_MSGFMT MSGFMT ?= $(TCL_PATH) po/po2msg.sh else MSGFMT ?= msgfmt + ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127) + MSGFMT := $(TCL_PATH) po/po2msg.sh + endif endif msgsdir = $(gg_libdir)/msgs -- cgit v0.10.2-6-g49f6 From 2cd9ad2e71c57b283e8caf03de065bba1dff5f5f Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 22 Jan 2008 23:52:07 -0500 Subject: git-gui: Make the statistics of po2msg match those of msgfmt The strings we were showing from po2msg didn't exactly match those of msgfmt's --statistics output so we didn't show quite the same results when building git-gui's message files. Now we're closer to what msgfmt shows (at least for an en_US locale) so the make output matches. I noticed that the fuzzy translation count is off by one for the current po/zh_cn.po file. Not sure why and I'm not going to try and debug it at this time as the po2msg is strictly a fallback, users building from source really should prefer msgfmt. Signed-off-by: Shawn O. Pearce diff --git a/po/po2msg.sh b/po/po2msg.sh index c63248e..b7c4bf3 100644 --- a/po/po2msg.sh +++ b/po/po2msg.sh @@ -127,7 +127,26 @@ foreach file $files { } if {$show_statistics} { - puts [concat "$translated_count translated messages, " \ - "$fuzzy_count fuzzy ones, " \ - "$not_translated_count untranslated ones."] + set str "" + + append str "$translated_count translated message" + if {$translated_count != 1} { + append str s + } + + if {$fuzzy_count > 1} { + append str ", $fuzzy_count fuzzy translation" + if {$fuzzy_count != 1} { + append str s + } + } + if {$not_translated_count > 0} { + append str ", $not_translated_count untranslated message" + if {$not_translated_count != 1} { + append str s + } + } + + append str . + puts $str } -- cgit v0.10.2-6-g49f6 From 3b8f19a02c3dd6043a7a6bdd65de2d4610c26b81 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 22 Jan 2008 23:56:15 -0500 Subject: git-gui: Correctly cleanup msgfmt '1 message untranslated' output In the multiple message case we remove the word "messages" from the statistics output of msgfmt as it looks cleaner on the tty when you are watching the build process. However we failed to strip the word "message" when only 1 message was found to be untranslated or fuzzy, as msgfmt does not produce the 's' suffix. Signed-off-by: Shawn O. Pearce diff --git a/Makefile b/Makefile index 5f1023e..34438cd 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ ifndef V QUIET_GEN = $(QUIET)echo ' ' GEN '$@' && QUIET_INDEX = $(QUIET)echo ' ' INDEX $(dir $@) && QUIET_MSGFMT0 = $(QUIET)printf ' MSGFMT %12s ' $@ && v=` - QUIET_MSGFMT1 = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages//g' + QUIET_MSGFMT1 = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages*//g' QUIET_2DEVNULL = 2>/dev/null INSTALL_D0 = dir= -- cgit v0.10.2-6-g49f6