summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-08-29 20:18:45 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-08-29 20:18:45 +0000
commitf94e3e8a6c2d09b5ac51953be55f4365e60c3c20 (patch)
tree6bc7b736a7570ff93151e9b6d8f505932746a783 /perl-install
parent7ec360cace2c261f4555efcf4c75a505444c802c (diff)
downloaddrakx-f94e3e8a6c2d09b5ac51953be55f4365e60c3c20.tar
drakx-f94e3e8a6c2d09b5ac51953be55f4365e60c3c20.tar.gz
drakx-f94e3e8a6c2d09b5ac51953be55f4365e60c3c20.tar.bz2
drakx-f94e3e8a6c2d09b5ac51953be55f4365e60c3c20.tar.xz
drakx-f94e3e8a6c2d09b5ac51953be55f4365e60c3c20.zip
semi-automatic script allowing to update help.pm without creating a hell lot of "fuzzy" in po's
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/share/po/help_update_english_only.pl50
1 files changed, 50 insertions, 0 deletions
diff --git a/perl-install/share/po/help_update_english_only.pl b/perl-install/share/po/help_update_english_only.pl
new file mode 100755
index 000000000..4792e0ad5
--- /dev/null
+++ b/perl-install/share/po/help_update_english_only.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl -w
+
+use MDK::Common;
+
+my @prev = get("DrakX.pot.old");
+my @curr = get("DrakX.pot");
+
+@prev == @curr or die "the number of messages has changed: " . int(@prev) . " is now " . int(@curr);
+
+my %l = map_index { $_ => $prev[$::i] } @curr;
+
+while (my ($new, $old) = each %l) {
+ my ($s_old) = $old =~ /"(.*)\\n"/ or die "<$old>";
+ my ($s_new) = $new =~ /"(.*)\\n"/ or die "<$new>";
+ next if $s_old eq $s_new;
+
+ warn "mismatch\n in $s_old\n vs $s_new\n";
+}
+
+print STDERR "Is that ok (Y/n) ? ";
+<STDIN> !~ /n/i or exit;
+
+foreach my $po (glob_("*.po")) {
+ my $s = cat_($po);
+ while (my ($new, $old) = each %l) {
+ my $offset = index($s, $old);
+ if ($offset >= 0) {
+ # print STDERR "replacing $old with $new\n";
+ substr($s, $offset, length($old), $new);
+ }
+ }
+ output($po, $s);
+}
+
+
+sub get {
+ my ($file) = @_;
+ my @l;
+ foreach (cat_($file)) {
+ my $nb = /^#:.*help\.pm/ .. /msgstr ""/ or next;
+ if ($nb =~ /E0/) {
+ push @l, $s if $s;
+ $s = '';
+ } elsif (/^"/) {
+ $s .= $_;
+ }
+ }
+ @l;
+}
+