File: 081_Petal_I18NProcessor.t

package info (click to toggle)
libpetal-perl 2.20-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,148 kB
  • sloc: perl: 4,712; xml: 726; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 819 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
use warnings;
use strict;
use lib ('lib');
use Test::More 'no_plan';
use Petal::I18N;
use Petal;

eval "use Lingua::31337";
if ($@) {
   warn "Lingua::31337 not found - skipping";
   ok (1);
}
else
{
    eval "use Petal::TranslationService::h4x0r";
    die $@ if ($@);

    $Petal::TranslationService = Petal::TranslationService::h4x0r->new();
    my $xml = <<EOF;
  <html><body>

    <!-- this is a mad example of romanized japanese, which we
         are going to turn into h4x0rz r0m4n|z3d J4paN33z -->

    <div i18n:translate="">
      Konichiwa, <span i18n:name="name">Buruno</span>-san,
      Kyoo wa o-genki desu ka?
    </div>

  </body></html>
EOF

    $xml =~ s/\s*$//;
    
    my $res = Petal::I18N->process ($xml);
    ok ($res =~ /Buruno/);
    ok ($res !~ /Konichiwa/);
}


1;


__END__