projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4f5638a
)
build: fixup header order in i18n-update.pl to minimize diffs to pootle
author
Jo-Philipp Wich
<jow@openwrt.org>
Sun, 1 Jul 2012 22:46:49 +0000
(22:46 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Sun, 1 Jul 2012 22:46:49 +0000
(22:46 +0000)
build/i18n-update.pl
patch
|
blob
|
history
diff --git
a/build/i18n-update.pl
b/build/i18n-update.pl
index
0dd213a
..
16b82e8
100755
(executable)
--- a/
build/i18n-update.pl
+++ b/
build/i18n-update.pl
@@
-5,6
+5,22
@@
my $source = shift @ARGV;
my $pattern = shift @ARGV || '*.po';
my $source = shift @ARGV;
my $pattern = shift @ARGV || '*.po';
+sub fixup_header_order
+{
+ my $file = shift || return;
+ local $/;
+
+ open P, "< $file" || die "open(): $!";
+ my $data = readline P;
+ close P;
+
+ $data =~ s/("Language-Team: .*?\\n"\n)(.+?)("Language: .*?\\n"\n)/$1$3$2/s;
+
+ open P, "> $file" || die "open(): $!";
+ print P $data;
+ close P;
+}
+
if( open F, "find $source -type f -name '$pattern' |" )
{
while( chomp( my $file = readline F ) )
if( open F, "find $source -type f -name '$pattern' |" )
{
while( chomp( my $file = readline F ) )
@@
-15,6
+31,7
@@
if( open F, "find $source -type f -name '$pattern' |" )
{
printf "Updating %-40s", $file;
system("msgmerge", "-U", "-N", $file, "$source/templates/$basename.pot");
{
printf "Updating %-40s", $file;
system("msgmerge", "-U", "-N", $file, "$source/templates/$basename.pot");
+ fixup_header_order($file);
}
}
}
}