Locales
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
+ territory_code_is_known(T)
+ get_loadable_language_codes()
+ Locale::DB::Loadable (for this function and the soft locale related functions)
+ supports_special_zeroth(), plural_category_count()
+ 'Supported Locale Criteria' to POD,
+ non_locale_list(), is_non_locale(),
+ typical_en_alias_list(), is_typical_en_alias()
0.26 2012-02-27 12:18:39
- rt 75166: POD: change DataTime::Locale to DateTime::Locale
- rt 73892: Undeclared dependency on File::Slurp â add most of the proposed patch Makefile.PL part
- rt 75167: add normalize_tag_for_ietf()
0.25 2012-01-03 23:38:40
- rt 73571 (copy/paste leftover)
- rt 73572 (comment typo)
- Added 90 more plural rule tests (i.e. @plural_tests in t/04.â¦, only 2 of which failed in 0.24 due to rt 73678)
- rt 73678 (do Java style modulus in plural rules per CLDR)
- javascript functions (initial get_plural_form() w/ perl/js tests in t/06.â¦)
0.24 2011-12-28 22:34:09
"name" : "Locales",
"no_index" : {
"directory" : [
"t",
"inc"
]
},
"prereqs" : {
"build" : {
"requires" : {
"File::Slurp" : "0",
"Module::Want" : "0.6",
"Test::Carp" : "0",
"Test::More" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "6.56"
}
},
"runtime" : {
"requires" : {
"ExtUtils::MakeMaker" : "6.56",
"File::Slurp" : "0",
"Module::Want" : "0.6",
"String::UnicodeUTF8" : "0",
"Test::Carp" : "0",
"Test::More" : "0"
}
}
},
"release_status" : "stable",
"version" : "0.34"
}
---
abstract: 'Methods for getting localized CLDR language/territory names (and a subset of other data)'
author:
- 'Daniel Muey <http://drmuey.com/cpan_contact.pl>'
build_requires:
File::Slurp: '0'
Module::Want: '0.6'
Test::Carp: '0'
Test::More: '0'
configure_requires:
ExtUtils::MakeMaker: '6.56'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.150001'
license: unknown
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Locales
no_index:
directory:
- t
- inc
requires:
ExtUtils::MakeMaker: '6.56'
File::Slurp: '0'
Module::Want: '0.6'
String::UnicodeUTF8: '0'
Test::Carp: '0'
Test::More: '0'
version: '0.34'
Makefile.PL view on Meta::CPAN
WriteMakefile(
NAME => 'Locales',
AUTHOR => 'Daniel Muey <http://drmuey.com/cpan_contact.pl>',
VERSION_FROM => 'lib/Locales.pm',
ABSTRACT_FROM => 'lib/Locales.pm',
PL_FILES => {},
PREREQ_PM => {
'Test::More' => 0,
'Test::Carp' => 0,
'File::Slurp' => 0,
'ExtUtils::MakeMaker' => '6.56',
'Module::Want' => '0.6',
'String::UnicodeUTF8' => 0,
},
BUILD_REQUIRES => {
'Test::More' => 0,
'Test::Carp' => 0,
'File::Slurp' => 0,
'Module::Want' => '0.6',
},
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => 6.56,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Locales-*' },
);
_build/_locales_build_utils.pm view on Meta::CPAN
package _locales_build_utils;
use Cwd;
use XML::Simple;
use XML::Twig;
use File::Path::Tiny;
use lib Cwd::realpath('lib');
use Locales;
use File::Slurp;
use Encode (); # to be stringified properly from hash value bug: s{\|\|\s*(\$fallback_lang_misc_info\-\>\S*)\,}{|| Encode::decode_utf8($1),}
use String::Unquotemeta;
use JSON::Syck;
use JavaScript::Minifier::XS;
#### this ugliness will be spruced up when we go to CLDR-via-JSON in rt 69340 (no XML voo doo and we can move to TT for mod building) ##
# datetime.json
our $tripped;
use Test::Carp sub { $tripped = 1 if $_[0]; };
}
my $obj = Locales->new('af') || die "Could not create object for af: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('agq') || die "Could not create object for agq: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('ak') || die "Could not create object for ak: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 2 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('am') || die "Could not create object for am: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 2 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('ar') || die "Could not create object for ar: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 2 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('as') || die "Could not create object for as: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('asa') || die "Could not create object for asa: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('az') || die "Could not create object for az: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('bas') || die "Could not create object for bas: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('be') || die "Could not create object for be: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 2 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('bem') || die "Could not create object for bem: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('bez') || die "Could not create object for bez: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('bg') || die "Could not create object for bg: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('bm') || die "Could not create object for bm: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('bn') || die "Could not create object for bn: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('bo') || die "Could not create object for bo: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('br') || die "Could not create object for br: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 2 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('brx') || die "Could not create object for brx: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('bs') || die "Could not create object for bs: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 2 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('byn') || die "Could not create object for byn: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('ca') || die "Could not create object for ca: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('cch') || die "Could not create object for cch: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('cgg') || die "Could not create object for cgg: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
}
my $obj = Locales->new('chr') || die "Could not create object for chr: $@";
my @nums = ( 0, 1.6, 2.2, 3.14159, 42.78, 0 .. 256 );
eval 'use JE ()';
plan $@ ? ( 'skip_all' => 'JE.pm required for testing JS/Perl plural behavior tests' ) : ( 'tests' => ( scalar(@nums) * ( 4 + 4 ) ) );
my $js = JE->new();
use File::Slurp;
my $root = '.'; # TODO: make me portable
if ( -d '../share/' ) {
$root = '..';
}
if ( !-d "$root/share/" ) {
die "Can not determine share directory.";
}
my @cats = map { "args_$_" } $obj->get_plural_form_categories();
my $cats_args = join( ', ', map { "'$_'" } @cats );
my $jsfile = File::Slurp::read_file("$root/share/functions/$obj->{'locale'}.js") or die "Could not read '$root/share/functions/$obj->{'locale'}.js': $!";
for my $n (@nums) {
my $res = $js->eval("var X = $jsfile;return X.get_plural_form($n)");
is_deeply(
[ $res->[0], $res->[1] ], # have to do this to stringify JE object properly
[ $obj->get_plural_form($n) ],
"perl and js get_plural_form() behave the same. Tag: $obj->{'locale'} Number: $n"
);
is( $res->[1], 0, "using special is 0 for $n (no args)" );
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.889 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )