1
0

i18n-po2lua.pl 633 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/perl
  2. @ARGV == 2 || die "Usage: $0 <source-dir> <dest-dir>\n";
  3. my $source_dir = shift @ARGV;
  4. my $target_dir = shift @ARGV;
  5. if( ! -d $target_dir )
  6. {
  7. system('mkdir', '-p', $target_dir);
  8. }
  9. if( open F, "find $source_dir -type f -name '*.po' |" )
  10. {
  11. while( chomp( my $file = readline F ) )
  12. {
  13. my ( $lang, $basename ) = $file =~ m{.+/(\w+)/([^/]+)\.po$};
  14. $lang = lc $lang;
  15. $lang =~ s/_/-/g;
  16. printf "Generating %-40s ", "$target_dir/$basename.$lang.lmo";
  17. system("./build/po2lmo", $file, "$target_dir/$basename.$lang.lmo");
  18. print ( -f "$target_dir/$basename.$lang.lmo" ? "done\n" : "empty\n" );
  19. }
  20. close F;
  21. }