X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=jsgettext.pl;h=6dd7391246315ce24eeb6dfeaeda544a8ba744f7;hb=c756af6929c751892edbf57e24a46559d491b95b;hp=00b095339c008675ac31d467521459c164ebd5ae;hpb=5a4f77170e37f0590e0b061c65f72c74d9ca066a;p=proxmox-i18n.git diff --git a/jsgettext.pl b/jsgettext.pl index 00b0953..6dd7391 100755 --- a/jsgettext.pl +++ b/jsgettext.pl @@ -10,7 +10,7 @@ use Encode; my $options = {}; -getopts('o:b:', $options) || +getopts('o:b:p:', $options) || die "unable to parse options\n"; my $dirs = [@ARGV]; @@ -21,6 +21,8 @@ foreach my $dir (@$dirs) { die "no such directory '$dir'\n" if ! -d $dir; } +my $projectId = $options->{p} || die "missing project ID\n"; + my $basehref = {}; if (my $base = $options->{b}) { my $aref = Locale::PO->load_file_asarray($base) || @@ -68,7 +70,7 @@ my $po = new Locale::PO(-msgid=> '', -comment=> $header, -fuzzy=> 1, -msgstr=> - "Project-Id-Version: proxmox-mailgateway 5.0\n" . + "Project-Id-Version: $projectId\n" . "Report-Msgid-Bugs-To: \n" . "POT-Creation-Date: $ctime\n" . "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" . @@ -116,7 +118,7 @@ sub extract_msg { foreach my $s (@$sources) { open(SRC, $s) || die "unable to open file '$s' - $!\n"; while(defined(my $line = )) { - next if $line =~ m/^function gettext/; + next if $line =~ m/^\s*function gettext/; if ($line =~ m/gettext\s*\(/) { extract_msg($s, $., $line); }