Make HiDPI scaling work for wxGTK
[survex.git] / lib / launchpad-merge-po
blobe40ccea470e0de2d2c8805775cae2920c2599062
1 #!/usr/bin/perl -w
2 use strict;
4 open O, '<', $ARGV[0] or die $!;
5 if ($ARGV[1] eq '-') {
6 *N = *STDIN;
7 } else {
8 open N, '<', $ARGV[1] or die $!;
11 my $fuzzy = 0;
12 my $diff = 0;
13 my ($o, $n);
14 while (1) {
15 $o //= <O>;
16 $n //= <N>;
17 defined $o and $o =~ s/[ \t]+$//;
18 defined $n and $n =~ s/[ \t]+$//;
19 if (!defined $n) {
20 last unless defined $o;
21 print '-' if $diff;
22 print $o;
23 $o = undef;
24 next;
26 if (!defined $o) {
27 print '+' if $diff;
28 print $n;
29 $n = undef;
30 next;
33 if ($o eq "\n" || $n eq "\n") {
34 $fuzzy = 0;
37 if ($o eq $n) {
38 print ' ' if $diff;
39 print $n;
40 $n = $o = undef;
41 next;
44 if (substr($o, 0, 3) eq '#~ ' && substr($n, 0, 3) ne '#~ ') {
45 print ' ' if $diff;
46 print "#~ $n";
47 $n = $o = undef;
48 next;
51 if ($o =~ /^("PO(?:-Revision|T-Creation)-Date: \d+-\d+-\d+ \d+:\d+):\d\d (.*\n)$/ &&
52 $n eq "$1:00 $2") {
53 print ' ' if $diff;
54 print $o;
55 $n = $o = undef;
56 next;
59 if ($o =~ /^"PO-Revision-Date:/ && $n =~ /^"PO-Revision-Date:/) {
60 print ' ' if $diff;
61 print $o;
62 $n = $o = undef;
63 next;
66 if ($o =~ /(^"Last-Translator: .*<).*?(>.*\n)/ && $n eq "$1Unknown$2") {
67 print ' ' if $diff;
68 print $o;
69 $n = $o = undef;
70 next;
73 if ($o eq "\n") {
74 print '+' if $diff;
75 print $n;
76 $n = undef;
77 next;
80 if ($n eq "\n") {
81 print '-$o' if $diff;
82 $o = undef;
83 next;
86 if ($o eq "#, fuzzy\n") {
87 print ' ' if $diff;
88 print $o;
89 $o = undef;
90 $fuzzy = 1;
91 next;
94 my $tmp = $o;
95 if ($tmp =~ s/, fuzzy// && $n eq $tmp) {
96 print ' ' if $diff;
97 print $o;
98 $n = $o = undef;
99 $fuzzy = 1;
100 next;
103 if ($fuzzy && $o =~ /^(?:#~ )?msgstr / && $n eq "msgstr \"\"\n") {
104 print ' ' if $diff;
105 print $o;
106 $n = $o = undef;
107 $fuzzy = 0;
108 next;
111 print "-$o" if $diff;
112 print '+' if $diff;
113 print $n;
114 $n = $o = undef;