mirror of
https://github.com/openwrt/luci
synced 2025-01-07 03:27:12 +08:00
da7c3d9202
Refine the code to ignore apps that have been deleted from master
but still exist in release branches. E.g. luci-app-samba
Previously the unhandled git error from non-existing master
mangled the .po files in the release branch: the 18n header was
removed and all non-ASCII chars were deleted from translation.
Fix this by processing only those files where 'git show' succeeds.
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
(cherry picked from commit e4baee8d25
in openwrt-19.07)
23 lines
544 B
Perl
Executable File
23 lines
544 B
Perl
Executable File
#!/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;
|
|
}
|