[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.7-1027-g0687ed4

Shawn Moore sartak at bestpractical.com
Thu Dec 23 16:58:34 EST 2010


The branch, 3.9-trunk has been updated
       via  0687ed4f12c51b132a49af1f5083c075de86d489 (commit)
       via  97beda8391438defc5c557c3c88c7dbbded33ee5 (commit)
      from  904cb30afa1fdc0c24642ce52e8b0baa8bdd4929 (commit)

Summary of changes:
 devel/extract-message-catalog |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit 97beda8391438defc5c557c3c88c7dbbded33ee5
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 23 16:46:07 2010 -0500

    Warn about interpolated variables in loc strings

diff --git a/devel/extract-message-catalog b/devel/extract-message-catalog
index ded346a..3b6cc6e 100755
--- a/devel/extract-message-catalog
+++ b/devel/extract-message-catalog
@@ -99,17 +99,24 @@ foreach my $dict (@ARGV) {
     update($lang, $dict);
 }
 
-# warn about extra whitespace (at the very end so it'll be harder to miss)
+# warn about various red flags in loc strings
 foreach my $str ( sort keys %{$FILECAT} ) {
     my $entry = $FILECAT->{$str};
     my $entry_count = @$entry;
 
+    # doesn't exist in the current codebase, ignore for now
+    next if $entry_count == 0;
+
+    my ($filename, $line) = @{ $entry->[0] };
+
+    my $location = "$filename line $line" . ($entry_count > 1 ? " (and ".($entry_count-1)." other places)" : "");
+
     if ($str =~ /^\s/m || $str =~ /\s$/m || $str =~ /\\n$/m) {
-        # doesn't exist in the current codebase, ignore for now
-        next if $entry_count == 0;
+        warn "Extraneous whitespace in '$str' at $location\n";
+    }
 
-        my ($filename, $line) = @{ $entry->[0] };
-        warn "Extraneous whitespace in '$str' at $filename line $line" . ($entry_count > 1 ? " (and ".($entry_count-1)." other places)" : "") . "\n";
+    if ($str =~ /([\$\@]\w+)/) {
+        warn "Interpolated variable '$1' in '$str' at $location\n";
     }
 }
 

commit 0687ed4f12c51b132a49af1f5083c075de86d489
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 23 16:53:59 2010 -0500

    Now that we actually warn about msgids with $, don't drop them
    
        No wonder my test strings were vanishing :P

diff --git a/devel/extract-message-catalog b/devel/extract-message-catalog
index 3b6cc6e..9d9a34e 100755
--- a/devel/extract-message-catalog
+++ b/devel/extract-message-catalog
@@ -68,9 +68,6 @@ $FILECAT = {};
 # scan html dir for extensions
 File::Find::find( { wanted => \&extract_strings_from_code, follow => 1 }, qw(bin sbin lib share html etc) );
 
-# remove msgid with $ in it.  XXX: perhaps give some warnings here
-$FILECAT = { map { $_ => $FILECAT->{$_} } grep { !m/\$/ } keys %$FILECAT };
-
 # ensure proper escaping and [_1] => %1 transformation
 foreach my $str ( sort keys %{$FILECAT} ) {
     my $entry = $FILECAT->{$str};

-----------------------------------------------------------------------


More information about the Rt-commit mailing list