NAME
Locale::TextDomain::OO::Extract::JavaScript - Extracts internationalization data from JavaScript code
$Id: JavaScript.pm 252 2009-12-29 13:55:33Z steffenw $
$HeadURL: https://perl-gettext-oo.svn.sourceforge.net/svnroot/perl-gettext-oo/trunk/lib/Locale/TextDomain/OO/Extract/JavaScript.pm $
VERSION
0.04
DESCRIPTION
This module extracts internationalization data from JavaScript code.
Implemented Rules:
_('...
gettext('...
cgettext('...
dgettext('...
dcgettext('...
ngettext('...
cngettext('...
dngettext('...
dcngettext('...
pgettext('...
cpgettext('...
dpgettext('...
dcpgettext('...
npgettext('...
cnpgettext('...
dnpgettext('...
dcnpgettext('...
Alternative quoting with " is allowed. Whitespace is allowed everywhere.
SYNOPSIS
use Locale::TextDomain::OO::Extract::JavaScript;
SUBROUTINES/METHODS
method new
All parameters are optional. See Locale::TextDomain::OO::Extract to replace the defaults.
my $extractor = Locale::TextDomain::OO::Extract::JavaScript->new(
# where to store the pot file
pot_dir => './',
# how to store the pot file
# - The meaning of undef is ISO-8859-1 but use not Perl unicode.
# - Set 'ISO-8859-1' to have a ISO-8859-1 pot file and use Perl unicode.
# - Set 'UTF-8' to have a UTF-8 pot file and use Perl unicode.
# And so on.
pot_charset => undef,
# add some key value pairs to the header
# more see documentation of DBD::PO
pot_header => { ... },
);
method extract
The default pot_dir is "./".
Call
$extractor->extract('dir/filename.js');
to extract "dir/filename.js" to have a "$pot_dir/dir/filename.js.pot".
Call
open my $file_handle, '<', 'dir/filename.js'
or croak "Can no open file dir/filename.js\n$OS_ERROR";
$extractor->extract('filename', $file_handle);
to extract "dir/filename.js" to have a "$pot_dir/filename.pot".
EXAMPLE
Inside of this distribution is a directory named example. Run this *.pl files.
DIAGNOSTICS
see Locale::TextDomain::OO::Extract
CONFIGURATION AND ENVIRONMENT
none
DEPENDENCIES
version
parent
Locale::TextDomain::OO::Extract
INCOMPATIBILITIES
not known
BUGS AND LIMITATIONS
none
SEE ALSO
AUTHOR
Steffen Winkler
LICENSE AND COPYRIGHT
Copyright (c) 2009, Steffen Winkler <steffenw at cpan.org>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.