You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
633 B

  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. }