#!/usr/bin/env perl # # xgettext doesn't deal with TT files, but xgettext.pl doesn't find nget()s, sigh. # This will find the nget()s and output a .po file excerpt. use File::Find qw/find/; my %out; find( sub { next unless -f; next if $File::Find::name =~ /ttc$/; open (FP, $_) or die $!; while () { next unless /nget/; my $line = $.; my $text = $_; while ($text !~ /\)/) { $text .= ; } if ($text =~ /nget\(\s*(['"])(.*?)\1\s*,\s*(['"])(.*?)\3\s*,\s*(.*?)\s*\)/s) { $out{$2} = { file => $File::Find::name, line => $line, s => $2, p => $4, }; } } close FP; }, 'templates/email', 'templates/web/base', 'templates/web/zurich', 'perllib'); foreach (sort { $a->{s} cmp $b->{s} } values %out) { print <{file}:$_->{line} #, perl-format msgid "$_->{s}" msgid_plural "$_->{p}" msgstr[0] "" msgstr[1] "" EOF }