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