#!/usr/bin/perl
# Extrae los ttulos para poder ser traducidos, ejecutarlo con algo as
# como 'find /usr/lib/menu/ -type f -exec cat \{\} \;|./extrae-titulos'

# (c) Javier Fernndez-Sanguino Pea
# Distribuido bajo la licencia GNU GPL

$package="";
$longtitle="";
$title="";
while (<STDIN>) {
	if (/package\((.*?)\)/) {
		if ( $package && $longtitle ) { 
			if ( $title ne "" && $title ne $package ) {
				print " $title \"$longtitle\"\n" ;
			} else {
				print " $package \"$longtitle\"\n" ;
			}
			$title = ""; $longtitle =""; $package = "";
		}
		$package = $1 ; $title ="" ; $longtitle ="";
	}
#Ojo! Aqui se puede confundir con longtitle, el \s puede que no funcione en todos los casos...
	$title = $1 if /\stitle\s*=\s*"?([\w-]+)"?/;
	$title = $1 if /^title\s*=\s*"?([\w-]+)"?/; 
# Para considerar ttulos largos
	$title = $1 if /\stitle\s*=\s*("[\w\s-]+")/;  
	$title = $1 if /^title\s*=\s*("[\w\s-]+")/;  
	$longtitle = $1 if /longtitle\s*=\s*"(.*?)"/;
}
exit 0 ;
