Randomize certificate serials to prevent chosen prefix hash collision
[openxpki.git] / trunk / i18n / build-pot.pl
blobef27922da16b37e9e59f2a0620ef20e20c15b4d4
1 #!/usr/bin/env perl
3 use strict;
4 use warnings;
5 use File::Find;
7 my $prefix = 'I18N_OPENXPKI_';
9 my @MANIFEST;
11 my %tags = ();
12 my $basedir = '';
14 foreach my $dir (@ARGV) {
15 $basedir = $dir;
16 @MANIFEST = ();
17 if (-e "$dir/MANIFEST") {
18 open my $MAN, '<', "$dir/MANIFEST";
19 @MANIFEST = <$MAN>;
20 close $MAN;
21 foreach my $man (@MANIFEST) {
22 chomp $man;
25 find(\&extract_tags, $dir);
28 sub extract_tags {
29 my $filename = $_;
30 my $rel_name = $File::Find::name;
31 my $dir_name = $File::Find::topdir;
32 $rel_name =~ s/$basedir\///;
33 if ($File::Find::name !~ m{ \.svn }xms) {
34 if (scalar @MANIFEST > 0 && ! grep {$_ eq $rel_name} @MANIFEST) {
35 # if we have a MANIFEST file, the file needs to be in it
36 # to be searched for tags
37 return;
39 open my $FILE, '<', $filename;
40 while (my $line = <$FILE>) {
41 while ($line =~ s{ (I18N_OPENXPKI_[A-Z0-9\_]+) }{}xms) {
42 $tags{$1} = 1;
45 close $FILE;
49 print <<'XEOF';
51 # SOME DESCRIPTIVE TITLE.
52 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
53 # This file is distributed under the same license as the PACKAGE package.
54 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
57 msgid ""
58 msgstr ""
59 "Project-Id-Version: PACKAGE VERSION\n"
60 "Report-Msgid-Bugs-To: \n"
61 "POT-Creation-Date: 2004-09-08 14:02+0200\n"
62 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
63 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
64 "Language-Team: LANGUAGE <LL@li.org>\n"
65 "MIME-Version: 1.0\n"
66 "Content-Type: text/plain; charset=UTF-8\n"
67 "Content-Transfer-Encoding: 8bit\n"
69 XEOF
71 foreach my $tag (sort keys %tags) {
72 print qq{msgid "$tag"\n} . qq{msgstr ""\n};