6 # check commandline arguments
7 die "Usage: $0 <LINGUAS file> < nsi-template > nsi-output\n"
10 # process LINGUAS file
11 open(my $fh, "<", $ARGV[0])
12 or die "$0: can't open LINGUAS file '$ARGV[0]': $!\n";
13 my %languages = map { ($_, 1) } map { chomp; s/^\s+//; s/\s+$//; $_ } <$fh>;
15 or die "$0: error while reading LINGUAS file '$ARGV[0]': $!\n";
16 print STDERR
"Found ", scalar(keys %languages), " language(s): ",
17 join(" ", sort keys %languages), "\n";
19 # read .nsi template from STDIN
20 # write .nsi file to STDOUT
22 if (/^;;; INSTALL_FILES_LOCALE/) {
24 ("SetOutPath \"\$INSTDIR\\locale\\$_\\LC_MESSAGES\"\n",
25 "File \"\${MINGW_DATADIR}\\locale\\$_\\LC_MESSAGES\\pidgin-sipe.mo\"\n")
26 } sort keys %languages);
27 } elsif (/^;;; DELETE_FILES_LOCALE/) {
29 "Delete \"\$INSTDIR\\locale\\$_\\LC_MESSAGES\\pidgin-sipe.mo\"\n"
30 } sort keys %languages);