ile::Path qw/mkpath/;
use Locale::Maketext::Extract;
use Getopt::Long;
use Exporter 'import';
use JSON::XS;
use YAML::XS;
use File::Basename;
use Locale::Maketext::Extract;
use App::I18N::Logger;
use
Plugin::PPI' => [ 'pm','pl' ],
'tt2' => [ ],
# 'perl' => ['pl','pm','js','json'],
'perl' => [ '*' ], # _( ) , gettext( ) , loc( ) ...
'mason' => [ ] ,
d" => "msgstr"
....
);
?>
....
For JSON
en.json:
{
"msgid..." : "msgstr"
...
};
zh_tw.json:
{
....
};
Static JS
var dict;
g) = ($pofile =~ m{(\w+)\.po$} ); # get en_US or zh_TW ... etc
my $ext = $type; # "json , js, pl, pm, php";
my $outfile = File::Spec->join( $output_dir , "$lang.$ext" );
if( $type eq 'json' ) {
use JSON::XS;
print FH encode_json( \%entries );
}
elsif ( $type eq 'js' ) {
use JSON::XS;
t_lexicon( $lexicon );
$lme->write_po($pofile);
}
=pod
package MsgEntry;
use Any::Moose;
use JSON::XS;
use overload
'""' => \&to_string,
'%{}' => \&to_hash;
has id => ( is => 'rw', isa
lang => $self->lang,
msgid => $self->msgid,
msgstr => $self->msgstr,
);
}
sub to_string {
my $self = shift;
return encode_json( { $self->to_hash } );
}
=cut
1;