i18n-merge-master.pl 544 B

12345678910111213141516171819202122
  1. #!/usr/bin/env perl
  2. if (open F, '-|', 'find', $ARGV[0] || '.', '-type', 'f', '-name', '*.po') {
  3. while (defined(my $path = readline F)) {
  4. chomp $path;
  5. (my $ref = $path) =~ s/\.po$/\.master.po/;
  6. printf 'Updating %s ', $path;
  7. my $returnCode = system("git show --format=\%B 'master:$path' > '$ref'");
  8. if ( $returnCode == 0 )
  9. {
  10. system('msgmerge', '-N', '-o', $path, $ref, $path);
  11. system('msgattrib', '--no-obsolete', '-o', $path, $path);
  12. } else {
  13. print "...failed due to git error.\n";
  14. }
  15. unlink($ref);
  16. }
  17. close F;
  18. }