[Tkabber-dev] r801 - trunk/tkabber/contrib/extract-translations

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Nov 24 00:51:39 MSK 2006


Author: sergei
Date: 2006-11-24 00:51:37 +0300 (Fri, 24 Nov 2006)
New Revision: 801

Modified:
   trunk/tkabber/contrib/extract-translations/extract.tcl
Log:
	* contrib/extract-translations/extract.tcl: Fixed bug with incorrect
	  prefix printing. Don't print strings with embedded variables.


Modified: trunk/tkabber/contrib/extract-translations/extract.tcl
===================================================================
--- trunk/tkabber/contrib/extract-translations/extract.tcl	2006-11-23 20:39:08 UTC (rev 800)
+++ trunk/tkabber/contrib/extract-translations/extract.tcl	2006-11-23 21:51:37 UTC (rev 801)
@@ -61,6 +61,9 @@
     regexp {([-a-z]+)\.msg$} $translationFile -> lang
 }
 
+proc key_with_var {key} {
+    catch [list eval list $key]
+}
 
 # Read all tcl file from sourceDir
 set tclFileList [::fileutil::findByPattern $sourceDir -glob -- *tcl]
@@ -77,7 +80,7 @@
         while {[regexp -- $msgcat_regexp1 $line1 whole key] || \
 		    [regexp -- $msgcat_regexp2 $line1 whole key] || \
 		    [regexp -- $msgcat_regexp3 $line1 whole key]} {
-	    if {$key != ""} {
+	    if {$key != "" && ![key_with_var $key]} {
 		if {![info exists mkeyHash($filename)]} {
 		    # Create a new list (with the current key) for this file
 		    set mkeyHash($filename) [list $key]
@@ -95,7 +98,7 @@
         while {[regexp -- $trans_regexp1 $line1 whole _lang key] || \
 		    [regexp -- $trans_regexp2 $line1 whole _lang key] || \
 		    [regexp -- $trans_regexp3 $line1 whole _lang key]} {
-	    if {$key != ""} {
+	    if {$key != "" && ![key_with_var $key]} {
 		if {![info exists tkeyHash($filename)]} {
 		    # Create a new list (with the current key) for this file
 		    set tkeyHash($filename) [list $key]
@@ -154,7 +157,7 @@
 	if {[llength $hash($f)] > 0} {
 	    puts "# $f"
 	    foreach k [lsort $hash($f)] {
-                puts "$prefix $lang \"$k\""
+		puts "$prefix $lang \"$k\""
 	    }
 	    puts ""
 	}
@@ -185,7 +188,7 @@
                         set displayFileName 0
                         puts "# $f"
                     }
-                    puts "::msgcat::mcset $lang \"$k\""
+		    puts "$prefix $lang \"$k\""
                 }
             }
             if {!$displayFileName} {



More information about the Tkabber-dev mailing list