Subject: | concat in loc() works now and TT can now use [% FILTER loc %] |
now it is possible to concat strings in loc() and in TT you can use [%
FILTER loc %]
Subject: | tests-for-new-patch-for-concat-and-tt-FILTER.patch |
--- Locale-Maketext-Lexicon-0.68/t/5-extract.t.orig 2008-09-07 02:13:04.000000000 +0200
+++ Locale-Maketext-Lexicon-0.68/t/5-extract.t 2008-09-07 03:23:01.000000000 +0200
@@ -1,7 +1,7 @@
#! /usr/bin/perl -w
use lib '../lib';
use strict;
-use Test::More tests => 43;
+use Test::More tests => 47;
use_ok('Locale::Maketext::Extract');
my $Ext = Locale::Maketext::Extract->new;
@@ -61,6 +61,12 @@
extract_ok(q(_("","car")) => '', 'ignore empty string');
extract_ok(q(_("0")) => '', 'ignore zero');
+extract_ok(<<'__EXAMPLE__' => 'foo bar baz', 'use FILTER (tt)');
+[% FILTER l -%]
+foo bar baz
+[%- END %]
+__EXAMPLE__
+
extract_ok(<<'__EXAMPLE__' => 'foo bar baz', 'trim the string (tt)');
[% |loc -%]
foo bar baz
@@ -173,6 +179,50 @@
msgstr ""
__EXPECTED__
+write_po_ok(<<'__EXAMPLE__' => <<'__EXPECTED__', "concat (heredoc)");
+_('exam'.<<"", 10)
+ple1 %1
+
+__EXAMPLE__
+#: :1
+#. (10)
+msgid "example1 %1\n"
+msgstr ""
+__EXPECTED__
+
+write_po_ok(<<'__EXAMPLE__' => <<'__EXPECTED__', "two _() calls with concat over multiline (heredoc)");
+_('example' .
+<<"", 10)
+1 %1
+
+_(<<"", 5)
+example2 %1
+
+__EXAMPLE__
+#: :1
+#. (10)
+msgid "example1 %1\n"
+msgstr ""
+
+#: :5
+#. (5)
+msgid "example2 %1\n"
+msgstr ""
+__EXPECTED__
+
+write_po_ok(<<'__EXAMPLE__' => <<'__EXPECTED__', "i can concat the world!");
+_(
+'\$foo'
+."\$bar"
+.<<''
+\$baz
+
+)
+__EXAMPLE__
+#: :2
+msgid "\\$foo$bar\\$baz\n"
+msgstr ""
+__EXPECTED__
sub extract_ok {
my ($text, $expected, $info, $verbatim) = @_;