[Rt-commit] rt branch, 4.2/placeholder-mismatch, updated. rt-4.0.0rc7-253-ga9c0032

Shawn Moore sartak at bestpractical.com
Fri May 20 12:41:28 EDT 2011


The branch, 4.2/placeholder-mismatch has been updated
       via  a9c0032f5fe8fbaef2e1a018f162ab878a3df5ff (commit)
      from  fcb0448f310b4986906b02eefa311100ee7f35a4 (commit)

Summary of changes:
 devel/extract-message-catalog |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit a9c0032f5fe8fbaef2e1a018f162ab878a3df5ff
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri May 20 12:41:14 2011 -0400

    Catch the case where expected=%1,%2 and got=%1,%3

diff --git a/devel/extract-message-catalog b/devel/extract-message-catalog
index a770779..5b07885 100755
--- a/devel/extract-message-catalog
+++ b/devel/extract-message-catalog
@@ -380,11 +380,15 @@ sub complain_about_placeholder_mismatch {
     my @expected_variables = uniq($msgid =~ /%\d+/g);
     my @got_variables = uniq($msgstr =~ /%\d+/g);
 
-    return 0 if @expected_variables == @got_variables;
-
-    warn "$lang string does not have the expected number of placeholders\n";
-    warn "expected " . scalar(@expected_variables) . " in msgid:  $msgid\n";
-    warn "     got " . scalar(@got_variables)      . " in msgstr: $msgstr\n\n";
+    # this catches the case where expected uses %1,%2 and got uses %1,%3
+    # unlike a simple @expected_variables == @got_variables
+    my $expected = join ", ", sort @expected_variables;
+    my $got      = join ", ", sort @got_variables;
+    return 0 if $expected eq $got;
+
+    warn "$lang string does not have the same placeholders\n";
+    warn "expected (" . $expected . ") in msgid: $msgid\n";
+    warn "     got (" . $got      . ") in msgstr: $msgstr\n\n";
 
     return 1;
 }

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


More information about the Rt-commit mailing list