build: add i18n-update.pl to refresh *.po files from *.pot templates
This commit is contained in:
parent
79b473f5d5
commit
1f3666f722
1 changed files with 22 additions and 0 deletions
22
build/i18n-update.pl
Executable file
22
build/i18n-update.pl
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
@ARGV >= 1 || die "Usage: $0 <po directory> [<file pattern>]\n";
|
||||
|
||||
my $source = shift @ARGV;
|
||||
my $pattern = shift @ARGV || '*.po';
|
||||
|
||||
if( open F, "find $source -type f -name '$pattern' |" )
|
||||
{
|
||||
while( chomp( my $file = readline F ) )
|
||||
{
|
||||
my ( $basename ) = $file =~ m{.+/([^/]+)\.po$};
|
||||
|
||||
if( -f "$source/templates/$basename.pot" )
|
||||
{
|
||||
printf "Updating %-40s", $file;
|
||||
system("msgmerge", "-U", $file, "$source/templates/$basename.pot");
|
||||
}
|
||||
}
|
||||
|
||||
close F;
|
||||
}
|
Loading…
Reference in a new issue