use strict;
use warnings;
-use Getopt::Std;
-use Locale::PO;
-use JSON;
+
use Encode;
+use Getopt::Long;
+use JSON;
+use Locale::PO;
# current limits:
# - we do not support plural. forms
# - no message content support
my $options = {};
-
-getopts('o:', $options) ||
- die "unable to parse options\n";
+GetOptions($options, 't=s', 'o=s', 'v=s') or die "unable to parse options\n";
die "no files specified\n" if !scalar(@ARGV);
my $po = $href->{$k};
next if $po->fuzzy(); # skip fuzzy entries
my $ref = $po->reference();
+
+ # skip unused entries
+ next if !$ref;
+
+ # skip entries if t is defined (pve/pmg) and the string is
+ # not used there or in the widget toolkit
+ next if $options->{t} && $ref !~ m/($options->{t}|proxmox)\-/;
my $qmsgid = decode($charset, $po->msgid);
my $msgid = $po->dequote($qmsgid);
my $json = to_json($catalog, {canonical => 1, utf8 => 1});
-my $content = '';
+my $version = $options->{v} // ("dev-build " . localtime());
+my $content = "// $version\n"; # write version to the beginning to better avoid stale cache
my $outfile = $options->{o};