summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Atallah <datallah@pidgin.im>2014-10-27 13:30:15 -0400
committerDaniel Atallah <datallah@pidgin.im>2014-10-27 13:30:15 -0400
commit80e872de6088b7d8cddbce5c0b107f2a03aeeab1 (patch)
tree3ddcd6baedadbc63a1219e5e462e8542fe730537
parent0d90875ddf1498e53b51359959394f9ae3537404 (diff)
downloadpidgin-80e872de6088b7d8cddbce5c0b107f2a03aeeab1.tar.gz
Make NSIS translation processing more robust - handle quotes within text
-rw-r--r--pidgin/win32/nsis/create_nsis_translations.pl24
1 files changed, 17 insertions, 7 deletions
diff --git a/pidgin/win32/nsis/create_nsis_translations.pl b/pidgin/win32/nsis/create_nsis_translations.pl
index 89450c520b..189883099c 100644
--- a/pidgin/win32/nsis/create_nsis_translations.pl
+++ b/pidgin/win32/nsis/create_nsis_translations.pl
@@ -175,19 +175,29 @@ my %result;
open (MYFILE, $translations);
while (<MYFILE>) {
chomp $_;
- if ($_ =~ /Encoding=UTF-8/)
+ if ($_ =~ /^Encoding=UTF-8/ || $_ =~ /^\s*$/ || $_ =~ /^\[Desktop Entry\]/ || $_ =~ /^#/)
{
- next;
+ next;
}
elsif ($_ =~ /^(\w+)=(.*)/)
{
- my $line = "!define $1 \"$2\"\n";
- $result{"en"}{"$1"} = $line;
+ my $key = $1;
+ my $lang = "en";
+ my $value = $2;
+ $value =~ s/["]/\$\\"/g;
+ $result{"$lang"}{"$key"} = "!define $key \"$value\"\n";
+ }
+ elsif ($_ =~ /^(\w+)\[([\w@]+)\]=(.*)/)
+ {
+ my $key = $1;
+ my $lang = $2;
+ my $value = $3;
+ $value =~ s/["]/\$\\"/g;
+ $result{"$lang"}{"$key"} = "!define $key \"$value\"\n";
}
- elsif ($_ =~ /^(\w+)\[(\w+)\]=(.*)/)
+ else
{
- my $line = "!define $1 \"$3\"\n";
- $result{"$2"}{"$1"} = $line;
+ print "Found unrecognized line: '$_'\n";
}
}
close (MYFILE);