summaryrefslogtreecommitdiffhomepage
path: root/build/i18n-merge-master.pl
blob: be0474da90df3cde39d68aff6920bce56be3d3f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env perl

if (open F, '-|', 'find', $ARGV[0] || '.', '-type', 'f', '-name', '*.po') {
	while (defined(my $path = readline F)) {
		chomp $path;

		(my $ref = $path) =~ s/\.po$/\.master.po/;

		printf 'Updating %s ', $path;
		my $returnCode = system("git show --format=\%B 'master:$path' > '$ref'");
		if ( $returnCode == 0 )
		{
			system('msgmerge', '-N', '-o', $path, $ref, $path);
			system('msgattrib', '--no-obsolete', '-o', $path, $path);
		} else {
			print "...failed due to git error.\n";
		}
		unlink($ref);
	}

	close F;
}