diff options
author | Daniel Atallah <datallah@pidgin.im> | 2014-10-27 13:30:15 -0400 |
---|---|---|
committer | Daniel Atallah <datallah@pidgin.im> | 2014-10-27 13:30:15 -0400 |
commit | 80e872de6088b7d8cddbce5c0b107f2a03aeeab1 (patch) | |
tree | 3ddcd6baedadbc63a1219e5e462e8542fe730537 | |
parent | 0d90875ddf1498e53b51359959394f9ae3537404 (diff) | |
download | pidgin-80e872de6088b7d8cddbce5c0b107f2a03aeeab1.tar.gz |
Make NSIS translation processing more robust - handle quotes within text
-rw-r--r-- | pidgin/win32/nsis/create_nsis_translations.pl | 24 |
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); |