#!/usr/bin/env perl
# MiF. 2006. _L strings extractor.

our $modules;
BEGIN
{
	$modules = __FILE__;
	$modules =~ s/\/[^\/]*$//gos;
	eval "use lib qw($modules/..);";
}

use strict;
use lib qw(..);
use localization::localization;

my $file = $ENV{'LANG'};
$file ||= 'en';

local *F;
open(F,"<$file") or die(_L("Can't read file %#\n",$file));
undef $/;
my $content = <F>;
close(F);   

my %loc;

while ($content =~ /^\s*(["'])(.*?[^\\])\1\s*=\s*\1(.*?[^\\])\1\s*;\s*$/mog)
{   
 my ($str,$spl) = ($2,$1); 
 $loc{$str} = $spl;
}

foreach my $loc (keys %loc)
{
	print _L(localization::localization::locUnescape($loc));
}

