summaryrefslogtreecommitdiffhomepage
path: root/build/i18n-po2lua.pl
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-01-18 20:51:24 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-01-18 20:51:24 +0000
commit9714667b2a9629116f279b2d6d5cd7a4e45d3815 (patch)
treebd444f8360b9e83399ebe909c49da6178d8363cc /build/i18n-po2lua.pl
parentc78c91b9a97aaa1a7e2f10e90faf05b0e3017b38 (diff)
build: readd both po2lua and lua2po helper scripts...
Diffstat (limited to 'build/i18n-po2lua.pl')
-rwxr-xr-xbuild/i18n-po2lua.pl27
1 files changed, 27 insertions, 0 deletions
diff --git a/build/i18n-po2lua.pl b/build/i18n-po2lua.pl
new file mode 100755
index 000000000..5129055ff
--- /dev/null
+++ b/build/i18n-po2lua.pl
@@ -0,0 +1,27 @@
+#!/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;
+}