Locale-Unicode-Data
view release on metacpan or search on metacpan
my $all = $cldr->time_formats( locale => 'en' );
my $ref = $cldr->timezone( timezone => 'Asia/Tokyo' );
my $all = $cldr->timezones;
my $all = $cldr->timezones( territory => 'US' );
my $all = $cldr->timezones( region => 'Asia' );
my $all = $cldr->timezones( tzid => 'sing' );
my $all = $cldr->timezones( tz_bcpid => 'sgsin' );
my $all = $cldr->timezones( metazone => 'Singapore' );
my $all = $cldr->timezones( is_golden => undef );
my $all = $cldr->timezones( is_golden => 1 );
my $all = $cldr->timezones( is_primary => 1 );
my $all = $cldr->timezones( is_canonical => 1 );
my $ref = $cldr->timezone_city(
locale => 'fr',
timezone => 'Asia/Tokyo',
);
my $all = $cldr->timezones_cities;
my $ref = $cldr->timezone_info(
timezone => 'Asia/Tokyo',
start => undef,
);
my $ref = $cldr->timezone_info(
timezone => 'Europe/Simferopol',
start => ['>1991-01-01', '<1995-01-01'],
);
my $all = $cldr->timezones_info;
my $all = $cldr->timezones_info( metazone => 'Singapore' );
my $all = $cldr->timezones_info( start => undef );
my $all = $cldr->timezones_info( until => undef );
my $ref = $cldr->unit_alias( alias => 'meter-per-second-squared' );
my $all = $cldr->unit_aliases;
my $ref = $cldr->unit_constant( constant => 'lb_to_kg' );
my $all = $cldr->unit_constants;
my $ref = $cldr->unit_conversion( source => 'kilogram' );
my $all = $cldr->unit_conversions;
my $all = $cldr->unit_conversions( base_unit => 'kilogram' );;
my $all = $cldr->unit_conversions( category => 'kilogram' );
my $ref = $cldr->unit_l10n(
locale => 'en',
# long, narrow, short
format_length => 'long',
# compound, regular
unit_type => 'regular',
unit_id => 'length-kilometer',
count => 'one',
gender => undef,
gram_case => undef,
);
my $all = $cldr->units_l10n;
my $all = $cldr->units_l10n( locale => 'en' );
my $all = $cldr->units_l10n(
locale => 'en',
format_length => 'long',
unit_type => 'regular',
unit_id => 'length-kilometer',
pattern_type => 'regular',
);
my $ref = $cldr->unit_prefix( unit_id => 'micro' );
my $all = $cldr->unit_prefixes;
my $ref = $cldr->unit_pref( unit_id => 'square-meter' );
my $all = $cldr->unit_prefs;
my $all = $cldr->unit_prefs( territory => 'US' );
my $all = $cldr->unit_prefs( category => 'area' );
my $ref = $cldr->unit_quantity( base_unit => 'kilogram' );
my $all = $cldr->unit_quantities;
my $all = $cldr->unit_quantities( quantity => 'mass' );
my $ref = $cldr->variant( variant => 'valencia' );
my $all = $cldr->variants;
my $ref = $cldr->variant_l10n(
locale => 'en',
alt => undef,
variant => 'valencia',
);
my $all = $cldr->variants_l10n;
my $all = $cldr->variants_l10n( locale => 'en' );
my $all = $cldr->variants_l10n(
locale => 'en',
alt => undef,
);
my $ref = $cldr->week_preference( locale => 'ja' );
my $all = $cldr->week_preferences;
With advanced search:
my $all = $cldr->timezone_info(
timezone => 'Europe/Simferopol',
start => ['>1991-01-01','<1995-01-01'],
);
my $all = $cldr->time_formats(
region => '~^U.*',
);
my $all = $cldr->time_formats(
region => qr/^U.*/,
);
Enabling fatal exceptions:
use v5.34;
use experimental 'try';
no warnings 'experimental';
try
{
my $locale = Locale::Unicode::Data->new( fatal => 1 );
# Missing the 'width' argument
my $str = $cldr->timezone_names( timezone => 'Asia/Tokyo', locale => 'en' );
# More code
}
catch( $e )
{
say "Oops: ", $e->message;
}
Or, you could set the global variable $FATAL_EXCEPTIONS instead:
use v5.34;
use experimental 'try';
no warnings 'experimental';
$Locale::Unicode::Data::FATAL_EXCEPTIONS = 1;
try
{
my $locale = Locale::Unicode::Data->new;
# Missing the 'width' argument
my $str = $cldr->timezone_names( timezone => 'Asia/Tokyo', locale => 'en' );
Known values are: "per-unit", "prefix", "regular"
unit_prefix
my $ref = $cldr->unit_prefix( unit_id => 'micro' );
# Returns an hash reference like this:
{
unit_prefix_id => 9,
unit_id => 'micro',
symbol => 'μ',
power => 10,
factor => -6,
}
Returns an hash reference of a unit prefix information from the table
unit_prefixes based on the "unit_id" ID provided.
The meaning of the fields are as follows:
* "unit_prefix_id"
A unique incremental value automatically generated by SQLite.
* "unit_id"
A "unit" ID
* "symbol"
A string representing the unit symbol.
* "power"
A value representing the unit power
* "factor"
A value representing the unit factor.
unit_prefixes
my $all = $cldr->unit_prefixes;
Returns all the unit prefixes information as an array reference of hash
reference from the table unit_prefixes
No additional parameter is needed.
unit_pref
my $ref = $cldr->unit_pref( unit_id => 'square-meter' );
# Returns an hash reference like this:
{
unit_pref_id => 3,
unit_id => 'square-meter',
territory => '001',
category => 'area',
usage => 'default',
geq => undef,
skeleton => undef,
}
Returns an hash reference of a unit preference information from the
table unit_prefs based on the "unit_id" ID provided.
unit_prefs
my $all = $cldr->unit_prefs;
my $all = $cldr->unit_prefs( territory => 'US' );
my $all = $cldr->unit_prefs( category => 'area' );
Returns all the unit preferences information as an array reference of
hash reference from the table unit_prefs
A combination of the following fields may be provided to filter the
information returned:
* "territory"
A "territory" code as can be found in table territories
* "category"
A category ID. Known categories are: "area", "concentration",
"consumption", "duration", "energy", "length", "mass",
"mass-density", "power", "pressure", "speed", "temperature",
"volume", "year-duration"
unit_quantity
my $ref = $cldr->unit_quantity( base_unit => 'kilogram' );
# Returns an hash reference like this:
{
unit_quantity_id => 4,
base_unit => 'kilogram',
quantity => 'mass',
status => 'simple',
comment => undef,
}
Returns an hash reference of a unit quantities information from the
table unit_quantities based on the "unit_id" ID provided.
The meaning of the fields are as follows:
* "unit_quantity_id"
A unique incremental value automatically generated by SQLite.
* "base_unit"
A string representing the base unit.
* "quantity"
A string representing the unit quantity.
Known values are: "acceleration", "angle", "area",
"catalytic-activity", "concentration", "concentration-mass",
"consumption", "current-density", "digital", "duration",
"electric-capacitance", "electric-charge", "electric-conductance",
"electric-current", "electric-inductance", "electric-resistance",
"energy", "force", "frequency", "graphics", "illuminance",
"ionizing-radiation", "length", "luminous-flux",
"luminous-intensity", "magnetic-field-strength", "magnetic-flux",
"magnetic-induction", "mass", "mass-density", "mass-fraction",
"portion", "power", "pressure", "pressure-per-length",
"radioactivity", "resolution", "solid-angle", "specific-volume",
"speed", "substance-amount", "temperature", "typewidth", "voltage",
"volume", "wave-number", "year-duration"
* "status"
A string representing the unit status.
A decimal field.
* "description"
A string field.
* "status"
A string field.
Table unit_conversions
* "unit_conversion_id"
An integer field.
* "source"
A string field.
* "base_unit"
A string field.
* "expression"
A string field.
* "factor"
A decimal field.
* "systems"
A string array field.
* "category"
A string field.
Table unit_prefixes
* "unit_prefix_id"
An integer field.
* "unit_id"
A string field.
* "symbol"
A string field.
* "power"
An integer field.
* "factor"
An integer field.
Table unit_prefs
* "unit_pref_id"
An integer field.
* "unit_id"
A string field.
* "territory"
A string field.
* "category"
A string field.
* "usage"
A string field.
* "geq"
A decimal field.
* "skeleton"
A string field.
Table unit_quantities
* "unit_quantity_id"
An integer field.
* "base_unit"
A string field.
* "quantity"
A string field.
* "status"
A string field.
* "comment"
A string field.
Table units_l10n
* "units_l10n_id"
An integer field.
* "locale"
A string field.
* "format_length"
( run in 0.507 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )