summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-05-19 17:21:07 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-05-19 17:21:07 +0000
commit1f3666f7225eb33d932a7ae067dbca05e57ad9ca (patch)
treee7731670991a7cf4a1da9b87a4a20861f63e353a
parent79b473f5d5cac0fd6ee711ae1faab2142b91616a (diff)
build: add i18n-update.pl to refresh *.po files from *.pot templates
-rwxr-xr-xbuild/i18n-update.pl22
1 files changed, 22 insertions, 0 deletions
diff --git a/build/i18n-update.pl b/build/i18n-update.pl
new file mode 100755
index 000000000..c41b039b7
--- /dev/null
+++ b/build/i18n-update.pl
@@ -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;
+}