build: add script to merge master translation into branches
[oweals/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                 system("git show --format=\%B 'master:$path' > '$ref'");
11                 system('msgmerge', '-N', '-o', $path, $ref, $path);
12                 system('msgattrib', '--no-obsolete', '-o', $path, $path);
13                 unlink($ref);
14         }
15
16         close F;
17 }