packages/net/privoxy-luci/build/i18n-po2lua.pl
Christian Schoenebeck 83e8a0e36c luci-app-privoxy: modified to support new LuCI structure
* Makefile
    - modified to support new LuCI build structure when building i18n support
    - increase "patch" version
* privoxy.lua detail.lua apperror.lua
    - modified version detection
    - removed function ipgk_version()
* new file build/i18n-po2lua.pl
    - copied from luci build system to create lmo language files

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-01-11 21:30:50 +01:00

27 lines
633 B
Perl
Executable file

#!/usr/bin/perl
@ARGV == 2 || die "Usage: $0 <source-dir> <dest-dir>\n";
my $source_dir = shift @ARGV;
my $target_dir = shift @ARGV;
if( ! -d $target_dir )
{
system('mkdir', '-p', $target_dir);
}
if( open F, "find $source_dir -type f -name '*.po' |" )
{
while( chomp( my $file = readline F ) )
{
my ( $lang, $basename ) = $file =~ m{.+/(\w+)/([^/]+)\.po$};
$lang = lc $lang;
$lang =~ s/_/-/g;
printf "Generating %-40s ", "$target_dir/$basename.$lang.lmo";
system("./build/po2lmo", $file, "$target_dir/$basename.$lang.lmo");
print ( -f "$target_dir/$basename.$lang.lmo" ? "done\n" : "empty\n" );
}
close F;
}