[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop: [402]
From:       gespinasse () users ! sourceforge ! net
Date:       2007-06-11 20:19:12
Message-ID: E1HxqM4-0002Sc-6g () sc8-pr-svn4 ! sourceforge ! net
[Download RAW message or body]

Revision: 402
          http://ipcop.svn.sourceforge.net/ipcop/?rev=402&view=rev
Author:   gespinasse
Date:     2007-06-11 13:19:11 -0700 (Mon, 11 Jun 2007)

Log Message:
-----------
Add instruction how to use it inside

Search too in src/scripts, config/cfgroot andconfig/rc.d for other translations

Match both $Lang::tr{} and $tr{}

Allow to match string with ( or )

Beautify output

Modified Paths:
--------------
    ipcop/trunk/tools/check_strings.pl

Modified: ipcop/trunk/tools/check_strings.pl
===================================================================
--- ipcop/trunk/tools/check_strings.pl	2007-06-11 05:42:23 UTC (rev 401)
+++ ipcop/trunk/tools/check_strings.pl	2007-06-11 20:19:11 UTC (rev 402)
@@ -31,12 +31,15 @@
 use File::Find;
 
 $basedir = cwd();
-require "${basedir}/langs/en/cgi-bin/en.pl";
 
-sub wanted {
-	if ( -f $File::Find::name && open(FILE, $File::Find::name)) {
+sub wanted
+{
+	if ( -f "$basedir/$File::Find::name" && open(FILE, "$basedir/$File::Find::name")) {
+		#print "$File::Find::name\n";
 		while (<FILE>) {
-			while ($_ =~ /\$Lang::tr{'([A-Za-z0-9,:_\s\/\.-]+)'}/g) {
+			# for each match in a line
+			# match both $Lang::tr and $tr
+			while ( $_ =~ /tr{'([\(\)A-Za-z0-9,:_\s\/\.-]+)'}/g ) {
 				$tr2{$1} = 'empty string';
 			}
 		}
@@ -45,18 +48,35 @@
 }
 
 ## Main
-find (\&wanted, $basedir );
+( my $prog = $0 ) =~ s!^.*/!!; #prog name without path
+if ( !-d "langs" ) {
+	die "Script should be started from IPCop Source base directory \
like:\n./tools/$prog\n"; +}
 
+# path where we look for
+my @array=("src/scripts", "html", "config/cfgroot", "config/rc.d");
+print "Search strings on @array\n";
+
+# pass an array of directories where we look
+find (\&wanted , @array );
+
+# use eval to avoid an error if not the right path
+eval { require "${basedir}/langs/en/cgi-bin/en.pl"; };
+
+print "\nThose translation strings appear unused\n (or may include a variable part \
like ls_)\n"; +my $st="                                       "; # to fill the line
 for my $key ( sort (keys %tr) ) {
 	my $value = $tr{$key};
 	if (! $tr2{$key}) {
-		print "WARNING: translation string unused: $key\n";
+		# align first part at 30 lenght and print translation
+		print substr("$key $st", 0, 30)."  ".substr("$value", 0, 45)."\n";
 	}
 }
 
+print "\n\nUntranslated string\n(XY_ from base.cgi example are normal)\n";
 for my $key ( sort(keys %tr2) ) {
 	my $value = $tr2{$key};
 	if (! $tr{$key}) {
-		print "WARNING: untranslated string: $key\n";
+		print "$key\n";
 	}
 }


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic