#!/usr/bin/perl # Little scrip to read the /usr/lib/menu/* files, and write a # menu-menssages.pot file for them. This file then should contain # all possible translations, and can be used by translators.' # # # Should be changed to # - accept the compat-2 mode # - extract /usr/lib/menu/* files from .deb files. Then I'll run it on master. open(POT, ">menu-messages.pot"); while (){ my $file=$_; open(ME,$_); while(){ my $line; $line=$_; chomp($line); while($line =~ /\\\s*$/){ $line =~ s/\\\s*$//; $line .= ; chomp($line); } $line =~ s/^[^:]*://; $line =~ m/title\s*=\s*"(.*?[^\\])"/ || $line =~ m/title\s*=\s*([^\s]*)/; $title=$1; $line =~ m/genericname\s*=\s*"(.*?[^\\])"/ || $line =~ m/genericname\s*=\s*([^\s]*)/; $genericname=$1; $line =~ m/longtitle\s*=\s*"(.*?[^\\])"/ || $line =~ m/longtitle\s*=\s*([^\s]*)/; $longtitle=$1; $line =~ m/section\s*=\s*"(.*?[^\\])"/ || $line =~ m/section\s*=\s*([^\s]*)/; $section=$1; #print "T=$title S=$section LL " . $line . "\n"; $items{$title}=$file; $items{$genericname}=$file; $items{$longtitle}=$file; while( $section =~ s%/?([^/]+)/?%% ){ $items{$1}=$file; } } close(ME); } print POT "# Collection of titles/sections of debian menu's. # This file is automatically generated. Do not edit. # It's generated from the /usr/lib/menu/* files. # #, fuzzy msgid \"\" msgstr \"\" \"Project-Id-Version: PACKAGE VERSION\\n\" \"POT-Creation-Date: 1999-12-05 18:51+0100\\n\" \"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\" \"Last-Translator: FULL NAME \\n\" \"MIME-Version: 1.0\\n\" \"Content-Type: text/plain; charset=CHARSET\\n\" \"Content-Transfer-Encoding: ENCODING\\n\" "; for my $s (sort keys %items){ print POT "#: Found in " . $items{$s} . "\n"; print POT "msgid \"" . $s . "\"\n"; print POT "msgstr \"\"\n\n"; }