From 6eb152fcf89fac48d46d2f2f25eb72c79b1c4ca4 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 26 Jul 2011 14:34:34 +0200 Subject: [PATCH] a tooltips fix script --- fixtooltips.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 fixtooltips.pl diff --git a/fixtooltips.pl b/fixtooltips.pl new file mode 100644 index 000000000..e7af7b230 --- /dev/null +++ b/fixtooltips.pl @@ -0,0 +1,28 @@ +use strict; +use warnings; +use Locale::PO; + +sub quote($) +{ + my $s = shift; + $s = '"' . quotemeta($s) . '"'; + return $s; +} +sub unquote($) +{ + my $s = shift; + $s =~ s/^"//; + $s =~ s/"$//; + $s =~ s/\\(.)/$1/g; + return $s; +} +my $po = Locale::PO->load_file_ashash("menu.dat." . $ENV{L} . ".po"); +while(<>) +{ + /\\(.*?)\\(.*)/s or do { print; next; }; + my @s = split /\//, $1; + @s = map { $po->{quote($_)} ? unquote($po->{quote($_)}->msgstr()) : $_ } @s; + my $s = join "/", @s; + $_ = "\\$s\\$2"; + print "$_"; +} -- 2.39.2