diff --git a/checkin_notes b/checkin_notes index 9bffddc900..e1cc900570 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6094,3 +6094,10 @@ David 3 Aug 2008 client/ file_xfer.C http_curl.C,h + +Rytis 4 Aug 2008 + - developer tools: a script to build en.po from PHP files to ease + translation. Usage: build_po.pl [PROJECT_PATH] + + tools/ + build_po.pl diff --git a/tools/build_po.pl b/tools/build_po.pl new file mode 100755 index 0000000000..11f99b7fb4 --- /dev/null +++ b/tools/build_po.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my $path = $ARGV[0]; +if ($path eq "") { + die "Usage: build_po.pl [PROJECT_PATH]"; +} +system("xgettext --omit-header --directory=".$path."/html/inc -o en.po --keyword=tra -L PHP --no-location ".$path."/html/inc/*"); +system("xgettext --omit-header --directory=".$path."/html/user -j -o en.po --keyword=tra -L PHP --no-location ".$path."/html/user/*"); +system("xgettext --omit-header --directory=".$path."/html/project -j -o en.po --keyword=tra -L PHP --no-location ".$path."/html/project/*"); + +my @timedata = localtime(time); +my $header = ""; +$header .= "# Language: English (International)\n"; +$header .= "# FileID : \$Id\$\n"; +$header .= "msgid \"\"\n"; +$header .= "msgstr \"\"\n"; +$header .= "PO-Revision-Date: ".($timedata[5]+1900)."-".($timedata[4]+1)."-".$timedata[3]." ".$timedata[2].":".$timedata[1]."\n"; +$header .= "Last-Translator: Generated automatically from source files\n"; +$header .= "MIME-Version: 1.0\n"; +$header .= "Content-Type: text/plain; charset=utf-8\n"; +$header .= "Content-Transfer-Encoding: 8bit\n"; +$header .= "X-Poedit-SourceCharset: utf-8\n"; +$header .= "\n\n"; + +my $content = ""; +open (IN, "en.po"); +while (my $line = ) { + $content .= $line; +} +close(IN); +open (OUT, ">en.po"); +print OUT $header; +print OUT $content; +close(OUT);