NAME
Locale::Unicode::Data - Unicode CLDR SQL Data
SYNOPSIS
use Locale::Unicode::Data;
my $cldr = Locale::Unicode::Data->new;
# Do not decode SQL arrays into perl arrays. Defaults to true
# This uses JSON::XS
my $cldr = Locale::Unicode::Data->new( decode_sql_arrays => 0 );
my $datetime = $cldr->cldr_built;
my $str = $cldr->cldr_maintainer;
my $version = $cldr->cldr_version;
my $dbh = $cldr->database_handler;
my $sqlite_db_file = $cldr->datafile;
my $bool = $cldr->decode_sql_arrays;
# Deactivate automatic SQL arrays decoding
$cldr->decode_sql_arrays(0);
my $tree = $cldr->make_inheritance_tree( 'ja-JP' );
# ['ja-JP', 'ja', 'und']
my $tree = $cldr->make_inheritance_tree( 'es-Latn-001-valencia' );
# ['es-Latn-001-valencia', 'es-Latn-001', 'es-Latn', 'es', 'und']
# But...
my $tree = $cldr->make_inheritance_tree( 'pt-FR' );
# Because exceptionally, the parent of 'pt-FR' is not 'pt', but 'pt-PT'
# ['pt-FR', 'pt-PT', 'pt', 'und']
my $ref = $cldr->split_interval(
pattern => "E, MMM d, y – E, MMM d, y G",
greatest_diff => 'y',
);
# ["E, MMM d, y", " – ", "E, MMM d, y G", "E, MMM d, y"]
my $ref = $cldr->alias(
alias => 'fro',
type => 'subdivision',
); # For 'Hauts-de-France'
my $all = $cldr->aliases;
# 'type' can be one of territory, language, zone, subdivision, variant, script
my $all = $cldr->aliases( type => 'territory' );
my $ref = $cldr->annotation( annotation => '{', locale => 'en' );
my $all = $cldr->annotations;
# Get all annotations for locale 'en'
my $all = $cldr->annotations( locale => 'en' );
my $ref = $cldr->bcp47_currency( currid => 'jpy' );
my $all = $cldr->bcp47_currencies;
my $all = $cldr->bcp47_currencies( code => 'JPY' );
# Get all obsolete BCP47 currencies
my $all = $cldr->bcp47_currencies( is_obsolete => 1 );
my $ref = $cldr->bcp47_extension( extension => 'ca' );
my $all = $cldr->bcp47_extensions;
# Get all deprecated BCP47 extensions
my $all = $cldr->bcp47_extensions( deprecated => 1 );
my $ref = $cldr->bcp47_timezone( tzid => 'jptyo' );
my $all = $cldr->bcp47_timezones;
# Get all deprecated BCP47 timezones
my $all = $cldr->bcp47_timezones( deprecated => 1 );
# Returns information about Japanese Imperial calendar
my $ref = $cldr->bcp47_value( value => 'japanese' );
my $all = $cldr->bcp47_timezones;
# Get all the BCP47 values for the category 'calendar'
my $all = $cldr->bcp47_values( category => 'calendar' );
my $all = $cldr->bcp47_values( extension => 'ca' );
my $ref = $cldr->calendar( calendar => 'gregorian' );
my $all = $cldr->calendars;
# Known 'system' value: undef, lunar, lunisolar, other, solar
my $all = $cldr->calendars( system => 'solar' );
my $ref = $cldr->calendar_append_format(
locale => 'en',
calendar => 'gregorian',
format_id => 'Day',
);
my $all = $cldr->calendar_append_formats;
my $all = $cldr->calendar_append_formats(
locale => 'en',
calendar => 'gregorian',
);
my $ref = $cldr->calendar_available_format(
locale => 'en',
calendar => 'gregorian',
format_id => 'Hms',
count => undef,
alt => undef,
);
my $all = $cldr->calendar_available_formats;
my $all = $cldr->calendar_available_formats( locale => 'en', calendar => 'gregorian' );
my $ref = $cldr->calendar_cyclic_l10n(
locale => 'und',
calendar => 'chinese',
format_set => 'dayParts',
format_type => 'format',
format_length => 'abbreviated',
format_id => 1,
);
my $all = $cldr->calendar_cyclics_l10n;
my $all = $cldr->calendar_cyclics_l10n( locale => 'en' );
my $all = $cldr->calendar_cyclics_l10n(
locale => 'en',
calendar => 'chinese',
format_set => 'dayParts',
# Not really needed since 'format' is the only value being currently used
# format_type => 'format',
format_length => 'abbreviated',
);
my $all = $cldr->calendar_datetime_formats;
my $all = $cldr->calendar_datetime_formats(
locale => 'en',
calendar => 'gregorian',
);
my $ref = $cldr->calendar_era(
calendar => 'japanese',
sequence => 236,
); # Current era 'reiwa'
my $ref = $cldr->calendar_era(
calendar => 'japanese',
code => 'reiwa',
); # Current era 'reiwa'
my $all = $cldr->calendar_eras;
my $all = $cldr->calendar_eras( calendar => 'hebrew' );
my $ref = $cldr->calendar_format_l10n(
locale => 'en',
calendar => 'gregorian',
format_type => 'date',
format_length => 'full',
format_id => 'yMEEEEd',
);
my $ref = $cldr->calendar_era_l10n(
locale => 'ja',
calendar => 'gregorian',
era_width => 'abbreviated',
alt => undef,
era_id => 0,
);
my $array_ref = $cldr->calendar_eras_l10n;
# Filter based on the 'locale' field value
my $array_ref = $cldr->calendar_eras_l10n( locale => 'en' );
# Filter based on the 'calendar' field value
my $array_ref = $cldr->calendar_eras_l10n( calendar => 'gregorian' );
# or a combination of multiple fields:
my $array_ref = $cldr->calendar_eras_l10n(
locale => 'en',
calendar => 'gregorian',
era_width => 'abbreviated',
alt => undef
);
my $ref = $cldr->calendar_format_l10n(
locale => 'en',
calendar => 'gregorian',
# date, time
format_type => 'date',
# full, long, medium, short
format_length => 'full',
format_id => 'yMEEEEd',
);
my $all = $cldr->calendar_formats_l10n;
my $all = $cldr->calendar_formats_l10n(
locale => 'en',
calendar => 'gregorian',
);
my $all = $cldr->calendar_formats_l10n(
locale => 'en',
calendar => 'gregorian',
format_type => 'date',
format_length => 'full',
);
my $ref = $cldr->calendar_interval_format(
locale => 'en',
calendar => 'gregorian',
greatest_diff_id => 'd',
format_id => 'GyMMMEd',
alt => undef,
);
my $all = $cldr->calendar_interval_formats;
my $all = $cldr->calendar_interval_formats(
locale => 'en',
calendar => 'gregorian',
);
my $ref = $cldr->calendar_term(
locale => 'und',
calendar => 'gregorian',
# format, stand-alone
term_context => 'format',
# abbreviated, narrow, wide
term_width => 'abbreviated',
term_name => 'am',
);
my $array_ref = $cldr->calendar_terms;
my $array_ref = $cldr->calendar_terms(
locale => 'und',
calendar => 'japanese'
);
my $array_ref = $cldr->calendar_terms(
locale => 'und',
calendar => 'gregorian',
term_type => 'day',
term_context => 'format',
term_width => 'abbreviated',
);
my $ref = $cldr->casing( locale => 'fr', token => 'currencyName' );
my $all = $cldr->casings;
my $all = $cldr->casings( locale => 'fr' );
my $ref = $cldr->code_mapping( code => 'US' );
my $all = $cldr->code_mappings;
my $all = $cldr->code_mappings( type => 'territory' );
my $all = $cldr->code_mappings( type => 'currency' );
my $all = $cldr->code_mappings( alpha3 => 'USA' );
my $all = $cldr->code_mappings( numeric => 840 ); # U.S.A.
my $all = $cldr->code_mappings( numeric => [">835", "<850"] ); # U.S.A.
my $all = $cldr->code_mappings( fips => 'JP' ); # Japan
my $all = $cldr->code_mappings( fips => undef, type => 'currency' );
my $ref = $cldr->collation( collation => 'ducet' );
my $all = $cldr->collations;
my $all = $cldr->collations( description => qr/Chinese/ );
my $ref = $cldr->collation_l10n( locale => 'en', collation => 'ducet' );
my $all = $cldr->collations_l10n( locale => 'en' );
my $all = $cldr->collations_l10n( locale => 'ja', locale_name => qr/中国語/ );
my $ref = $cldr->currency( currency => 'JPY' ); # Japanese Yen
my $all = $cldr->currencies;
my $all = $cldr->currencies( is_obsolete => 1 );
my $ref = $cldr->currency_info( territory => 'FR', currency => 'EUR' );
my $all = $cldr->currencies_info;
my $all = $cldr->currencies_info( territory => 'FR' );
my $all = $cldr->currencies_info( currency => 'EUR' );
my $ref = $cldr->currency_l10n(
locale => 'en',
count => undef,
currency => 'JPY',
);
my $all = $cldr->currencies_l10n;
my $all = $cldr->currencies_l10n( locale => 'en' );
my $all = $cldr->currencies_l10n(
locale => 'en',
currency => 'JPY',
);
my $ref = $cldr->date_field_l10n(
locale => 'en',
field_type => 'day',
field_length => 'narrow',
relative => -1,
);
my $all = $cldr->date_fields_l10n;
my $all = $cldr->date_fields_l10n( locale => 'en' );
my $all = $cldr->date_fields_l10n(
locale => 'en',
field_type => 'day',
field_length => 'narrow',
);
my $ref = $cldr->day_period( locale => 'fr', day_period => 'noon' );
my $all = $cldr->day_periods;
my $all = $cldr->day_periods( locale => 'ja' );
# Known values for day_period: afternoon1, afternoon2, am, evening1, evening2,
# midnight, morning1, morning2, night1, night2, noon, pm
my $all = $cldr->day_periods( day_period => 'noon' );
my $ids = $cldr->interval_formats(
locale => 'en',
calendar => 'gregorian',
);
# Retrieve localised information for certain type of data
# Possible types are: annotation, calendar_append_format, calendar_available_format,
# calendar_cyclic, calendar_era, calendar_format, calendar_interval_formats,
# calendar_term, casing, currency, date_field, locale, number_format, number_symbol
# script, subdivision, territory, unit, variant
my $ref = $cldr->l10n(
type => 'annotation',
locale => 'en',
annotation => '{',
);
my $ref = $cldr->l10n(
# or just 'append'
type => 'calendar_append_format',
locale => 'en',
calendar => 'gregorian',
format_id => 'Day',
);
my $ref = $cldr->l10n(
# or just 'available'
type => 'calendar_available_format',
locale => 'ja',
calendar => 'japanese',
format_id => 'GyMMMEEEEd',
);
my $ref = $cldr->l10n(
# or just 'cyclic'
type => 'calendar_cyclic',
locale => 'ja',
calendar => 'chinese',
format_set => 'dayParts',
# 1..12
format_id => 1,
);
# Retrieve the information on current Japanese era (Reiwa)
my $ref = $cldr->l10n(
# or just 'era'
type => 'calendar_era',
locale => 'ja',
calendar => 'japanese',
# abbreviated, narrow
# 'narrow' contains less data than 'abbreviated'
era_width => 'abbreviated',
era_id => 236,
);
my $ref = $cldr->l10n(
type => 'calendar_format',
locale => 'ja',
calendar => 'gregorian',
format_id => 'yMEEEEd',
);
my $ref = $cldr->l10n(
# or just 'interval'
type => 'calendar_interval_format',
locale => 'ja',
calendar => 'gregorian',
format_id => 'yMMM',
);
my $ref = $cldr->l10n(
type => 'calendar_term',
locale => 'ja',
calendar => 'gregorian',
term_name => 'mon',
);
my $ref = $cldr->l10n(
type => 'casing',
locale => 'fr',
token => 'currencyName',
);
my $ref = $cldr->l10n(
type => 'currency',
locale => 'ja',
currency => 'EUR',
);
my $ref = $cldr->l10n(
# or just 'field'
type => 'date_field',
locale => 'ja',
# Other possible values:
# day, week, month, quarter, year, hour, minute, second,
# mon, tue, wed, thu, fri, sat, sun
field_type => 'day',
# -1 for yesterday, 0 for today, 1 for tomorrow
relative => -1,
);
my $ref = $cldr->l10n(
type => 'locale',
locale => 'ja',
locale_id => 'fr',
);
my $ref = $cldr->l10n(
type => 'number_format',
locale => 'ja',
number_type => 'currency',
format_id => '10000',
);
my $ref = $cldr->l10n(
# or just 'symbol'
type => 'number_symbol',
locale => 'en',
number_system => 'latn',
property => 'decimal',
);
my $ref = $cldr->l10n(
type => 'script',
locale => 'ja',
script => 'Kore',
);
my $ref = $cldr->l10n(
type => 'subdivision',
locale => 'en',
subdivision => 'jp13', # Tokyo
);
my $ref = $cldr->l10n(
type => 'territory',
locale => 'en',
territory => 'JP', # Japan
);
my $ref = $cldr->l10n(
type => 'unit',
locale => 'en',
unit_id => 'power3',
);
my $ref = $cldr->l10n(
type => 'variant',
locale => 'en',
variant => 'valencia',
);
my $ref = $cldr->language( language => 'ryu' ); # Central Okinawan (Ryukyu)
my $all = $cldr->languages;
my $all = $cldr->languages( parent => 'gmw' );
my $all = $cldr->language_population( territory => 'JP' );
my $all = $cldr->language_populations;
my $all = $cldr->language_populations( official_status => 'official' );
my $ref = $cldr->likely_subtag( locale => 'ja' );
my $all = $cldr->likely_subtags;
my $ref = $cldr->locale( locale => 'ja' );
my $all = $cldr->locales;
my $ref = $cldr->locale_l10n(
locale => 'en',
locale_id => 'ja',
alt => undef,
);
my $all = $cldr->locales_l10n;
# Returns an array reference of all locale information in English
my $all = $cldr->locales_l10n( locale => 'en' );
# Returns an array reference of all the way to write 'Japanese' in various languages
# This would typically return an array reference of something like 267 hash reference
my $all = $cldr->locales_l10n( locale_id => 'ja' );
# This is basically the same as with the method locale_l10n()
my $all = $cldr->locales_l10n(
locale => 'en',
locale_id => 'ja',
alt => undef,
);
my $ref = $cldr->locales_info( property => 'quotation_start', locale => 'ja' );
my $all = $cldr->locales_infos;
my $ref = $cldr->metazone( metazone => 'Japan' );
my $all = $cldr->metazones;
my $ref = $cldr->number_format_l10n(
locale => 'en',
number_system => 'latn',
number_type => 'currency',
format_length => 'short',
format_type => 'standard',
alt => undef,
count => 'one',
format_id => 1000,
);
my $all = $cldr->number_formats_l10n;
my $all = $cldr->number_formats_l10n( locale => 'en' );
my $all = $cldr->number_formats_l10n(
locale => 'en',
number_system => 'latn',
number_type => 'currency',
format_length => 'short',
format_type => 'standard',
);
my $ref = $cldr->number_symbol_l10n(
locale => 'en',
number_system => 'latn',
property => 'decimal',
alt => undef,
);
my $all = $cldr->number_symbols_l10n;
my $all = $cldr->number_symbols_l10n( locale => 'en' );
my $all = $cldr->number_symbols_l10n(
locale => 'en',
number_system => 'latn',
);
# See also using rbnf
my $ref = $cldr->number_system( number_system => 'jpan' );
my $all = $cldr->number_systems;
my $ref = $cldr->person_name_default( locale => 'ja' );
my $all = $cldr->person_name_defaults;
my $ref = $cldr->rbnf(
locale => 'ja',
ruleset => 'spellout-cardinal',
rule_id => 7,
);
my $rule = $cldr->plural_forms( 'en' );
# nplurals=2; plural=(n != 1);
my $rule = $cldr->plural_forms( 'ja' );
# nplurals=1; plural=0;
my $rule = $cldr->plural_forms( 'ar' );
# nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);
my $all = $cldr->rbnfs;
my $all = $cldr->rbnfs( locale => 'ko' );
my $all = $cldr->rbnfs( grouping => 'SpelloutRules' );
my $all = $cldr->rbnfs( ruleset => 'spellout-cardinal-native' );
my $ref = $cldr->reference( code => 'R1131' );
my $all = $cldr->references;
my $ref = $cldr->script( script => 'Jpan' );
my $all = $cldr->scripts;
# 'rtl' ('right-to-left' writing orientation)
my $all = $cldr->scripts( rtl => 1 );
my $all = $cldr->scripts( origin_country => 'FR' );
my $all = $cldr->scripts( likely_language => 'fr' );
my $ref = $cldr->script_l10n(
locale => 'en',
script => 'Latn',
alt => undef,
);
my $all = $cldr->scripts_l10n;
my $all = $cldr->scripts_l10n( locale => 'en' );
my $all = $cldr->scripts_l10n(
locale => 'en',
alt => undef,
);
my $ref = $cldr->subdivision( subdivision => 'jp12' );
my $all = $cldr->subdivisions;
my $all = $cldr->subdivisions( territory => 'JP' );
my $all = $cldr->subdivisions( parent => 'US' );
my $all = $cldr->subdivisions( is_top_level => 1 );
my $ref = $cldr->subdivision_l10n(
locale => 'en',
# Texas
subdivision => 'ustx',
);
my $all = $cldr->subdivisions_l10n;
my $all = $cldr->subdivisions_l10n( locale => 'en' );
my $ref = $cldr->territory( territory => 'FR' );
my $all = $cldr->territories;
my $all = $cldr->territories( parent => 150 );
my $ref = $cldr->territory_l10n(
locale => 'en',
territory => 'JP',
alt => undef,
);
my $all = $cldr->territories_l10n;
my $all = $cldr->territories_l10n( locale => 'en' );
my $all = $cldr->territories_l10n(
locale => 'en',
alt => undef,
);
my $ref = $cldr->time_format( region => 'JP' );
my $all = $cldr->time_formats;
my $all = $cldr->time_formats( region => 'US' );
my $all = $cldr->time_formats( territory => 'JP' );
my $all = $cldr->time_formats( locale => undef );
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' );
# More code
}
catch( $e )
{
say "Oops: ", $e->message;
}
VERSION
v1.6.0
DESCRIPTION
Locale::Unicode::Data provides access to all the data from the Unicode CLDR (Common Locale Data Repository), using a SQLite database. This is the most extensive up-to-date CLDR data you will find on CPAN. It is provided as SQLite data with a great many number of methods to access those data and make it easy for you to retrieve them. Thanks to SQLite, it is very fast.
SQLite version 3.6.19 (2009-10-14) or higher is required, as this module relies on foreign keys, which were not fully supported before. If the version is anterior, the module will return an error upon object instantiation.
It is designed to be extensive in the scope of data that can be accessed, while at the same time, memory-friendly. Access to each method returns data from the SQLite database on a need-basis.
All the data in this SQLite database are sourced directly and exclusively from the Unicode official CLDR data using a perl script available in this distribution under the scripts directory. Use perldoc scripts/create_database.pl or scripts/create_database.pl --man to access its POD documentation.
The CLDR data includes, by design, outdated ones, such as outdated currencies, country codes, or timezones, that CLDR keeps in order to ensure consistency and reliability. For example, for timezones, the Unicode LDML (Locale Data Markup Language) states that "CLDR contains locale data using a time zone ID from the tz database as the key, stability of the IDs is critical." and "Not all TZDB links are in CLDR aliases. CLDR purposefully does not exactly match the Link structure in the TZDB.". See https://unicode.org/reports/tr35/#Time_Zone_Identifiers
In CLDR parlance, a language is a 2 to 3-characters identifier, whereas a locale includes more information, such as a language, a script, a territory, a variant, and possibly much more information. See for that the Locale::Unicode module and the LDML specifications
Those locales also inherit data from their respective parents. For example, sr-Cyrl-ME would have the following inheritance tree: sr-ME, sr, and und
You can build a locale inheritance tree using make_inheritance_tree, and I recommend Locale::Unicode to build, parse and manipulate locales.
Also, in those CLDR data, there is not always a one-to-one match across all territories (countries) or languages, meaning that some territories or languages have more complete CLDR data than others.
CLDR also uses some default values to avoid repetitions. Those default values are stored in the World territory with code 001 and special language code und (a.k.a. unknown also referred as root)
Please note that the SQLite database is built to not be case sensitive in line with the LDML specifications.
This module documentation is not meant to be a replacement for the Unicode LDML (Locale Data Markup Language) documentation, so please make sure to read the LDML documentation and the CLDR specifications.
The data available from the CLDR via this module includes:
ISO 4217 currencies, including BCP47 currencies, their localised names and their associated country historical usage.
Calendar IDs with description in English
Calendar eras, for some calendar systems, such as the
japaneseone.Territories (countries, or world regions)
This includes, for countries, additional information such as
GDP(Gross Domestic Product), literacy percentage, population size, languages spoken, possible other ISO 3166 codes contained by this territory (essentially world regions identified as 3-digits code, or special codes likeEUorUN), the official currency, a list of calendar IDs (not always available for all territories), the first day of the week, the first and last day of the week-end-
This provides the name of a
territoryfor a givenlocale Territories currencies history
All known locales
This includes the
localestatus, which may beregular,deprecated,special,reserved,private_use, orunknownLocalised names of locales
This provides the name of a
localefor a givenlocaleAll known languages
This may include its associated
scriptsandterritories, and itsparentlanguage, if any.Its status may be
regular,deprecated,special,reserved,private_use, orunknownAll known scripts
This includes possibly the
scriptID, its rank, a sample character, line break letter, whether it is right-to-left direction, if it has casing, if it requires shapping, its density, possibly its origin territory and its likely locale.-
This provides the name of a
scriptfor a givenlocale All known variants
This includes the
variantstatus, which may beregular,deprecated,special,reserved,private_use, orunknown-
This provides the name of a
variantfor a givenlocale -
This includes the associated
territoryandlocale, the default time format, such asHand the time allowed. -
This provides information for a given
territoryandlocaleabout the percentage of the population using thatlocale, their literacy percentage, and percentage of the population using in writing thelocale, and its official status, which may beofficial,de_facto_official, andofficial_regional -
This provides for a given
localethe likely target locale to expand to. -
This provides aliases for
languages,scripts,territories,subdivisions,variants, andtimezones -
This provides IANA Olson time zones, but also some other time zones, such as
Etc/GMT. The CLDR data also includes former time zones for consistency and stability.The information includes possibly the associated
territory, theregionsuch asAmericaorEurope, the time zone ID, such asjapa, a meta zone, such asEurope_Central, a BCP47 time zone ID, and a boolean value whether the time zone is agoldentime zone or not. -
This provides historical time zone information, such as when it started and ended.
-
Subdivisions are parts of a territory, such as a province like in Canada, a department like in France or a prefecture like in Japan.
The information here includes a
subdivisionID, possibly aparent, a boolean whether this is a top level subdivision for the given territory, and a status, which may beregular,deprecated,special,reserved,private_use, orunknown -
This contains the name of a
subdivisionfor a givenlocale -
This provides information about numbering systems, including the numbering system ID, the digits from
0to9 -
This contains the week ordering preferences for a given
locale. Possible values are:weekOfYear,weekOfDate,weekOfMonth -
This contains the time representation of day period ID, such as
midnight,noon,morning1,morning2,afternoon1,afternoon2,evening1,evening2,night1,night2with values in hour and minute, such as12:00set in astartanduntilfield. -
This serves to map territory or currency codes with their well known equivalent in ISO and U.S. standard (FIPS10)
-
This specifies, for a given
locale, whether a person's given name comes first before the surname, or after. -
This contains all the references behind the CLDR data.
-
This contains BCP 47 time zones along with possible aliases and preferred time zone
-
This includes the currency ID, an ISO 4217 code, description and a boolean value whether it is obsolete or not.
-
This contains the extension category, extension ID, possibly alias, value type and description, and whether it is deprecated,
-
This includes an extension category, and extension ID, an extension value and description.
-
This provide annotations (single character like a symbol or an emoji) and default short description for a given
locale RBNF (Rule-Based Number Format)
This provides RBNF rules with its grouping value, such as
SpelloutRulesorOrdinalRules, the rule set ID such asspellout-numbering-yearorspellout-cardinal, the rule ID such asInfand the rule value.-
This provides information about casing for a given
localeIt includes the
locale, atokensuch ascurrencyName,languageand avalue, such aslowercase,titlecase -
This provides localised terms used in different parts of a calendar system, for a given
localeandcalendarID. -
This provides the localised era names for a given
localeandcalendarID. Localised calendar date, time and interval formattings
This provides the
CLDRDateTimeformattings for a givenlocaleandcalendarID.-
This provides a matching between a desired
localeand what is actually supported, and adistancefactor, which designed to be the opposite of a percentage, by Unicode. The desiredlocalecan be a perl regular expression. Unit constants
Some constant values declared for certain measurement units.
-
Defines the quantity type for certain units.
-
Define a list of unit conversion from one unit to another.
Unit preferences by territories
Defines what units are preferred by territory.
-
Provides some aliases for otherwise outdated units.
-
Localised unit formatting.
Locale Number symbols
Value used for each locale for
approximately,currency_decimal,currency_group,decimal,exponential,group,infinity,list,minus,nan,per_mille,percent,plus,superscript, andtime_separatorNot every
localehas a value for each of those properties though.-
Localised formatting for currency or decimal numbers.
If you need a more granular access to the data, feel free to access the SQL data directly. You can retrieve a database handler, as an instance of the DBI API, or you can instantiate a connection yourself using the database file information
CONSTRUCTOR
new
This takes some hash or hash reference of options, instantiates a new Locale::Unicode::Data object, connects to the SQLite database file specified, or the default one, and returns the newly instantiated object.
If an error occurred, an error object is created and undef is returned in scalar context, or an empty list in list context.
Supported options are as follows. Each option can be later accessed or modified by their associated method.
datafileThe file path to the SQLite database file. If this option is not provided, the SQLite database file used will be the one set in the global variable
$DB_FILEdecode_sql_arraysBoolean value to enable or disable automatic decoding of SQL arrays into perl arrays using JSON::XS
This is enabled by default.
If you want to retrieve a lot of data and do not need access to those arrays, you should deactivate decoding to improve speed.
If an error occurs, an exception object is set and undef is returned in scalar context, or an empty list in list context. The exception object can then be retrieved using error, such as:
my $cldr = Locale::Unicode::Data->new( $somthing_bad ) ||
die( Locale::Unicode::Data->error );
METHODS
alias
my $ref = $cldr->alias(
alias => 'i_klingon',
type => 'language',
);
This would return an hash reference containing:
{
alias_id => 5,
alias => 'i_klingon',
replacement => ["tlh"],
reason => 'deprecated',
type => 'language',
comment => 'Klingon',
}
Returns the language, script, territory, subdivision, variant, or zone aliases stored in table aliases for a given alias and an alias type.
See the LDML specifications for more information.
The meaning of the fields are as follows:
alias_idA unique incremental value provided by SQLite.
aliasThe original value.
replacementThe replacement value for the
aliasreasonReason for the replacement.
Known reasons are
bibliographic,deprecated,legacy,macrolanguage,overlongtypeThe type of alias.
There are 6 types of aliases:
commentA possible comment
aliases
my $array_ref = $cldr->aliases;
# Filtering based on type
my $array_ref = $cldr->aliases( type => 'language' );
my $array_ref = $cldr->aliases( type => 'script' );
my $array_ref = $cldr->aliases( type => 'subdivision' );
my $array_ref = $cldr->aliases( type => 'territory' );
my $array_ref = $cldr->aliases( type => 'variant' );
my $array_ref = $cldr->aliases( type => 'zone' );
Returns all the data stored in table aliases as an array reference of hash reference.
If an type option is provided, it will return only all the data matching the given type.
See the LDML specifications for more information.
annotation
my $ref = $cldr->annotation( locale => 'en', annotation => '{' );
# Returns an hash reference like this:
{
annotation_id => 34686,
locale => 'en',
annotation => '{',
defaults => ["brace", "bracket", "curly brace", "curly bracket", "gullwing", "open curly bracket"],
tts => 'open curly bracket',
}
Returns an hash reference of a annotation information from the table annotations for a given locale ID, and annotation value.
As per the LDML specifications, "Annotations provide information about characters, typically used in input. For example, on a mobile keyboard they can be used to do completion. They are typically used for symbols, especially emoji characters."
The meaning of the fields are as follows:
annotation_idA unique incremental value automatically generated by SQLite.
localeA
localeID as can be found in the table localesannotationA string representing the
annotationdefaultsAn array of short strings describing the annotation in the language specified by the
localettsA short string describing the
annotation
annotations
my $array_ref = $cldr->annotations;
# Get all annotations for locale 'en'
my $array_ref = $cldr->annotations( locale => 'en' );
Returns all annotations information for all known locales from the table annotations as an array reference of hash reference.
Alternatively, you can provide a locale to return all annotation information for that locale
bcp47_currency
my $ref = $cldr->bcp47_currency( currid => 'jpy' );
# Returns an hash reference like this:
{
bcp47_curr_id => 133,
currid => 'jpy',
code => 'JPY',
description => 'Japanese Yen',
is_obsolete => 0,
}
Returns an hash reference of a BCP47 currency information from the table bcp47_currencies for a given BCP47 currency ID currid.
The meaning of the fields are as follows:
bcp47_curr_idA unique incremental value automatically generated by SQLite.
curridA string representing a BCP47
currencyID.codeA string representing a ISO 4217
currencycode, which could be outdated by the ISO standard, but still valid forCLDRdescriptionA text describing the
currencyis_obsoleteA boolean value defining whether the
currencyis obsolete or not. Default to false.
bcp47_currencies
my $array_ref = $cldr->bcp47_currencies;
# Filtering based on ISO4217 currency code
my $array_ref = $cldr->bcp47_currencies( code => 'JPY' );
# Filtering based on obsolete status: 1 = true, 0 = false
my $array_ref = $cldr->bcp47_currencies( is_obsolete => 1 );
Returns all BCP47 currencies information from table bcp47_currencies as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
codeAn ISO4217 currency code, such as
JPYis_obsoleteA boolean value. Use 1 for
trueand 0 forfalse
bcp47_extension
my $ref = $cldr->bcp47_extension( extension => 'ca' );
# Returns an hash reference like this:
{
bcp47_ext_id => 1,
category => 'calendar',
extension => 'ca',
alias => 'calendar',
value_type => 'incremental',
description => 'Calendar algorithm key',
}
Returns an hash reference of a BCP47 extension information from the table bcp47_extensions for a given BCP47 extension.
The meaning of the fields are as follows:
bcp47_ext_idA unique incremental value automatically generated by SQLite.
categoryA string representing a BCP47 extension category.
Known values are:
calendar,collation,currency,measure,number,segmentation,timezone,transform,transform_destination,transform_hybrid,transform_ime,transform_keyboard,transform_mt,transform_private_use,variantextensionA short string representing a BCP47 extension.
Known values are:
ca,cf,co,cu,d0,dx,em,fw,h0,hc,i0,k0,ka,kb,kc,kf,kh,kk,kn,kr,ks,kv,lb,lw,m0,ms,mu,nu,rg,s0,sd,ss,t0,tz,va,vt,x0aliasA string representing an alias for this extension.
Known values are:
undef,calendar,colAlternate,colBackwards,colCaseFirst,colCaseLevel,colHiraganaQuaternary,collation,colNormalization,colNumeric,colReorder,colStrength,currency,hours,measure,numbers,timezone,variableTopvalue_typeA string representing a value type.
Known values are:
undef,any,incremental,multiple,singledescriptionA text providing a description for this BCP47 extension.
bcp47_extensions
my $array_ref = $cldr->bcp47_extensions;
# Filter based on the 'extension' field value
my $array_ref = $cldr->bcp47_extensions( extension => 'ca' );
# Filter based on the 'deprecated' field value; 1 = true, 0 = false
my $array_ref = $cldr->bcp47_extensions( deprecated => 0 );
Returns all BCP47 extensions information from table bcp47_extensions as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
deprecatedA boolean value. Use 1 for
trueand 0 forfalseextensionA BCP47 extension, such as
ca,cf,co,cu,d0,dx,em,fw,h0,hc,i0,k0,ka,kb,kc,kf,kh,kk,kn,kr,ks,kv,lb,lw,m0,ms,mu,nu,rg,s0,sd,ss,t0,tz,va,vt,x0
bcp47_timezone
my $ref = $cldr->bcp47_timezone( tzid => 'jptyo' );
# Returns an hash reference like this:
{
bcp47_tz_id => 215,
tzid => 'jptyo',
alias => ["Asia/Tokyo", "Japan"],
preferred => undef,
description => 'Tokyo, Japan',
deprecated => undef,
}
Returns an hash reference of a BCP47 timezone information from the table bcp47_timezones for a given BCP47 timezone ID tzid.
The meaning of the fields are as follows:
bcp47_tz_idA unique incremental value automatically generated by SQLite.
tzidA string representing a BCP47 timezone ID.
aliasAn array of IANA Olson timezones
preferredAn string representing a preferred BCP47 timezone ID in lieu of the current one.
This is mostly
undefdescriptionA text describing the BCP47 timezone
deprecatedA boolean value defining whether this timezone is deprecated or not. Defaults to false.
bcp47_timezones
my $array_ref = $cldr->bcp47_timezones;
# Filter based on the 'deprecated' field value; 1 = true, 0 = false
my $array_ref = $cldr->bcp47_timezones( deprecated => 0 );
Returns all BCP47 timezones information from table bcp47_timezones as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
deprecatedA boolean value. Use 1 for
trueand 0 forfalse
bcp47_value
my $ref = $cldr->bcp47_value( value => 'japanese' );
# Returns an hash reference like this:
{
bcp47_value_id => 16,
category => 'calendar',
extension => 'ca',
value => 'japanese',
description => 'Japanese Imperial calendar',
}
Returns an hash reference of a BCP47 value information from the table bcp47_values for a given BCP47 value.
The meaning of the fields are as follows:
bcp47_value_idA unique incremental value automatically generated by SQLite.
categoryA string representing a BCP47 value category.
Known values are:
calendar,collation,currency,measure,number,segmentation,timezone,transform,transform_destination,transform_hybrid,transform_ime,transform_keyboard,transform_mt,transform_private_use,variantextensionA short string representing a BCP47 extension.
Known values are:
ca,cf,co,cu,d0,dx,em,fw,h0,hc,i0,k0,ka,kb,kc,kf,kh,kk,kn,kr,ks,kv,lb,lw,m0,ms,mu,nu,rg,s0,sd,ss,t0,tz,va,vt,x0valuePossible value for the current BCP47 extension. One
extensionmay have multiple possible values.descriptionA text describing the BCP47 extension value.
bcp47_values
my $array_ref = $cldr->bcp47_values;
# Filter based on the 'category' field value
my $array_ref = $cldr->bcp47_timezones( category => 'calendar' );
# Filter based on the 'extension' field value
my $array_ref = $cldr->bcp47_timezones( extension => 'ca' );
Returns all BCP47 values information from table bcp47_values as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
categoryA BCP47 category ID, such as
calendar,collation,currency,measure,number,segmentation,timezone,transform_destination,transform,transform_hybrid,transform_ime,transform_keyboard,transform_mt,transform_private_use,variantextensionA BCP47 extension ID, such as
ca,cf,co,cu,d0,dx,em,fw,h0,hc,i0,k0,ka,kb,kc,kf,kh,kk,kn,kr,ks,kv,lb,lw,m0,ms,mu,nu,rg,s0,sd,ss,t0,tz,va,vt,x0
calendar
my $ref = $cldr->calendar( calendar => 'gregorian' );
# Returns an hash reference like this:
{
calendar_id => 1,
calendar => 'gregorian',
system => 'solar',
inherits => undef,
description => undef,
}
Returns an hash reference of a calendar information from the table calendars for a given calendar value.
The meaning of the fields are as follows:
calendar_idA unique incremental value automatically generated by SQLite.
calendarA string representing a
calendarID.Known calendar IDs are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,iso8601,japanese,persian,rocsystemA string representing a
calendarsystem.Known values are:
undef,lunar,lunisolar,other,solarinheritsA string representing the
calendarID from which this calendar inherits from.Currently, the only one known to use this is the
japanesecalendar inheriting from thegregoriancalendar.descriptionA text describing the
calendar
calendars
my $array_ref = $cldr->calendars;
# Known 'system' value: undef, lunar, lunisolar, other, solar
my $array_ref = $cldr->calendars( system => 'solar' );
my $array_ref = $cldr->calendars( inherits => 'gregorian' );
Returns all calendar information from table calendars as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
inheritsA calendar system this calendar inherits from, such as the Japanese calendar.
systemA calendar system, such as
lunar,lunisolar,other,solar
calendar_append_format
my $ref = $cldr->calendar_append_format(
locale => 'en',
calendar => 'gregorian',
format_id => 'Day',
);
# Returns an hash reference like this:
{
cal_append_fmt_id => 12,
locale => 'en',
calendar => 'gregorian',
format_id => 'Day',
format_pattern => '{0} ({2}: {1})',
}
Returns an hash reference of a calendar localised append format information from the table calendar_append_formats for a given format ID format_id, locale ID and calendar ID.
The meaning of the fields are as follows:
cal_append_fmt_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,japanese,persian,rocformat_idA string representing a format ID.
Known values are:
Day,Day-Of-Week,Era,Hour,Minute,Month,Quarter,Second,Timezone,Week,Yearformat_patternA string representing the localised format pattern.
See the LDML specifications for more information.
calendar_append_formats
my $array_ref = $cldr->calendar_append_formats;
# Filter based on the 'locale' field value
my $array_ref = $cldr->calendar_append_formats( locale => 'en' );
# Filter based on the 'calendar' field value
my $array_ref = $cldr->calendar_append_formats( calendar => 'gregorian' );
# or a combination of those two:
my $array_ref = $cldr->calendar_append_formats(
locale => 'en',
calendar => 'gregorian'
);
Returns all calendar appended formats information from table calendar_append_formats as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
calendarA
calendarID as can be found in table calendars, such as:buddhist,chinese,coptic,dangi,ethioaa,ethiopic,gregory,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,islamicc,iso8601,japanese,persian,roclocaleA
locale, such asenorja-JPas can be found in table locales
See also the method l10n
calendar_available_format
my $ref = $cldr->calendar_available_format(
locale => 'en',
calendar => 'gregorian',
format_id => 'Hms',
# optional
count => undef,
# optional
alt => undef,
);
# Returns an hash reference like this:
{
cal_avail_fmt_id => 2662,
locale => 'en',
calendar => 'gregorian',
format_id => 'Hms',
format_pattern => 'HH:mm:ss',
count => undef,
alt => undef,
}
Returns an hash reference of a calendar localised available format information from the table calendar_available_formats for a given format ID format_id, calendar ID and a locale ID.
The meaning of the fields are as follows:
cal_avail_fmt_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,japanese,persian,rocformat_idA string representing a format ID.
There are currently 107 known and distinct format IDs.
format_patternA string representing a localised format pattern.
countAn optional string used to differentiate identical patterns.
Known values are:
undef,few,many,one,other,two,zeroaltAn optional string used to provide alternative patterns.
Known values are:
undef,ascii,variant
See the LDML specifications for more informations.
calendar_available_formats
my $array_ref = $cldr->calendar_available_formats;
# Filter based on the 'locale' field value
my $array_ref = $cldr->calendar_available_formats( locale => 'en' );
# Filter based on the 'calendar' field value
my $array_ref = $cldr->calendar_available_formats( calendar => 'gregorian' );
# or a combination of those two:
my $array_ref = $cldr->calendar_available_formats(
locale => 'en',
calendar => 'gregorian',
);
Returns all calendar available formats information from table calendar_available_formats as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
calendarA
calendarID as can be found in table calendars, such as:buddhist,chinese,coptic,dangi,ethioaa,ethiopic,gregory,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,islamicc,iso8601,japanese,persian,roclocaleA
locale, such asenorja-JPas can be found in table locales
See also the method l10n
calendar_cyclic_l10n
my $ref = $cldr->calendar_cyclic_l10n(
locale => 'und',
calendar => 'chinese',
format_set => 'dayParts',
format_type => 'format',
format_length => 'abbreviated',
format_id => 1,
);
# Returns an hash reference like this:
{
cal_int_fmt_id => 1014,
locale => 'und',
calendar => 'chinese',
format_set => 'dayParts',
format_type => 'format',
format_length => 'abbreviated',
format_id => 1,
format_pattern => 'zi',
}
Returns an hash reference of a calendar cyclic localised information from the table calendar_cyclics_l10n for a given format ID format_id, ID a locale ID, a calendar ID, a format set format_set, a format type format_type and a format length format_length.
This is typical of calendars such as: chinese and dangi
The meaning of the fields are as follows:
cal_int_fmt_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,japanese,persian,rocformat_setA format set. Known values are:
dayParts,days,months,solarTerms,years,zodiacsformat_typeA format type. The only known value is
formatformat_lengthA format length.
Known values are;
abbreviated,narrow,wideformat_idA string representing a format ID.
format_patternA string representing a localised pattern.
See the LDML specifications for more information.
calendar_cyclics_l10n
my $all = $cldr->calendar_cyclics_l10n;
my $all = $cldr->calendar_cyclics_l10n( locale => 'en' );
my $all = $cldr->calendar_cyclics_l10n(
locale => 'en',
calendar => 'chinese',
format_set => 'dayParts',
# Not really needed since 'format' is the only value being currently used
# format_type => 'format',
format_length => 'abbreviated',
);
Returns all calendar cyclic localised formats information from table calendar_cyclics_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
calendarA
calendarID as can be found in table calendars, such as:buddhist,chinese,coptic,dangi,ethioaa,ethiopic,gregory,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,islamicc,iso8601,japanese,persian,roclocaleA
locale, such asenorja-JPas can be found in table localesformat_setA string representing a format set.
Known values are:
dayParts,days,months,solarTerms,years,zodiacsformat_typeA format type. The only known value is
formatformat_lengthA format length.
Known values are;
abbreviated,narrow,wide
calendar_datetime_format
my $ref = $cldr->calendar_datetime_format(
locale => 'en',
calendar => 'gregorian',
format_length => 'full',
format_type => 'atTime',
);
# Returns an hash reference like this:
{
cal_dt_fmt_id => 434,
locale => 'en',
calendar => 'gregorian',
format_length => 'full',
format_type => 'atTime',
format_pattern => "{1} 'at' {0}",
}
Returns an hash reference of a calendar localised datetime format information from the table calendar_datetime_formats for a given locale ID, calendar ID, format_length, and format_type.
The meaning of the fields are as follows:
cal_dt_fmt_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,japanese,persian,rocformat_lengthA string representing a format length.
Known values are:
full,long,medium,shortformat_typeA string representing a format type.
Known values are:
atTime,standardformat_patternA string representing a localised datetime format pattern according to the format type and
locale
calendar_datetime_formats
my $array_ref = $cldr->calendar_datetime_formats;
# Filter based on the 'locale' field value
my $array_ref = $cldr->calendar_datetime_formats( locale => 'en' );
# Filter based on the 'calendar' field value
my $array_ref = $cldr->calendar_datetime_formats( calendar => 'gregorian' );
# or a combination of those two:
my $array_ref = $cldr->calendar_datetime_formats(
locale => 'en',
calendar => 'gregorian',
);
Returns all calendar datetime formats information from table calendar_datetime_formats as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
calendarA
calendarID as can be found in table calendars, such as:buddhist,chinese,coptic,dangi,ethioaa,ethiopic,gregory,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,islamicc,iso8601,japanese,persian,roclocaleA
locale, such asenorja-JPas can be found in table locales
See also the method l10n
calendar_era_l10n
my $ref = $cldr->calendar_era_l10n(
locale => 'ja',
calendar => 'gregorian',
era_width => 'abbreviated',
alt => undef,
era_id => 0,
);
# Returns an hash reference like this:
{
cal_era_l10n_id => 2844,
locale => 'ja',
calendar => 'gregorian',
era_width => 'abbreviated',
era_id => 0,
alt => undef,
locale_name => '紀元前',
}
Returns an hash reference of a calendar era information from the table calendar_eras_l10n for a given calendar value, a locale, a era_width, and a era_id. If no alt value is provided, it will default to undef
The meaning of the fields are as follows:
cal_era_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values used are:
buddhist,coptic,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,japanese,persian,rocera_widthAn era width.
Known values are:
abbreviated,narrow,wideera_idA string representing an era ID. This is actually always an integer with minimum value of
0and maximum value of99altA string to provide an alternative value for an era with the same ID.
locale_nameA string providing with a localised name for this era for the current
locale
calendar_eras_l10n
my $array_ref = $cldr->calendar_eras_l10n;
# Filter based on the 'locale' field value
my $array_ref = $cldr->calendar_eras_l10n( locale => 'en' );
# Filter based on the 'calendar' field value
my $array_ref = $cldr->calendar_eras_l10n( calendar => 'gregorian' );
# or a combination of multiple fields:
my $array_ref = $cldr->calendar_eras_l10n(
locale => 'en',
calendar => 'gregorian',
era_width => 'abbreviated',
alt => undef
);
Returns all calendar localised eras information from table calendar_eras_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
altThe alternative value, if any, which may be
variantorundef, i.e., no value.calendarA
calendarID as can be found in table calendars, such as:buddhist,chinese,coptic,dangi,ethioaa,ethiopic,gregory,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,islamicc,iso8601,japanese,persian,rocera_widthPossible values are:
abbreviated,narrow,widelocaleA
locale, such asenorja-JPas can be found in table locales
See also the method l10n
calendar_format_l10n
my $ref = $cldr->calendar_format_l10n(
locale => 'ja',
calendar => 'gregorian',
# date, time
format_type => 'date',
# full, long, medium, short
format_length => 'full',
);
# Returns an hash reference like this:
{
cal_fmt_l10n_id => 906,
locale => 'ja',
calendar => 'gregorian',
format_type => 'date',
format_length => 'full',
alt => undef,
format_id => 'yMEEEEd',
format_pattern => 'y年M月d日EEEE',
}
Returns an hash reference of a calendar format information from the table calendar_formats_l10n for a given calendar value, a locale, a format_type, and a format_length.
The meaning of the fields are as follows:
cal_fmt_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,japanese,persian,rocformat_typeA string representing a format type.
Possible values are:
dateortimeformat_lengthA string representing a format length.
Known values are:
full,long,medium,shortaltA string to provide an alternative value for a format with the same ID.
format_idA string representing a format ID.
format_patternA string representing a localised pattern.
calendar_formats_l10n
my $array_ref = $cldr->calendar_formats_l10n;
# Filter based on the 'locale' field value
my $array_ref = $cldr->calendar_formats_l10n( locale => 'en' );
# Filter based on the 'calendar' field value
my $array_ref = $cldr->calendar_formats_l10n( calendar => 'gregorian' );
# or a combination of multiple fields:
my $array_ref = $cldr->calendar_formats_l10n(
locale => 'en',
calendar => 'gregorian',
format_type => 'date',
format_length => 'full',
);
Returns all calendar localised date and time formats information from table calendar_formats_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
calendarA
calendarID as can be found in table calendars, such as:buddhist,chinese,coptic,dangi,ethioaa,ethiopic,gregory,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,islamicc,iso8601,japanese,persian,rocformat_lengthPossible values are:
full,long,medium,shortformat_typeThe format type, which may be
dateortimelocaleA
locale, such asenorja-JPas can be found in table locales
See also the method l10n
calendar_interval_format
my $ref = $cldr->calendar_interval_format(
locale => 'en',
calendar => 'gregorian',
greatest_diff_id => 'd',
format_id => 'GyMMMEd',
alt => undef,
);
# Returns an hash reference like this:
{
cal_int_fmt_id => 3846,
locale => 'en',
calendar => 'gregorian',
format_id => 'GyMMMEd',
greatest_diff_id => 'd',
format_pattern => 'E, MMM d – E, MMM d, y G',
alt => undef,
part1 => 'E, MMM d',
separator => ' – ',
part2 => 'E, MMM d, y G',
repeating_field => 'E, MMM d',
}
Returns an hash reference of a calendar localised interval information from the table calendar_interval_formats for a given calendar ID and a locale ID. If no alt value is provided, it will default to undef
Pay particular attention to the fields part1, separator and part2 that are designed to greatly make it easy for you to format and use the interval format pattern.
Without those special fields, it would not be possible to properly format an interval.
The meaning of the fields are as follows:
cal_int_fmt_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,japanese,persian,rocformat_idA string representing a format ID.
greatest_diff_idA string representing an ID, itself representing the interval greatest difference
format_patternA string representing a localised pattern.
altA string representing an alternative value.
part1This is the first part of the interval format.
separatorThis is the string representing the separator between the first and second part.
part2This is the second part of the interval format.
repeating_fieldThis is the repeating field that was computed when building this database.
This, along with the
part1,separatorandpart2are designed to make it easier for you to format the interval.
See LDML specifications for more information.
calendar_interval_formats
my $array_ref = $cldr->calendar_interval_formats;
# Filter based on the 'locale' field value
my $array_ref = $cldr->calendar_interval_formats( locale => 'en' );
# Filter based on the 'calendar' field value
my $array_ref = $cldr->calendar_interval_formats( calendar => 'gregorian' );
# or a combination of those two:
my $array_ref = $cldr->calendar_interval_formats(
locale => 'en',
calendar => 'gregorian',
);
Returns all calendar interval formats information from table calendar_interval_formats as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
calendarA
calendarID as can be found in table calendars, such as:buddhist,chinese,coptic,dangi,ethioaa,ethiopic,gregory,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,islamicc,iso8601,japanese,persian,roclocaleA
locale, such asenorja-JPas can be found in table localesgreatest_diff_idA string representing an ID, itself representing the interval greatest difference
See also the method l10n
calendar_l10n
my $ref = $cldr->calendar_l10n(
locale => 'en',
caendar => 'japanese',
);
# Returns an hash reference like:
{
calendar_l10n_id => 506,
locale => 'en',
calendar => 'japanese',
locale_name => 'Japanese Calendar',
}
Returns an hash reference of a calendar localised information from the table calendars_l10n for a given locale ID, and calendar ID.
The meaning of the fields are as follows:
calendar_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,japanese,persian,roclocale_nameA string representing the localised name of the calendar.
calendars_l10n
my $all = $cldr->calendars_l10n;
my $all = $cldr->calendars_l10n(
locale => 'en',
);
Returns all calendar localised information from table calendars_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table locales
calendar_term
my $ref = $cldr->calendar_term(
locale => 'und',
calendar => 'gregorian',
# format, stand-alone
term_context => 'format',
# abbreviated, narrow, wide
term_width => 'abbreviated',
term_name => 'am',
);
# Returns an hash reference like:
{
cal_term_id => 23478,
locale => 'und',
calendar => 'gregorian',
term_type => 'day_period',
term_context => 'format',
term_width => 'abbreviated',
alt => undef,
yeartype => undef,
term_name => 'am',
term_value => 'AM',
}
Returns an hash reference of a calendar term information from the table calendar_terms for a given locale, calendar, term_context, term_width, term_name value, alt and yeartype value. If no alt or yeartype value is provided, it will default to undef
You can also query for multiple value at the same time, and this will return an array reference of hash reference instead:
my $all = $cldr->calendar_term(
locale => 'und',
calendar => 'gregorian',
# format, stand-alone
term_context => 'format',
# abbreviated, narrow, wide
term_width => 'abbreviated',
term_name => [qw( am pm )],
);
# Returns an array reference like:
[
{
cal_term_id => 23478,
locale => 'und',
calendar => 'gregorian',
term_type => 'day_period',
term_context => 'format',
term_width => 'abbreviated',
alt => undef,
yeartype => undef,
term_name => 'am',
term_value => 'AM',
},
{
cal_term_id => 23479,
locale => 'und',
calendar => 'gregorian',
term_type => 'day_period',
term_context => 'format',
term_width => 'abbreviated',
alt => undef,
yeartype => undef,
term_name => 'pm',
term_value => 'PM',
},
]
See the section on "Advanced Search" for more information.
The meaning of the fields are as follows:
cal_term_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescalendarA
calendarID as can be found in the table calendarsKnown values are:
buddhist,chinese,coptic,dangi,ethiopic,ethiopic-amete-alem,generic,gregorian,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,japanese,persian,rocterm_typeA string representing a term type.
Known values are:
day,day_period,month,quarterterm_contextA string representing a term context.
Known values are:
format,stand-aloneterm_widthA string representing a term width.
Known values are:
abbreviated,narrow,short,widealtA string to provide an alternate representation of a term.
yeartypeA string to provide an alternate representation of a term when this is a leap year.
The usual value for this is
leapterm_nameA string representing a term name.
Known values are:
1,2,3,4,5,6,7,8,9,10,11,12,13,afternoon1,afternoon2,evening1,evening2,midnight,morning1,morning2,night1,night2,noon,am,pm,mon,tue,wed,thu,fri,sat,sunterm_valueA string representing the term value.
See also the Unicode LDMD specifications
calendar_terms
my $array_ref = $cldr->calendar_terms;
my $array_ref = $cldr->calendar_terms(
locale => 'und',
calendar => 'japanese'
);
my $array_ref = $cldr->calendar_terms(
locale => 'und',
calendar => 'gregorian',
term_type => 'day',
term_context => 'format',
term_width => 'abbreviated',
);
Returns all calendar terms information from table calendar_terms as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
calendarA
calendarID as can be found in table calendars, such as:buddhist,chinese,coptic,dangi,ethioaa,ethiopic,gregory,hebrew,indian,islamic,islamic-civil,islamic-rgsa,islamic-tbla,islamic-umalqura,islamicc,iso8601,japanese,persian,roclocaleA
locale, such asenorja-JPas can be found in table locales
See also the Unicode LDMD specifications
casing
my $ref = $cldr->casing( locale => 'fr', token => 'currencyName' );
# Returns an hash reference like:
{
casing_id => 926,
locale => 'fr',
token => 'currencyName',
value => 'lowercase',
}
Returns an hash reference of a calendar information from the table casings for a given token value.
The meaning of the fields are as follows:
casing_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localestokenKnown values are:
calendar_field,currencyName,currencyName_count,day_format_except_narrow,day_narrow,day_standalone_except_narrow,era_abbr,era_name,era_narrow,key,keyValue,language,metazone_long,month_format_except_narrow,month_narrow,month_standalone_except_narrow,quarter_abbreviated,quarter_format_wide,quarter_narrow,quarter_standalone_wide,relative,script,symbol,territory,unit_pattern,variant,zone_exemplarCity,zone_long,zone_shortvalueA casing value.
casings
my $all = $cldr->casings;
my $all = $cldr->casings( locale => 'fr' );
Returns all casing information from table casings as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table locales
cldr_built
my $datetime = $cldr->cldr_built; # 2024-07-01T05:57:29
Return the ISO8601 datetime in GMT of when this data were built.
Note, this is just a string, not a DateTime object. If you want a DateTime object, maybe do something like:
use DateTime::Format::Strptime;
my $fmt = DateTime::Format::Strptime->new( pattern => '%FT%T' );
my $dt = $fmt->parse_datetime( $cldr->cldr_built );
cldr_maintainer
my $str = $cldr->cldr_maintainer; # Jacques Deguest
Returns a string representing the name of the person who created this SQLite database of CLDR data.
cldr_version
my $version = $cldr->cldr_version; # 45.0
Return the Unicode CLDR version number of the data.
Note, this is just a string. You may want to turn it into an object for comparison, such as:
use version;
my $vers = version->parse( $cldr->cldr_version );
Or, maybe:
use Changes::Version;
my $vers = Changes::Version->new( $cldr->cldr_version );
say $vers > $other_version;
code_mapping
my $ref = $cldr->code_mapping( code => 'US' );
# Returns an hash reference like:
{
code_mapping_id => 263,
code => 'US',
alpha3 => 'USA',
numeric => 840,
fips10 => undef,
type => 'territory',
}
Returns an hash reference of a code mapping information from the table code_mappings for a given code value.
The meaning of the fields are as follows:
code_mapping_idA unique incremental value automatically generated by SQLite.
codeA
codefor which there is a mapping with other American standardsalpha3A 3-characters code
numericA numeric code
fips10An American standard
typeThe mapping
type
code_mappings
my $all = $cldr->code_mappings;
my $all = $cldr->code_mappings( type => 'territory' );
my $all = $cldr->code_mappings( type => 'currency' );
my $all = $cldr->code_mappings( alpha3 => 'USA' );
my $all = $cldr->code_mappings( numeric => 840 ); # U.S.A.
my $all = $cldr->code_mappings( fips => 'JP' ); # Japan
my $all = $cldr->code_mappings( fips => undef, type => 'currency' );
Returns all code mapping information from table code_mappings as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
alpha3A 3-characters code.
fipsA
fips(U.S. Federal Information Processing Standard) codenumericAn integer code.
typeA
type, such asterritoryorcurrency
collation
my $ref = $cldr->collation(
collation => 'ducet',
);
# Returns an hash reference like this:
{
collation => 'ducet',
description => 'Dictionary style ordering (such as in Sinhala)',
}
Returns an hash reference of a collation information from the table collations for a given collation ID.
The meaning of the fields are as follows:
collationA string representing a
collationID.Known values are:
big5han,compat,dict,direct,ducet,emoji,eor,gb2312,phonebk,phonetic,pinyin,reformed,search,searchjl,standard,stroke,trad,unihan,zhuyindescriptionA short text describing the collation.
collations
my $all = $cldr->collations;
my $all = $cldr->collations( collation => 'ducet' );
my $all = $cldr->collations( description => qr/Chinese/ );
Returns all collations information from table collations as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
collationA
collationIDdescriptionA short text describing the collation.
See the section on "Advanced Search"
collation_l10n
my $ref = $cldr->collation_l10n(
collation => 'ducet',
locale => 'en',
);
# Returns an hash reference like this:
{
collation_l10n_id => 323,
locale => 'en',
collation => 'ducet',
locale_name => 'Default Unicode Sort Order',
}
Returns an hash reference of a collation localised information from the table collations_l10n for a given collation ID and a locale ID.
The meaning of the fields are as follows:
collation_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescollationA
collationID as can be found in table collationslocale_nameA short text representing the localised
collationname.
collations_l10n
my $all = $cldr->collations_l10n;
my $all = $cldr->collations_l10n( locale => 'en' );
my $all = $cldr->collations_l10n(
locale => 'en',
collation => 'ducet',
);
Returns all collations information from table collations_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localescollationA
collationID as can be found in table collations
currency
my $ref = $cldr->currency( currency => 'JPY' ); # Japanese Yen
# Returns an hash reference like:
{
currency_id => 133,
currency => 'JPY',
digits => 0,
rounding => 0,
cash_digits => undef,
cash_rounding => undef,
is_obsolete => 0,
status => 'regular',
}
Returns an hash reference of a code mapping information from the table currencies for a given currency code.
The meaning of the fields are as follows:
currency_idA unique incremental value automatically generated by SQLite.
currencyA
currencycodedigitsNumber of fractional digits.
roundingNumber of digits used for rounding.
cash_digitsNumber of fractional digits for money representation.
cash_roundingNumber of digits used for rounding for money representation.
is_obsoleteA boolean defining whether the currency is obsolete.
statusA string representing the status for this currency.
Known values are:
deprecated,regular,unknown
currencies
my $all = $cldr->currencies;
my $all = $cldr->currencies( is_obsolete => 1 );
Returns all currencies information from table currencies as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
is_obsoleteA boolean value. Use 1 for
trueand 0 forfalsestatusValid
statusvalues are, as per the CLDR:regularThis is the default and means the currency is valid.
deprecatedThe currency is deprecated.
unknownThe status is unknown.
currency_info
my $ref = $cldr->currency_info(
currency => 'EUR',
territory' => 'FR',
);
# Returns an hash reference like this:
{
currency_info_id => 165,
territory => 'FR',
currency => 'EUR',
start => '1999-01-01',
until => undef,
is_tender => 0,
hist_sequence => undef,
is_obsolete => 0,
}
Returns an hash reference of a currency information from the table currencies_info for a given ]locale ID.
The meaning of the fields are as follows:
currency_info_idA unique incremental value automatically generated by SQLite.
territoryA 2-to-3 characters string representing the territory code, which may be either 2-characters uppercase alphabet, or 3-digits code representing a world region.
currencyA 3-characters currency code.
startThe date at which this currency started to be in use for this
territory.untilThe date at which this currency stopped being in use for this
territory.is_tenderWhether this currency was a legal tender, i.e. whether it bore the force of law to settle a public or private debt or meet a financial obligation.
hist_sequenceInteger representing the historical order.
CLDRuses the attributestzand thento-tzto link to following historical record when the oldtodate overlaps the newfromdate. Example: territorySXis_obsoleteA boolean value expressing whether this currency is obsolete or not.
See the LDML specifications for more information.
currencies_info
my $all = $cldr->currencies_info;
my $all = $cldr->currencies_info( territory => 'FR' );
my $all = $cldr->currencies_info( currency => 'EUR' );
Returns all currencies information from table currencies_info as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
territoryA 2-characters code representing a
territoryas can be found in table territoriescurrencyA 3-characters code representing a
currencyas can be found in table currencies
currency_l10n
my $ref = $cldr->currency_l10n(
locale => 'en',
count => undef,
currency => 'JPY',
);
# Returns an hash reference like this:
{
curr_l10n_id => 20924,
locale => 'en',
currency => 'JPY',
count => undef,
locale_name => 'Japanese Yen',
symbol => '¥',
}
Returns an hash reference of a currency localised information from the table currencies_l10n for a given currency ID, locale ID and count value. If no count value is provided, it will default to undef
The meaning of the fields are as follows:
curr_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localescurrencyA
currencyID as can be found in the table currenciesNote that the values used by the
CLDRals includes currencies that are deprecated in ISO 4217 standard.countA string that specifies a distinctive value.
Known values are:
undef,few,many,one,other,two,zeroFor example, with the
EURcurrencyinlocaleen, here are the possiblecountvalues and its associated localised string representation.undefEuro
oneeuro
othereuros
And here with the
JPYcurrencyandlocalepl:undefjen japoński
fewjeny japońskie
manyjenów japońskich
onejen japoński
otherjena japońskiego
See the LDML specifications about language plural rules for more information.
locale_nameA string representing a localised currency name based on the value of
locale.symbolAn optional
currencysymbol.
currencies_l10n
my $all = $cldr->currencies_l10n;
my $all = $cldr->currencies_l10n( locale => 'en' );
my $all = $cldr->currencies_l10n(
locale => 'en',
currency => 'JPY',
);
Returns all currencies localised information from table currencies_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localescountA string representing a distinctive
countfor thecurrencyKnown values are:
undef,few,many,one,other,two,zeroSee the LDML specifications about language plural rules for more information.
currencyA 3-characters
currencyID as can be found in the table currencies
database_handler
Returns the current database handler used by the Locale::Unicode::Data object instantiated.
Please note that the database is opened in read-only. If you want to modify it, which I would advise against, you need to instantiate your own DBI connection. Something like this:
my $db_file = $cldr->datafile;
$dbh = DBI->connect( "dbi:SQLite:dbname=${db_file}", '', '' ) ||
die( "Unable to make connection to Unicode CLDR SQLite database file ${db_file}: ", $DBI::errstr );
# To enable foreign keys:
# See: <https://metacpan.org/release/ADAMK/DBD-SQLite-1.27/view/lib/DBD/SQLite.pm#Foreign-Keys>
$dbh->do("PRAGMA foreign_keys = ON");
datafile
Sets or gets the file path to the SQLite database file. This defaults to the global variable $DB_FILE
date_field_l10n
my $ref = $cldr->date_field_l10n(
locale => 'en',
field_type => 'day',
field_length => 'narrow',
relative => -1,
);
# Returns an hash reference like this:
{
date_field_id => 2087,
locale => 'en',
field_type => 'day',
field_length => 'narrow',
relative => -1,
locale_name => 'yesterday',
}
Returns an hash reference of a field localised information from the table date_fields_l10n for a given locale ID, field_type, field_length and relative value.
The meaning of the fields are as follows:
date_field_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesfield_typeA string representing a field type.
Known values are:
day,fri,hour,minute,mon,month,quarter,sat,second,sun,thu,tue,wed,week,yearfield_lengthA string representing a field length.
Known values are:
narrow,short,standardrelativeAn integer representing the relative value of the field. For example,
0being today,-1being a day period preceding the current one, and1being a day period following the current one.Known values are:
-2,-1,0,1,2,3locale_nameA string containing the localised date field based on the
locale
See the LDML specifications for more information.
date_fields_l10n
my $all = $cldr->date_fields_l10n;
my $all = $cldr->date_fields_l10n( locale => 'en' );
my $all = $cldr->date_fields_l10n(
locale => 'en',
field_type => 'day',
field_length => 'narrow',
);
Returns all date fields localised information from table date_fields_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localesfield_typeA string representing a field type.
Known values are:
day,fri,hour,minute,mon,month,quarter,sat,second,sun,thu,tue,wed,week,yearfield_lengthA string representing a field length.
Known values are:
narrow,short,standard
date_term
my $ref = $cldr->date_term(
locale => 'en',
term_type => 'day',
term_length => 'narrow',
);
# Returns an hash reference like this:
{
date_term_id => 2087,
locale => 'en',
term_type => 'day',
term_length => 'narrow',
display_name => 'day',
}
Returns an hash reference of a date term localised information from the table date_terms for a given locale ID, term_type, and term_length value.
The meaning of the fields are as follows:
date_term_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesterm_typeA string representing a field type.
Known values are:
day,fri,hour,minute,mon,month,quarter,sat,second,sun,thu,tue,wed,week,yearterm_lengthA string representing a field length.
Known values are:
narrow,short,standarddisplay_nameThe localised string value for the
term_typeFor example,
hourfor the localeja(Japanese) would be時
See the LDML specifications for more information.
See also the method date_field_l10n
date_terms
my $all = $cldr->date_terms;
my $all = $cldr->date_terms( locale => 'en' );
my $all = $cldr->date_terms(
locale => 'en',
term_type => 'day',
term_length => 'narrow',
);
Returns all date terms localised information from table date_terms as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localesterm_typeA string representing a field type.
Known values are:
day,fri,hour,minute,mon,month,quarter,sat,second,sun,thu,tue,wed,week,yearterm_lengthA string representing a field length.
Known values are:
narrow,short,standard
See also the method date_fields_l10n
day_period
my $ref = $cldr->day_period( locale => 'fr', day_period => 'noon' );
# Returns an hash reference like:
{
day_period_id => 115,
locale => 'fr',
day_period => 'noon',
start => '12:00',
until => '12:00',
}
Returns an hash reference of a day period information from the table day_periods for a given locale code and day_period code.
The meaning of the fields are as follows:
day_period_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesday_periodA string representing a day period.
Known values are:
afternoon1,afternoon2,am,evening1,evening2,midnight,morning1,morning2,night1,night2,noon,pmstartA time from which this day period starts.
Known values go from
00:00until23:00untilA time by which this day period stops.
Known values go from
00:00until24:00
day_periods
my $all = $cldr->day_periods;
my $all = $cldr->day_periods( locale => 'ja' );
# Known values for day_period: afternoon1, afternoon2, am, evening1, evening2,
# midnight, morning1, morning2, night1, night2, noon, pm
my $all = $cldr->day_periods( day_period => 'noon' );
Returns all day periods information from table day_periods as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
day_periodA token representing a day period. Valid tokens are:
afternoon1,afternoon2,am,evening1,evening2,midnight,morning1,morning2,night1,night2,noon,pmlocaleA
locale, such asenorja-JPas can be found in table locales
decode_sql_arrays
my $bool = $cldr->decode_sql_arrays;
$cldr->decode_sql_arrays(0); # off
$cldr->decode_sql_arrays(1); # on
Sets or gets the boolean value used to specify whether you want this API to automatically decode SQL arrays into perl arrays using JSON::XS
This is set to true by default, upon object instantiation.
extend_timezones_cities
my $bool = $cldr->extend_timezones_cities;
$cldr->extend_timezones_cities(0); # off
$cldr->extend_timezones_cities(1); # on
Sets or gets the boolean value used to specify whether you want to use the time zones cities extended data, if any were added, or not.
To add the time zones cities extended data, see the Unicode CLDR SQLite database script option --extended-timezones-cities
Normally, this SQLite database comes by default with an extended set of time zones cities data for 421 time zones and their main city across 88 locales, courtesy of the GeoNames database, and online work the author of this distribution has performed.
See also the method timezone_city and timezones_cities
This is set to true by default, upon object instantiation.
error
Used as a mutator, this sets and exception object and returns an Locale::Unicode::NullObject in object context (such as when chaining), or undef in scalar context, or an empty list in list context.
The Locale::Unicode::NullObject class prevents the perl error of Can't call method "%s" on an undefined value (see perldiag). Upon the last method chained, undef is returned in scalar context or an empty list in list context.
For example:
my $locale = Locale::Unicode->new( 'ja' );
$locale->translation( 'my-software' )->transform_locale( $bad_value )->tz( 'jptyo' ) ||
die( $locale->error );
In this example, jptyo will never be set, because transform_locale triggered an exception that returned an Locale::Unicode::NullObject object catching all further method calls, but eventually we get the error and die.
fatal
$cldr->fatal(1); # Enable fatal exceptions
$cldr->fatal(0); # Disable fatal exceptions
my $bool = $cldr->fatal;
Sets or get the boolean value, whether to die upon exception, or not. If set to true, then instead of setting an exception object, this module will die with an exception object. You can catch the exception object then after using try. For example:
use v.5.34; # to be able to use try-catch blocks in perl
use experimental 'try';
no warnings 'experimental';
try
{
my $cldr = Locale::Unicode::Data->new( fatal => 1 );
# Forgot the 'width':
my $str = $cldr->timezone_names( timezone => 'Asia/Tokyo', locale => 'en' );
}
catch( $e )
{
say "Error occurred: ", $e->message;
# Error occurred: No value for width was provided.
}
interval_formats
my $ref = $cldr->interval_formats(
locale => 'en',
calendar => 'gregorian',
);
This would return something like:
{
Bh => [qw( B h )],
Bhm => [qw( B h m )],
d => ["d"],
default => ["default"],
Gy => [qw( G y )],
GyM => [qw( G M y )],
GyMd => [qw( d G M y )],
GyMEd => [qw( d G M y )],
GyMMM => [qw( G M y )],
GyMMMd => [qw( d G M y )],
GyMMMEd => [qw( d G M y )],
H => ["H"],
h => [qw( a h )],
hm => [qw( a h m )],
Hm => [qw( H m )],
hmv => [qw( a h m )],
Hmv => [qw( H m )],
Hv => ["H"],
hv => [qw( a h )],
M => ["M"],
Md => [qw( d M )],
MEd => [qw( d M )],
MMM => ["M"],
MMMd => [qw( d M )],
MMMEd => [qw( d M )],
y => ["y"],
yM => [qw( M y )],
yMd => [qw( d M y )],
yMEd => [qw( d M y )],
yMMM => [qw( M y )],
yMMMd => [qw( d M y )],
yMMMEd => [qw( d M y )],
yMMMM => [qw( M y )],
}
This returns an hash reference of interval format ID with their associated greatest difference token for the given locale ID and calendar ID.
The default interval format pattern is something like {0} – {1}, but this changes depending on the locale and is not always available.
{0} is the placeholder for the first datetime and {1} is the placeholder for the second one.
l10n
Returns all localised information for certain type of data as an array reference of hash reference.
The following core parameters must be provided:
localeThis is mandatory. This is a
locale, such asenorja-JPas can be found in table localestypeA type of data. Valid types are:
annotation,calendar_append_format,calendar_available_format,calendar_cyclic,calendar_era,calendar_format,calendar_interval_formats,calendar_term,casing,currency,date_field,locale,number_format,number_symbol,script,subdivision,territory,unit,variant
Below are each type of data and their associated parameters:
annotationmy $ref = $cldr->l10n( type => 'annotation', locale => 'en', annotation => '{', );Returns an hash reference of a annotation information from the table annotations for a given
localecode andannotationcharacter.calendar_append_formatmy $ref = $cldr->l10n( type => 'calendar_append_format', locale => 'en', calendar => 'gregorian', format_id => 'Day', );Returns an hash reference of a calendar appended format information from the table calendar_append_formats for a given
locale, andcalendarcode and aformat_idID.calendar_available_formatmy $ref = $cldr->l10n( type => 'calendar_available_format', locale => 'ja', calendar => 'japanese', format_id => 'GyMMMEEEEd', );Returns an hash reference of a calendar available format information from the table calendar_available_formats for a given
locale, andcalendarcode and aformat_idID.calendar_cyclicmy $ref = $cldr->l10n( type => 'calendar_cyclic', locale => 'ja', calendar => 'chinese', format_set => 'dayParts', # 1..12 format_id => 1, );Returns an hash reference of a calendar available format information from the table calendar_cyclics_l10n for a given
locale, andcalendarcode and aformat_settoken and aformat_idID.calendar_eramy $ref = $cldr->l10n( type => 'calendar_era', locale => 'ja', calendar => 'japanese', # abbreviated, narrow # 'narrow' contains less data than 'abbreviated' era_width => 'abbreviated', era_id => 236, );Returns an hash reference of a calendar available format information from the table calendar_eras_l10n for a given
locale, andcalendarcode and aera_widthwidth and aera_idID.calendar_formatmy $ref = $cldr->l10n( type => 'calendar_format', locale => 'ja', calendar => 'gregorian', format_id => 'yMEEEEd', );Returns an hash reference of a calendar date or time format information from the table calendar_formats_l10n for a given
locale, andcalendarcode and aformat_idID.calendar_interval_formatmy $ref = $cldr->l10n( type => 'calendar_interval_format', locale => 'ja', calendar => 'gregorian', format_id => 'yMMM', );Returns an hash reference of a calendar interval format information from the table calendar_interval_formats for a given
locale, andcalendarcode and aformat_idID.calendar_termmy $ref = $cldr->l10n( type => 'calendar_term', locale => 'ja', calendar => 'gregorian', term_name => 'mon', );Returns an hash reference of a calendar term information from the table calendar_terms for a given
locale, andcalendarcode and aterm_nametoken.Known term names are:
mon,tue,wed,thu,fri,sat,sun,am,pm,1,2,3,4,5,6,7,8,9,10,11,12,13,midnight,morning1,morning2,noon,afternoon1,afternoon2,evening1,evening2,night1,night2casingmy $ref = $cldr->l10n( type => 'casing', locale => 'fr', token => 'currencyName', );Returns an hash reference of a casing information from the table casings for a given
localecode and atoken.currencymy $ref = $cldr->l10n( type => 'currency', locale => 'ja', currency => 'EUR', );Returns an hash reference of a currency information from the table currencies_l10n for a given
localecode and acurrencycode.date_fieldmy $ref = $cldr->l10n( type => 'date_field', locale => 'ja', # Other possible values: # day, week, month, quarter, year, hour, minute, second, # mon, tue, wed, thu, fri, sat, sun field_type => 'day', # -1 for yesterday, 0 for today, 1 for tomorrow relative => -1, );Returns an hash reference of a date field information from the table date_fields_l10n for a given
locale, and a field typefield_typeandrelativevalue.localemy $ref = $cldr->l10n( type => 'locale', locale => 'ja', locale_id => 'fr', );Returns an hash reference of a locale information from the table locales_l10n for a given
locale, and a locale IDlocale_id.number_formatmy $ref = $cldr->l10n( type => 'number_format', locale => 'ja', number_type => 'currency', format_id => '10000', );Returns an hash reference of a number format from the table number_formats_l10n for a given
locale, a number typenumber_type, and a format IDformat_id.Known value for
number_typeare:currency,decimal,misc,percent,scientificnumber_symbolmy $ref = $cldr->l10n( type => 'number_symbol', locale => 'en', number_system => 'latn', property => 'decimal', );Returns an hash reference of a number symbol information from the table number_symbols_l10n for a given
locale, a number systemnumber_systemas can be found in the table number_systems, and apropertyvalue.scriptmy $ref = $cldr->l10n( type => 'script', locale => 'ja', script => 'Kore', );Returns an hash reference of a script information from the table scripts_l10n for a given
locale, a script valuescriptas can be found in the scripts table.subdivisionmy $ref = $cldr->l10n( type => 'subdivision', locale => 'en', subdivision => 'jp13', # Tokyo );Returns an hash reference of a subdivision information from the table subdivisions_l10n for a given
locale, a subdivision valuesubdivisionas can be found in the subdivisions table.territorymy $ref = $cldr->l10n( type => 'territory', locale => 'en', territory => 'JP', # Japan );Returns an hash reference of a territory information from the table territories_l10n for a given
locale, and aterritorycode as can be found in the territories table.unitmy $ref = $cldr->l10n( type => 'unit', locale => 'en', unit_id => 'power3', );Returns an hash reference of a unit information from the table units_l10n for a given
locale, and aunit_id.variantmy $ref = $cldr->l10n( type => 'variant', locale => 'en', variant => 'valencia', );Returns an hash reference of a variant information from the table variants_l10n for a given
locale, and avariantas can be found in the table variants.
language
my $ref = $cldr->language( language => 'ryu' ); # Central Okinawan (Ryukyu)
# Returns an hash reference like this:
{
language_id => 6712,
language => 'ryu',
scripts => ["Kana"],
territories => ["JPY"],
parent => undef,
alt => undef,
status => 'regular',
}
Returns an hash reference of a language information from the table languages for a given language ID.
The meaning of the fields are as follows:
language_idA unique incremental value automatically generated by SQLite.
languageA
languageID, which may be 2 to 3-characters long.scriptsAn array of
scriptIDs as can be found in the table scripts, and that are associated with thislanguage.territoriesAn array of
territoryIDs as can be found in the table territories, and that are associated with thislanguage.format_patternA string representing a localised pattern.
languages
my $all = $cldr->languages;
my $all = $cldr->languages( parent => 'gmw' );
Returns all languages information from table languages as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
parentA parent
locale, such asenorja-JPas can be found in table localesThe
parentvalue is set in 63% of the languages (over 8,700) in the table languages
language_population
my $all = $cldr->language_population( territory => 'JP' );
# Returns an array reference of hash references like this:
[
{
language_pop_id => 738,
territory => 'JP',
locale => 'ja',
population_percent => 95,
literacy_percent => undef,
writing_percent => undef,
official_status => 'official',
},
{
language_pop_id => 739,
territory => 'JP',
locale => 'ryu',
population_percent => 0.77,
literacy_percent => undef,
writing_percent => 5,
official_status => undef,
},
{
language_pop_id => 740,
territory => 'JP',
locale => 'ko',
population_percent => 0.52,
literacy_percent => undef,
writing_percent => undef,
official_status => undef,
}
]
Returns an array reference of hash references of a language population information from the table language_population for a given territory ID.
The meaning of the fields are as follows:
language_pop_idA unique incremental value automatically generated by SQLite.
territoryA
territorycode as can be found in the table territorieslocaleA
locale, such asenorja-JPas can be found in table localespopulation_percentA percentage of the population as decimal.
literacy_percentA percentage of the population as decimal.
writing_percentA percentage of the population as decimal.
official_statusA string representing the official status for this usage of this
localein thisterritoryKnown values are:
undef,official,official_regional,de_facto_officia
language_populations
my $all = $cldr->language_populations;
my $all = $cldr->language_populations( official_status => 'official' );
Returns all language population information from table language_population as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
official_statusA status string, such as
official,official_regionalorde_facto_official
likely_subtag
my $ref = $cldr->likely_subtag( locale => 'ja' );
# Returns an hash reference like this:
{
likely_subtag_id => 297,
locale => 'ja',
target => 'ja-Jpan-JP',
}
Returns an hash reference for a likely language information from the table likely_subtags for a given locale ID.
The meaning of the fields are as follows:
likely_subtag_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localestargetA string representing the
targetlocale
See the LDML specifications for more information.
likely_subtags
my $all = $cldr->likely_subtags;
Returns all likely subtag information from table likely_subtags as an array reference of hash reference.
No additional parameter is needed.
locale
my $ref = $cldr->locale( locale => 'ja' );
# Returns an hash reference like this:
{
locale_id => 3985,
locale => 'ja',
parent => undef,
collations => ["private-kana", "standard", "unihan"],
status => 'regular',
}
Returns an hash reference of locale information from the table locales for a given locale ID.
The meaning of the fields are as follows:
locale_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesparentThe parent
locale, if any.collationsAn array of
collationID, such as one can find from the table collationsstatusA string representing a status for this
localeKnown values are:
undef,deprecated,private_use,regular,reserved,special,unknown
locales
my $all = $cldr->locales;
Returns all locale information from table locales as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
statusA status string, such as
deprecated,private_use,regular,reserved,special,unknownorundefif none is set.
locale_l10n
my $ref = $cldr->locale_l10n(
locale => 'en',
locale_id => 'ja',
alt => undef,
);
# Returns an hash reference like this:
{
locales_l10n_id => 16746,
locale => 'en',
locale_id => 'ja',
locale_name => 'Japanese',
alt => undef,
}
Returns an hash reference of locale localised information from the table locales_l10n for a given locale ID and a locale_id ID and an alt value. If no alt value is provided, it will default to undef.
The locale value is the language, with possibly some additional subtags, in which the information is provided, and the locale_id the locale id whose name will be returned in the language specified by the locale argument.
Valid locales that can be found in the table locales_l10n are, for example: asa, az-Arab (using a script), be-tarask (using a variant), ca-ES-valencia (using a combination of territory and variant), de-AT (using a territory), es-419 (using a region code)
See Locale::Unicode for more information on locales.
The meaning of the fields are as follows:
locales_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localeslocale_idA
locale, such asenorja-JPas can be found in table localeslocale_nameA string representing the localised name of the
locale_idaccording to thelocalevalue.
locales_l10n
my $all = $cldr->locales_l10n;
# Returns an array reference of all locale information in English
my $all = $cldr->locales_l10n( locale => 'en' );
# Returns an array reference of all the way to write 'Japanese' in various languages
# This would typically return an array reference of something like 267 hash reference
my $all = $cldr->locales_l10n( locale_id => 'ja' );
# This is basically the same as with the method locale_l10n()
my $all = $cldr->locales_l10n(
locale => 'en',
locale_id => 'ja',
alt => undef,
);
Returns all locale localised information from table locales_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
altThis is used to differentiate when alternative values exist.
Known values for
altareundef, i.e. not set, orlong,menu,secondary,short,variantlocaleA
localesuch asenorja-JPas can be found in table localesThis is generally more a
language, i.e. a 2 or 3-characters code than alocalelocale_idA 2 to 3 characters
languageID such asenas can be found in table languages
locales_info
my $ref = $cldr->locales_info(
property => 'quotation_start',
locale => 'ja',
);
# Returns an hash reference like this:
{
locales_info_id => 361,
locale => 'ja',
property => 'quotation_start',
value => '「',
}
Returns an hash reference of locale properties information from the table locales_info for a given locale ID and a property value.
The meaning of the fields are as follows:
locales_info_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localespropertyA string representing a property.
Known properties are:
char_orientation,quotation2_end,quotation2_start,quotation_end,quotation_start,yesandnovalueThe
propertyvalue for thislocale
locales_infos
my $all = $cldr->locales_infos;
Returns all locale properties information from table locales_info as an array reference of hash reference.
No additional parameter is needed.
locale_number_system
my $ref = $cldr->locale_number_system( locale => 'ja' );
# Returns an hash reference like this:
{
locale_num_sys_id => 26,
locale => 'ja',
number_system => undef,
native => undef,
traditional => 'jpan',
finance => 'jpanfin',
}
As a reminder, the numbering system can be explicitly specified with the Unicode BCP47 extension nu. For example:
hi-IN-u-nu-nativeExplicitly specifying the native digits for numeric formatting in Hindi language.
zh-u-nu-financeExplicitly specifying the appropriate financial numerals in Chinese language.
ta-u-nu-traditioExplicitly specifying the traditional Tamil numerals in Tamil language.
ar-u-nu-latnExplicitly specifying the western digits 0-9 in Arabic language.
Returns an hash reference of a given locale number systems available from the table locale_number_systems.
TLDR; if number_system and native are the same, then it is ok to also use latn as numbering system. When traditional is not available, use native. When finance is not available, use the default number_system
The meaning of the fields are as follows:
locale_num_sys_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesnumber_systemA string representing a number system as can be found in the table number_systems, and "used for presentation of numeric quantities in the given locale" (LDML specifications)
In LDML specifications, this is named
default, butdefaultis a reserved keyword in SQL terminology.nativeQuoting from the LDML specifications: "Defines the numbering system used for the native digits, usually defined as a part of the script used to write the language. The
nativenumbering system can only be a numeric positional decimal-digit numbering system, using digits with General_Category=Decimal_Number. Note: In locales where thenativenumbering system is the default, it is assumed that the numbering systemlatn(Western digits 0-9) is always acceptable, and can be selected using the-nukeyword as part of a Unicode locale identifier."traditionalQuoting from the LDML specifications: "Defines the
traditionalnumerals for a locale. This numbering system may be numeric or algorithmic. If thetraditionalnumbering system is not defined, applications should use thenativenumbering system as a fallback."financeQuoting from the LDML specifications: "Defines the numbering system used for financial quantities. This numbering system may be numeric or algorithmic. This is often used for ideographic languages such as Chinese, where it would be easy to alter an amount represented in the default numbering system simply by adding additional strokes. If the financial numbering system is not specified, applications should use the default numbering system as a fallback."
locale_number_systems
my $all = $cldr->locale_number_systems;
Returns all locales numbering systems information from table locale_number_systems as an array reference of hash reference.
No additional parameter is needed.
make_inheritance_tree
This takes a locale, such as ja or ja-JP, or es-ES-valencia and it will return an array reference of inheritance tree of locales. This means the provided locale's parent, its grand-parent, etc until it reaches the root, which, under the LDML specifications is defined by und
For example:
# Japanese
my $tree = $cldr->make_inheritance_tree( 'ja-JP' );
produces:
['ja-JP', 'ja', 'und']
However, there are exceptions and the path is not always linear.
For example:
# Portugese in France
my $tree = $cldr->make_inheritance_tree( 'pt-FR' );
produces:
['pt-FR', 'pt-PT', 'pt', 'und']
Why? Because the CLDR (Common Locale Data Repository) specifies a special parent for locale pt-FR. Those exceptions are defined in common/supplemental/supplementalData.xml with xpath /supplementalData/parentLocales/parentLocale
Another example:
# Traditional Chinese
my $tree = $cldr->make_inheritance_tree( 'yue-Hant' );
Normally, this parent would be yue, which would lead to simplified Chinese, which would not be appropriate, so instead the CLDR provides zh-Hant
['yue-Hant', 'zh-Hant', 'und']
If an error occurred, it will set an error object and return undef in scalar context and an empty list in list context.
See the LDML specifications about inheritance and about locale inheritance and matching for more information.
metazone
my $ref = $cldr->metazone( metazone => 'Japan' ); # Japan Standard Time
# Returns an hash reference like this:
{
metazone_id => 98,
metazone => 'Japan',
territories => ["001"],
timezones => ["Asia/Tokyo"],
}
Returns an hash reference of a metazone information from the table metazones for a given metazone ID.
Quoting from the LDML specifications: "A metazone is a grouping of one or more internal TZIDs that share a common display name in current customary usage, or that have shared a common display name during some particular time period. For example, the zones Europe/Paris, Europe/Andorra, Europe/Tirane, Europe/Vienna, Europe/Sarajevo, Europe/Brussels, Europe/Zurich, Europe/Prague, Europe/Berlin, and so on are often simply designated Central European Time (or translated equivalent)."
Also: "Metazones are used with the 'z', 'zzzz', 'v', and 'vvvv' date time pattern characters, and not with the 'Z', 'ZZZZ', 'VVVV' and other pattern characters for time zone formatting."
The meaning of the fields are as follows:
metazone_idA unique incremental value automatically generated by SQLite.
metazoneA
metazoneID as defined by the LDML specificationsterritoryAn array of
territoryIDs as can be found in the table territories, and that are associated with thismetazone.timezonesAn array of
timezoneIDs as can be found in the table timezones, and that are associated with thismetazone.
metazones
my $all = $cldr->metazones;
Returns all metazones information from table metazones as an array reference of hash reference.
No additional parameter is needed.
metazone_names
my $ref = $cldr->metazone_names(
locale => 'en',
metazone => 'Japan',
width => 'long',
);
# Returns an hash reference like this:
{
metatz_name_id => 4822,
locale => 'ja',
metazone => 'Japan',
width => 'long',
generic => 'Japan Time',
standard => 'Japan Standard Time',
daylight => 'Japan Daylight Time',
}
Returns an hash reference of a metazone names localised information from the table metazones_names for a given locale ID, metazone and width value.
The meaning of the fields are as follows:
metatz_name_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesmetazoneA
metazonesuch as can be found in table metazoneswidthA
metazonelocalised namewidth, which can be eitherlongorshortNote that not all metazones names have both
widthdefined.genericThe
metazonegenericname.standardThe
metazonestandardname.standardThe
metazonedaylightname defined if themetazoneuse daylight saving time system.
See the LDML specifications for more information.
metazones_names
my $all = $cldr->metazones_names;
my $all = $cldr->metazones_names( locale => 'ja' );
my $all = $cldr->metazones_names( width => 'long' );
my $all = $cldr->metazones_names(
locale => 'ja',
width => 'long',
);
Returns all metazone localised formats from table metazones_names as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localesmetazoneA
metazonesuch as can be found in table metazoneswidthA
metazonelocalised namewidth, which can be eitherlongorshortNote that not all timezones names have both
widthdefined.
normalise
This takes a Unicode locale, which can be quite complexe, and normalise it, by replacing outdated elements (subtag) in the language, script, territory or variant part.
it returns a new Locale::Unicode object
You can also call this method as normalize
number_format_l10n
my $ref = $cldr->number_format_l10n(
locale => 'en',
number_system => 'latn',
number_type => 'currency',
format_length => 'short',
format_type => 'standard',
alt => undef,
count => 'one',
format_id => 1000,
);
# Returns an hash reference like this:
{
number_format_id => 2897,
locale => 'en',
number_system => 'latn',
number_type => 'currency',
format_length => 'short',
format_type => 'standard',
format_id => 1000,
format_pattern => '¤0K',
alt => undef,
count => 'one',
}
Returns an hash reference of a number format localised information from the table number_formats_l10n for a given locale ID, number system, number_type, format_length, format_type, alt, count, and format_id. If no alt value or count value is provided, it will default to undef
The meaning of the fields are as follows:
number_format_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesnumber_systemA
number_systemID as can be found in the table number_systemsnumber_typeA string representing a number type.
Known values are:
currency,decimal,misc,percent,scientificformat_lengthA string representing a format length.
Known values are:
default,long,shortformat_typeA string representing a format type.
Known values are:
accounting,default,standardformat_idA string representing a format ID.
Known values are:
1000Thousand
1000010 thousand
100000100 thousand
1000000Million
1000000010 million
100000000100 million
1000000000Billion
1000000000010 billion
100000000000100 billion
1000000000000Trillion
1000000000000010 trillion
100000000000000100 trillion
1000000000000000Quadrillion
1000000000000000010 quadrillion
100000000000000000100 quadrillion
1000000000000000000Quintillion
1000000000000000000010 quintillion
atLeastatMostrangedefaultapproximately
format_patternA string representing a localised pattern.
altA string to specify an alternative value for the same
format_idcountA string representing a
countKnown values are:
undef,1,few,many,one,other,two,zero
See the LDML specifications for more information.
number_formats_l10n
my $all = $cldr->number_formats_l10n;
my $all = $cldr->number_formats_l10n( locale => 'en' );
my $all = $cldr->number_formats_l10n(
locale => 'en',
number_system => 'latn',
number_type => 'currency',
format_length => 'short',
format_type => 'standard',
);
Returns all number formats localised information from table number_formats_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localesnumber_systemA
number_systemID as can be found in the table number_systemsnumber_typeA string representing a number type.
Known values are:
currency,decimal,misc,percent,scientificformat_lengthA string representing a format length.
Known values are:
default,long,shortformat_typeA string representing a format type.
Known values are:
accounting,default,standard
number_symbol_l10n
my $ref = $cldr->number_symbol_l10n(
locale => 'en',
number_system => 'latn',
property => 'decimal',
alt => undef,
);
# Returns an hash reference like this:
{
number_symbol_id => 113,
locale => 'en',
number_system => 'latn',
property => 'decimal',
value => '.',
alt => undef,
}
Returns an hash reference of a number symbol localised information from the table number_symbols_l10n for a given locale ID, number_system, property value and alt value. If no alt value is provided, it will default to undef
The meaning of the fields are as follows:
number_symbol_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesnumber_systemA
number_systemID as can be found in the table number_systemsThere are 69 number systems used in this table number_symbols_l10n out of the 88 known in the table number_systems
propertyA string representing a number property.
Known values are:
approximately,currency_decimal,currency_group,decimal,exponential,group,infinity,list,minus,nan,per_mille,percent,plus,superscript,time_separatorNote that not all locales have all those properties defined.
For example, the
localeenhas the following properties defined for number systemlatn:decimal,exponential,group,infinity,list,minus,nan,per_mille,percent,plus,superscriptWhereas, the
localejaonly has this property defined and only for the number systemlatn:approximatelyThis is because, it inherits from
root, i.e. the speciallocaleundaltA string specified to provide for an alternative property value for the same property name.
number_symbols_l10n
my $all = $cldr->number_symbols_l10n;
my $all = $cldr->number_symbols_l10n( locale => 'en' );
my $all = $cldr->number_symbols_l10n(
locale => 'en',
number_system => 'latn',
);
Returns all number symbols localised information from table number_symbols_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localesnumber_systemA
number_systemID as can be found in the table number_systems
number_system
my $ref = $cldr->number_system( number_system => 'jpan' );
# Returns an hash reference like this:
{
numsys_id => 35,
number_system => 'jpan',
digits => ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
type => 'algorithmic',
}
Returns an hash reference of a number_system information from the table number_systems for a given number_system ID.
There are 88 known number systems.
The meaning of the fields are as follows:
numsys_idA unique incremental value automatically generated by SQLite.
number_systemA string representing a number system ID.
digitsAn array of digits in their locale form, from 0 to 9
typeA string representing the type for this number system.
Known types are:
algorithmic,numeric
number_systems
my $all = $cldr->number_systems;
Returns all number systems information from table number_systems as an array reference of hash reference.
There are 88 known number systems:
adlmAdlam Digits
ahomAhom Digits
arabArabic-Indic Digits
arabextExtended Arabic-Indic Digits
arabextX Arabic-Indic Digits
armnArmenian Numerals
armnlowArmenian Lowercase Numerals
baliBalinese Digits
bengBangla Digits
bhksBhaiksuki Digits
brahBrahmi Digits
cakmChakma Digits
chamCham Digits
cyrlCyrillic Numerals
devaDevanagari Digits
diakDives Akuru Digits
ethiEthiopic Numerals
fullwideFull-Width Digits
georGeorgian Numerals
gongGunjala Gondi digits
gonmMasaram Gondi digits
grekGreek Numerals
greklowGreek Lowercase Numerals
gujrGujarati Digits
guruGurmukhi Digits
hanidaysChinese Calendar Day-of-Month Numerals
hanidecChinese Decimal Numerals
hansSimplified Chinese Numerals
hansfinSimplified Chinese Financial Numerals
hantTraditional Chinese Numerals
hantfinTraditional Chinese Financial Numerals
hebrHebrew Numerals
hmngPahawh Hmong Digits
hmnpNyiakeng Puachue Hmong Digits
javaJavanese Digits
jpanJapanese Numerals
jpanfinJapanese Financial Numerals
jpanyearJapanese Calendar Gannen Year Numerals
kaliKayah Li Digits
kawiKawi Digits
khmrKhmer Digits
kndaKannada Digits
lanaTai Tham Hora Digits
lanathamTai Tham Tham Digits
laooLao Digits
latnWestern Digits
lepcLepcha Digits
limbLimbu Digits
mathboldMathematical Bold Digits
mathdblMathematical Double-Struck Digits
mathmonoMathematical Monospace Digits
mathsanbMathematical Sans-Serif Bold Digits
mathsansMathematical Sans-Serif Digits
mlymMalayalam Digits
modiModi Digits
mongMongolian Digits
mrooMro Digits
mteiMeetei Mayek Digits
mymrMyanmar Digits
mymrshanMyanmar Shan Digits
mymrtlngMyanmar Tai Laing Digits
nagmNag Mundari Digits
newaNewa Digits
nkooN’Ko Digits
olckOl Chiki Digits
oryaOdia Digits
osmaOsmanya Digits
rohgHanifi Rohingya digits
romanRoman Numerals
romanlowRoman Lowercase Numerals
saurSaurashtra Digits
segmentSegmented Digits
shrdSharada Digits
sindKhudawadi Digits
sinhSinhala Lith Digits
soraSora Sompeng Digits
sundSundanese Digits
takrTakri Digits
taluNew Tai Lue Digits
tamlTraditional Tamil Numerals
tamldecTamil Digits
teluTelugu Digits
thaiThai Digits
tibtTibetan Digits
tirhTirhuta Digits
tnsaTangsa Digits
vaiiVai Digits
waraWarang Citi Digits
wchoWancho Digits
number_system_l10n
my $ref = $cldr->number_system_l10n(
number_system => 'jpan',
locale => 'en',
);
# Returns an hash reference like this:
{
num_sys_l10n_id => 1335,
locale => 'en',
number_system => 'jpan',
locale_name => 'Japanese Numerals',
alt => undef,
}
Returns an hash reference of a number_system localised information from the table number_systems_l10n for a given number_system ID and a locale ID.
There are 190 known localised information for number systems.
The meaning of the fields are as follows:
num_sys_l10n_idA unique incremental value automatically generated by SQLite.
number_systemA string representing a number system ID.
locale_nameA string representing the number system in the
localealtA string specifying an alternative version for an otherwise same number system.
number_systems_l10n
my $all = $cldr->number_systems_l10n;
Returns all number systems localised information from table number_systems_l10n as an array reference of hash reference.
person_name_default
my $ref = $cldr->person_name_default( locale => 'ja' );
# Returns an hash reference like this:
{
pers_name_def_id => 3,
locale => 'ja',
value => 'surnameFirst',
}
Returns an hash reference of a person name defaults information from the table person_name_defaults for a given locale ID.
Be aware that there are very few data. This is because the entry for locale und (undefined), contains the default value. Thus, if there is no data for the desired locale, you should fallback to und
This is the way the Unicode CLDR data is structured.
person_name_defaults
my $all = $cldr->person_name_defaults;
Returns all person name defaults information from table person_name_defaults as an array reference of hash reference.
plural_count
my $str = $cldr->plural_count( 3, 'ja-t-de-t0-und-x0-medical' );
# "other"
my $str = $cldr->plural_count( -2, 'he-IL-u-ca-hebrew-tz-jeruslm' );
# "two"
my $str = $cldr->plural_count( 3.5, 'ru' );
# "other"
Provided with a number, and a locale, and this will return a string representing the type of count for the plural value, which may be one of zero, one, two, few, many or other
This is used for example by DateTime::Format::RelativeTime to query time_relative_l10n to get the localised relative time value.
If an error has occurred, this will set an error object, and return undef in scalar context, or an empty list in list context.
See also plural_range and plural_rule
plural_forms
my $rule = $cldr->plural_forms( 'en' );
# nplurals=2; plural=(n != 1);
my $rule = $cldr->plural_forms( 'ja' );
# nplurals=1; plural=0;
my $rule = $cldr->plural_forms( 'ar' );
# nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);
# Alias to 'ar'
my $rule = $cldr->plural_forms( 'ars' );
# nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);
# No rule found
my $rule = $cldr->plural_forms( 'xxx' );
# Returns an empty string
This method returns the gettext Plural-Forms string for a given locale, or an empty string if no rule was found.
It returns a gettext Plural-Forms string, or an empty string if no rule was found for the given locale.
If no locale is provided, or if there is an error retrieving the data, an error is set in the object, and undef is returned in scalar context, or an empty list in list context.
See also "plural_rules" in Locale::Unicode::Data
plural_range
my $ref = $cldr->plural_range(
locale => 'am',
start => 'one',
stop => 'other',
);
# Returns an hash reference like this:
{
plural_range_id => 1335,
locale => 'am',
aliases => [qw(as bn gu hi hy kn mr ps zu)],
start => 'one',
stop => 'other',
result => 'other',
}
Returns an hash reference of a plural_range information from the table plural_ranges for a given start count, a stop count and a locale ID.
For example:
my $num = '2-7';
my $range = [split( /-/, $num, 2 )];
# Will get a string like: zero, one, two, few, many, or other
my $start = $cldr->plural_count( $range->[0], $locale );
my $end = $cldr->plural_count( $range->[1], $locale );
my $ref = $cldr->plural_range( locale => $locale, start => $start, stop => $end );
# zero, one, two, few, many, or other
my $count = $ref->{result};
my $def = $cldr->time_relative_l10n(
locale => $locale,
# For example: second, minute, hour, day, week, month, quarter, or year
field_type => $unit,
# long, short or narrow
field_length => $this_style,
# -1 for past, or 1 for present or future
relative => substr( $num, 0, 1 ) eq '-' ? -1 : 1,
count => $count,
);
# Resulting in a pattern containing {0} that needs to be replaced with the range
$def->{pattern} =~ s/\{0\}/$num/;
say $def->{pattern};
The meaning of the fields are as follows:
plural_range_idA unique incremental value automatically generated by SQLite.
aliasesAn array reference of
localevalues.startA string representing the starting count value.
stopA string representing the ending count value.
resultA string representing the resulting count value.
plural_ranges
my $all = $cldr->plural_ranges;
my $all = $cldr->plural_ranges( locale => 'he' );
my $all = $cldr->plural_ranges( start => 'one' );
my $all = $cldr->plural_ranges( start => 'one', stop => 'many' );
my $all = $cldr->plural_ranges( result => 'other' );
Returns all plural ranges information from table plural_ranges as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
localesuch asenorja-JPas can be found in table localesstartA string representing the starting count value.
stopA string representing the ending count value.
resultA string representing the resulting count value.
plural_rule
my $ref = $cldr->plural_rule(
locale => 'am',
count => 'one',
);
# Returns an hash reference like this:
{
plural_rule_id => 1335,
locale => 'am',
aliases => [qw(as bn doi fa gu hi kn pcm zu)],
count => 'one',
rule => 'i = 0 or n = 1 @integer 0, 1 @decimal 0.0~1.0, 0.00~0.04',
}
Returns an hash reference of a plural_rule information from the table plural_rules for a given start count, a stop count and a locale ID.
The meaning of the fields are as follows:
plural_rule_idA unique incremental value automatically generated by SQLite.
aliasesAn array reference of
localevalues.countA string representing the count value.
ruleA string representing the plural rule.
See also the Unicode documentation, and also here, and here.
plural_rules
my $all = $cldr->plural_rules;
my $all = $cldr->plural_rules( locale => 'he' );
my $all = $cldr->plural_rules( count => 'one' );
Returns all plural ranges information from table plural_rules as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
localesuch asenorja-JPas can be found in table localesaliasesAn array reference of
localevalues.countA string representing the count value.
See also the Unicode documentation, and also here, and here.
rbnf
my $ref = $cldr->rbnf(
locale => 'ja',
ruleset => 'spellout-cardinal',
rule_id => 7,
);
# Returns an hash reference like this:
{
rbnf_id => 7109,
locale => 'ja',
grouping => 'SpelloutRules',
ruleset => 'spellout-cardinal',
rule_id => '7',
rule_value => '七;',
}
Returns an hash reference of a RBNF (Rule-Based Number Format) information from the table rbnf for a given locale ID, a rule set ruleset and a rule ID rule_id.
The meaning of the fields are as follows:
rbnf_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesgroupingA string representing a
RBNFgrouping.Known values are:
NumberingSystemRules,OrdinalRules,SpelloutRulesrulesetA string representing the rule set name.
rule_idA string representing the rule ID.
rule_valueA string containing the rule value.
Make sure to read the
LDMLdocumentation, as it may contain information to alias this rule on another one.
rbnfs
my $all = $cldr->rbnfs;
my $all = $cldr->rbnfs( locale => 'ko' );
my $all = $cldr->rbnfs( grouping => 'SpelloutRules' );
my $all = $cldr->rbnfs( ruleset => 'spellout-cardinal-native' );
Returns all RBNF (Rule-Based Number Format) information from table rbnf as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
groupingA group value. Known values are:
NumberingSystemRules,OrdinalRulesandSpelloutRuleslocaleA
localesuch asenorja-JPas can be found in table localesrulesetThe name of a rule set.
reference
my $ref = $cldr->reference( code => 'R1131' );
# Returns an hash reference like this:
{
ref_id => 132,
code => 'R1131',
uri => 'http://en.wikipedia.org/wiki/Singapore',
description => 'English is the first language learned by half the children by the time they reach preschool age; using 92.6% of pop for the English figure',
}
Returns an hash reference of a reference information from the table refs for a given code.
references
my $all = $cldr->references;
Returns all reference information from table refs as an array reference of hash reference.
No additional parameter is needed.
script
my $ref = $cldr->script( script => 'Jpan' );
# Returns an hash reference like this:
{
script_id => 73,
script => 'Jpan',
rank => 5,
sample_char => '3048',
id_usage => 'RECOMMENDED',
rtl => 0,
lb_letters => 1,
has_case => 0,
shaping_req => 0,
ime => 1,
density => 2,
origin_country => 'JP',
likely_language => 'ja',
status => 'regular',
}
Returns an hash reference of a script information from the table scripts for a given script ID.
The meaning of the fields are as follows:
The information is quoted directly from the CLDR data.
script_idA unique incremental value automatically generated by SQLite.
scriptA string representing a
scriptIDrank"The approximate rank of this script from a large sample of the web, in terms of the number of characters found in that script. Below 32 the ranking is not statistically significant."
sample_char"A sample character for use in "Last Resort" style fonts. For printing the combining mark for Zinh in a chart, U+25CC can be prepended. See http://unicode.org/policies/lastresortfont_eula.html"
id_usage"The usage for IDs (tables 4-7) according to UAX #31."
For a description of values, see
http://unicode.org/reports/tr31/#Table_Candidate_Characters_for_Exclusion_from_Identifiers
rtlTrue "if the script is RTL. Derived from whether the script contains RTL letters according to the Bidi_Class property"
lb_lettersTrue "if the major languages using the script allow linebreaks between letters (excluding hyphenation). Derived from LB property."
has_caseTrue "if in modern (or most recent) usage case distinctions are customary."
shaping_reqTrue "if shaping is required for the major languages using that script for NFC text. This includes not only ligation (and Indic conjuncts), Indic vowel splitting/reordering, and Arabic-style contextual shaping, but also cases where NSM placement is required, like Thai. MIN if NSM placement is sufficient, not the more complex shaping. The NSM placement may only be necessary for some major languages using the script."
imeInput Method Engine.
True "if the major languages using the script require IMEs. In particular, users (of languages for that script) would be accustomed to using IMEs (such as Japanese) and typical commercial products for those languages would need IME support in order to be competitive."
density"The approximate information density of characters in this script, based on comparison of bilingual texts."
origin_country"The approximate area where the script originated, expressed as a BCP47 region code."
likely_languageThe likely
languageassociated with thisscriptstatusA string representing the status for this
scriptKnown values are:
deprecated,private_use,regular,reserved,special,unknown
See also the Unicode list of known scripts
scripts
my $all = $cldr->scripts;
my $all = $cldr->scripts( rtl => 1 );
my $all = $cldr->scripts( origin_country => 'FR' );
my $all = $cldr->scripts( likely_language => 'fr' );
Returns all scripts information from table scripts as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
likely_languageA
localesuch asenorja-JPas can be found in table localesorigin_countryA
territorycode as can be found in table territoriesrtlA boolean value.
0for false and1for true.
script_l10n
my $ref = $cldr->script_l10n(
locale => 'en',
script => 'Latn',
alt => undef,
);
# Returns an hash reference like this:
{
scripts_l10n_id => 3636,
locale => 'en',
script => 'Latn',
locale_name => 'Latin',
alt => undef,
}
Returns an hash reference of a script localised information from the table scripts_l10n for a given script ID and a locale ID and a alt value. If no alt value is provided, it will default to undef
The meaning of the fields are as follows:
scripts_l10n_idThis is a unique incremental integer automatically generated by SQLite.
localeA
localesuch asenorja-JPas can be found in table localesscriptA 3 to 4-characters script ID as can be found in the table scripts
locale_nameThe localised script name based on the
localespecified.altA string, that is optional, and is used to provide an alternative version. Known
altvalues are:undef,secondary,short,stand-alone,variant
scripts_l10n
my $all = $cldr->scripts_l10n;
my $all = $cldr->scripts_l10n( locale => 'en' );
my $all = $cldr->scripts_l10n(
locale => 'en',
alt => undef,
);
Returns all localised scripts information from table scripts_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
localesuch asenorja-JPas can be found in table localesaltA string, that is optional, and is used to provide an alternative version. Known
altvalues are:undef,secondary,short,stand-alone,variant
split_interval
my $ref = $cldr->split_interval(
pattern => $string,
greatest_diff => 'd',
) || die( $cldr->error );
This takes an hash or hash reference of options and it returns a 4-elements array reference containing:
- 1. first part of the pattern
- 2. the separator, which may be an empty string
- 3. second part of the pattern
- 4. the best repeating pattern found
The required options are:
greatest_diffA token representing the greatest difference.
Known values are:
B,G,H,M,a,d,h,m,ySee "Format Patterns" for their meaning.
patternA interval pattern, such as one you can get with the method calendar_interval_format
This method is provided as a convenience, but the interval formats data in the database have already been pre-processed, so you do not have to do it.
subdivision
my $ref = $cldr->subdivision( subdivision => 'jp12' );
# Returns an hash reference like this:
{
subdivision_id => 2748,
territory => 'JP',
subdivision => 'jp12',
parent => 'JP',
is_top_level => 1,
status => 'regular',
}
Returns an hash reference of a subdivision information from the table subdivisions for a given subdivision ID.
The meaning of the fields are as follows:
subdivision_idA unique incremental value automatically generated by SQLite.
territoryA
territoryID, such as can be found in table territoriessubdivisionA string representing a
subdivisionIDparentA string representing a parent for this
subdivision. It can be either anothersubdivisionID, or aterritoryID, if this is a topsubdivisionis_top_levelA boolean value representing whether this
subdivisionis directly under aterritoryor rather under anothersubdivisionstatusA string representing the status for this
subdivision.Known values are:
deprecated,regular,unknown
subdivisions
my $all = $cldr->subdivisions;
my $all = $cldr->subdivisions( territory => 'JP' );
my $all = $cldr->subdivisions( parent => 'US' );
my $all = $cldr->subdivisions( is_top_level => 1 );
Returns all subdivisions information from table subdivisions as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
is_top_levelA boolean value.
0for false and1for true.parentA
territorycode as can be found in table territoriesterritoryA
territorycode as can be found in table territories
subdivision_l10n
my $ref = $cldr->subdivision_l10n(
locale => 'en',
# Texas
subdivision => 'ustx',
);
# Returns an hash reference like this:
{
subdiv_l10n_id => 56463,
locale => 'en',
subdivision => 'ustx',
locale_name => 'Texas',
}
Returns an hash reference of a subdivision localised information from the table subdivisions_l10n for a given subdivision ID and a locale ID.
The meaning of the fields are as follows:
subdiv_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localessubdivisionA
subdivisionID as can be found from the table subdivisionslocale_nameA string representing the localised name of the
subdivisionin thelocalespecified.
See the LDML specifications for more information.
subdivisions_l10n
my $all = $cldr->subdivisions_l10n;
my $all = $cldr->subdivisions_l10n( locale => 'en' );
Returns all subdivisions localised information from table subdivisions_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table locales
territory
my $ref = $cldr->territory( territory => 'FR' );
# Returns an hash reference like this:
{
territory_id => 118,
territory => 'FR',
parent => 155,
gdp => 2856000000000,
literacy_percent => 99,
population => 67848200,
languages => ["fr", "en", "es", "de", "oc", "it", "pt", "pcd", "gsw", "br", "co", "hnj", "ca", "eu", "nl", "frp", "ia"],
contains => undef,
currency => 'EUR',
calendars => undef,
min_days => 4,
first_day => 1,
weekend => undef,
status => 'regular',
}
Returns an hash reference of a territory information from the table territories for a given territory ID.
The meaning of the fields are as follows:
territoryA 2-characters code designating a country code, which may not necessarily be an active ISO 3166 code, because the CLDR keeps outdated ones for consistency.
It can also be a 3-digits world region code.
parentA
parentterritory, if one is defined. For example, France (FR) has parent155representing Western Europe, which has parent150, representing Europe, which, itself, has parent001, representing the world.gdpThe territory GDP (Gross Domestic Product), which may be
undef, especially for world region.literacy_percentThe literacy percentage of the population expressed as a decimal. For example, a value of
99means 99%populationThe territory population as an integer.
languagesThe languages known to be spoken in this territory, as an array of
languageIDs. For significant languages, you can get more information, such as their share of the population with language_populationcontainsAn array of
territorycodes contained by this territory. This may beundefThis value is typically set for world
regioncodes and for special territories likeEU,EZ,QOandUNcurrencyThe official
currencyused in this territory. This may beundefsuch as for world regions.calendarsAn array of calendar systems used in this
territorymin_daysThis is used to decide if the week starting with
first_dayis to ne included in the calendar as the first week of the new yer or last week of the previous year.See the LDML specifications
first_dayThe first day of the week. Although in the Unicode LDML, the weekday names are identified with short strings, since there is no universally-accepted numeric designation, here the value used is an integer from
1(Monday) to7(Sunday)weekendAn array of week days (identified by integers as explained in
first_day). This value may be null, in which case, the default value to be used is the one set in the World region (001), which is[6,7], i.e. Saturday and Sunday.statusA string representing the
statusfor this territory.Known
statusvalues are:deprecated,macroregion,private_use,regular,reserved,special,unknown
territories
my $all = $cldr->territories;
my $all = $cldr->territories( parent => 150 );
Returns all territories information from table territories as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
parentA
territorycode as can be found in table territories
territory_l10n
my $ref = $cldr->territory_l10n(
locale => 'en',
territory => 'JP',
alt => undef,
);
# Returns an hash reference like this:
{
terr_l10n_id => 13385,
locale => 'en',
territory => 'JP',
locale_name => 'Japan',
alt => undef,
}
Returns an hash reference of a territory localised information from the table territories_l10n for a given territory ID and a locale ID and an alt value. If no alt value is provided, it will default to undef
The meaning of the fields are as follows:
terr_l10n_idThis is a unique incremental integer automatically generated by SQLite.
localeA
localesuch asenorja-JPas can be found in table localesterritoryA 2-characters country code or a 3-digits region code as can be found in the table territories
locale_nameThe localised territory name based on the
localespecified.altA string, that is optional, and is used to provide an alternative version. Known
altvalues are:undef,biot,chagos,short,variant
territories_l10n
my $all = $cldr->territories_l10n;
my $all = $cldr->territories_l10n( locale => 'en' );
my $all = $cldr->territories_l10n(
locale => 'en',
alt => undef,
);
Returns all localised territories information from table territories_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
localesuch asenorja-JPas can be found in table localesaltA string, that is optional, and is used to provide an alternative version. Known
altvalues are:undef,biot,chagos,short,variant
time_format
my $ref = $cldr->time_format( region => 'JP' );
# Returns an hash reference like this:
{
time_format_id => 86,
region => 'JP',
territory => 'JP',
locale => undef,
time_format => 'H',
time_allowed => ["H", "K", "h"],
}
Returns an hash reference of a time format information from the table time_formats for a given region ID.
The meaning of the fields are as follows:
time_format_idA unique incremental value automatically generated by SQLite.
regionA string representing a
region, which can be aterritorycode, such asUSor419, or alanguageID with aterritoryID, such asit-CHoren-001.territoryA string representing the
territorypart of theregionas can be found in table territorieslocaleA string representing the
localepart of theregionvalue.A
locale, such asenorja-JPas can be found in table localestime_formatA short string representing a time format.
Known values are:
Handhtime_allowedAn array of format allowed.
For example:
["H","h","hB","hb"]
See the LDML specifications for more information.
time_formats
my $all = $cldr->time_formats;
my $all = $cldr->time_formats( region => 'US' );
my $all = $cldr->time_formats( territory => 'JP' );
my $all = $cldr->time_formats( locale => undef );
my $all = $cldr->time_formats( locale => 'en' );
Returns all time formats information from table time_formats as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
localesuch asenorja-JPas can be found in table localesregionA
territorycode as can be found in table territoriesterritoryA
territorycode as can be found in table territories
time_relative_l10n
my $ref = $cldr->time_relative_l10n(
locale => 'en',
field_type => 'day',
field_length => 'short',
relative => -1,
# optionally a 'count' value; defaults to 'one'
# count => 'one'
);
# Returns an hash reference like this:
{
time_relative_id => 2087,
locale => 'en',
field_type => 'day',
field_length => 'short',
relative => -1,
format_pattern => '{0} day ago',
count => 'one',
}
Returns an hash reference of a field localised information from the table time_relative_l10n for a given locale ID, field_type, field_length and relative value.
The meaning of the fields are as follows:
time_relative_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesfield_typeA string representing a field type.
Known values are:
day,fri,hour,minute,mon,month,quarter,sat,second,sun,thu,tue,wed,week,yearfield_lengthA string representing a field length.
Known values are:
narrow,short,standardrelativeAn integer representing the relative value of the field. For example,
-1being the past, and1being the future.Posible values are:
-1,1format_patternA string containing the localised pattern based on the
localecountA string representing the count for the pattern. If none is provided, it defaults to
onePossible values may be:
zero,one,two,few,many,other
See the LDML specifications for more information.
time_relatives_l10n
my $all = $cldr->time_relatives_l10n;
my $all = $cldr->time_relatives_l10n( locale => 'en' );
my $all = $cldr->time_relatives_l10n(
locale => 'en',
field_type => 'day',
field_length => 'short',
);
Returns all time relative localised information from table time_relative_l10n as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localesfield_typeA string representing a field type.
Known values are:
day,fri,hour,minute,mon,month,quarter,sat,second,sun,thu,tue,wed,week,yearfield_lengthA string representing a field length.
Known values are:
narrow,short,standardcountA string representing the count for the pattern.
Possible values may be:
zero,one,two,few,many,other
timezone
my $ref = $cldr->timezone( timezone => 'Asia/Tokyo' );
# Returns an hash reference like this:
{
timezone_id => 281,
timezone => 'Asia/Tokyo',
territory => 'JP',
region => 'Asia',
tzid => 'japa',
metazone => 'Japan',
tz_bcpid => 'jptyo',
is_golden => 1,
is_primary => 0,
is_preferred => 0,
is_canonical => 0,
}
Returns an hash reference of a time zone information from the table timezones based on the timezone ID provided.
The meaning of the fields are as follows:
timezone_idA unique incremental value automatically generated by SQLite.
timezoneA
timezoneIDterritoryA string representing a
territorycode as can be found in table territoriesregionA string representing a world region.
Known regions are;
Africa,America,Antarctica,Arctic,Asia,Atlantic,Australia,CST6CDT,EST5EDT,Etc,Europe,Indian,MST7MDT,PST8PDT,PacifictzidA string representing a timezone ID
metazoneA string representing a metazone ID
tz_bcpidA boolean specifying whether this timezone ID is also a BCP47
timezone.is_goldenA boolean specifying whether this timezone is a golden timezone.
A
timezoneis deemedgoldenif it is specified in theCLDRas part of the primaryZones or if thetimezoneterritory is001(World).As explained in the LDML specifications, "[t]he golden zones are those in mapZone supplemental data under the territory
001."is_primaryA boolean specifying whether this timezone is a primary timezone.
As explained in the LDML specifications, this "specifies the dominant zone for a region; this zone should use the region name for its generic location name even though there are other canonical zones available in the same region. For example,
Asia/Shanghaiis displayed asChina Time, instead ofShanghai Time"is_preferredA boolean specifying whether this timezone is the preferred timezone for this
metazoneis_canonicalA boolean specifying whether this timezone is the canonical timezone, since it can have multiple aliases.
timezones
my $array_ref = $cldr->timezones;
# Or, providing with some filtering arguments
# Returns all the timezones for the country code 'JP'
my $array_ref = $cldr->timezones( territory => 'JP' );
# Returns all the timezones for the region code 'Asia'
my $array_ref = $cldr->timezones( region => 'Asia' );
# Returns all the timezones that match the CLDR timezone ID 'japa'
my $array_ref = $cldr->timezones( tzid => 'japa' );
# Returns all the timezones that match the BCP47 timezone ID 'jptyo'
my $array_ref = $cldr->timezones( tz_bcpid => 'jptyo' );
# Returns all the timezones that have the CLDR metazone 'Japan'
my $array_ref = $cldr->timezones( metazone => 'Japan' );
# Returns all the timezones that are 'golden' timezones
my $array_ref = $cldr->timezones( is_golden => 1 );
my $array_ref = $cldr->timezones( is_primary => 1 );
my $array_ref = $cldr->timezones( is_canonical => 1 );
Returns all the timezone information as an array reference of hash reference from the table timezones
You can adjust the data return by using a combination of the following filtering arguments:
territoryA
territorycode as can be found in table territoriesregionA world region. Known values are:
Africa,America,Antarctica,Arctic,Asia,Atlantic,Australia,CST6CDT,EST5EDT,Etc,Europe,Indian,MST7MDT,PST8PDT,PacifictzidA Unicode timezone ID
tz_bcpidA Unicode BCP47 timezone ID.
metazoneA Unicode metazone ID.
is_goldenA boolean expressing whether this time zone is
golden(in Unicode parlance), or not.1for true, and0for false.is_primaryA boolean specifying whether this timezone is a primary timezone.
is_canonicalA boolean specifying whether this timezone is the canonical timezone, since it can have multiple aliases.
timezone_canonical
my $str = $cldr->timezone_canonical( 'Europe/Paris' );
# Europe/Paris
my $str = $cldr->timezone_canonical( 'America/Atka' );
# America/Adak
my $str = $cldr->timezone_canonical( 'US/Aleutian' );
# America/Adak
Provided with a timezone, and this returns the canonical timezone corresponding.
If no matching timezone could be found, an empty string is returned.
If an error occurred, this sets an exception object, and returns undef in scalar context, and an empty list in list context.
timezone_city
my $ref = $cldr->timezone_city(
locale => 'de',
timezone => 'Asia/Tokyo',
);
# Returns an hash reference like this:
{
tz_city_id => 7486,
locale => 'de',
timezone => 'Asia/Tokyo',
city => 'Tokio',
alt => undef,
}
Returns an hash reference of a timezone localised exemplar city from the table timezones_cities for a given locale ID, timezone and alt value. If no alt value is provided, it will default to undef
The behaviour of this method is altered depending on whether extend_timezones_cities is set to a true boolean value or not. If set to true, this will retrieve the data from the table timezones_cities_extended instead of the timezones_cities
By default, extend_timezones_cities is set to true, and the Locale::Unicode::Data distribution comes with an extended set of time zones cities. The default Unicode CLDR data comes only with a minimal set.
This method is especially used to format the pattern characters v and V. See the section on Format Patterns for more about this.
The meaning of the fields are as follows:
tz_city_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localestimezoneA
timezoneID as can be found in the table timezonescityA localised version of a representative city for this given
timezone.Note that not all locales have a localised city for all timezones.
altA string specified to provide for an alternative city value for the same city name.
Known values are:
undefandsecondary
timezones_cities
my $all = $cldr->timezones_cities;
my $all = $cldr->timezones_cities( locale => 'ja' );
my $all = $cldr->timezones_cities(
locale => 'ja',
alt => undef,
);
Returns all timezone localised representative city name from table timezones_cities as an array reference of hash reference.
The behaviour of this method is altered depending on whether extend_timezones_cities is set to a true boolean value or not. If set to true, this will retrieve the data from the table timezones_cities_extended instead of the timezones_cities
By default, extend_timezones_cities is set to true, and the Locale::Unicode::Data distribution comes with an extended set of time zones cities. The default Unicode CLDR data comes only with a minimal set.
This method is especially used to format the pattern characters v and V. See the section on Format Patterns for more about this.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localesaltA string used to differentiate two version of a localised city name.
Known values are:
undefandsecondary
timezone_formats
my $ref = $cldr->timezone_formats(
locale => 'en',
type => 'region',
subtype => 'standard',
);
# Returns an hash reference like this:
{
tz_fmt_id => 145,
locale => 'en',
type => 'region',
subtype => 'standard',
format_pattern => '{0} Standard Time',
}
Returns an hash reference of a timezone formats localised information from the table timezones_formats for a given locale ID, type and optional subtype value. If no subtype value is provided, it will default to undef
The meaning of the fields are as follows:
tz_fmt_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localestypeA format type. This can be either:
fallback,gmt,gmt_zero,hourandregionfallbackQuoting the LDML specifications: "a formatting string such as
{1} ({0}), where{1}is the metazone, and{0}is the country or city."For example:
{1} ({0}), which would yield in English:Pacific Time (Canada)gmtA formatting string, such as
GMT{0}, where{0}is the GMT offset in hour, minute, and possibly seconds, using thehourformatting.For example:
GMT{0}, which would yield in English:GMT-0800hour2 formatting strings separated by a semicolon; one for the positive offset formatting and the other for the negative offset formatting.
See the section on formatting patterns for the significance of the letters used in formatting.
For example:
+HHmm;-HHmm, which would yield in English:+1200gmt_zeroFor example:
GMTThis specifies how GMT/UTC with no explicit offset (implied 0 offset) should be represented.
regionQuoting the LDML specifications: "a formatting string such as
{0} Time, where{0}is the country or city."For example:
{0} Daylight Time, which would yield in English:France Daylight Time, or in Spanish, the patternhorario de verano de {0}, which would yieldhorario de verano de Francia
subtypeA
timezoneformat subtype, such asdaylight,standardNote that not all timezones and locales have a localised
daylightorstandardformatformat_patternA string representing the format pattern.
See the LDML specifications and specifications about fallback formats for more information.
timezones_formats
my $all = $cldr->timezones_formats;
my $all = $cldr->timezones_formats( locale => 'ja' );
my $all = $cldr->timezones_formats(
locale => 'ja',
type => 'region',
);
my $all = $cldr->timezones_formats(
locale => 'ja',
subtype => 'standard',
);
my $all = $cldr->timezones_formats(
format_pattern => '{0} Daylight Time',
);
Returns all timezone localised formats from table timezones_formats as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localestypeA format type. This can be either:
fallback,gmt,gmt_zero,hourandregionsubtypeA
timezoneformat subtype, such asdaylight,standardNote that not all timezones and locales have a localised
daylightorstandardformat
timezone_info
my $ref = $cldr->timezone_info(
timezone => 'Europe/Simferopol',
start => '1994-04-30T21:00:00',
);
# Returns an hash reference like this:
{
tzinfo_id => 594,
timezone => 'Europe/Simferopol',
metazone => 'Moscow',
start => '1994-04-30T21:00:00',
until => '1997-03-30T01:00:00',
}
or, maybe, simpler, using the advanced search:
my $ref = $cldr->timezone_info(
timezone => 'Europe/Simferopol',
start => ['>1992-01-01', '<1995-01-01'],
);
That way, you do not need to know the exact date.
Returns an hash reference of a timezone historical information from the table timezones_info for a given timezone ID and a start datetime. If no start value is provided, it will default to undef
The meaning of the fields are as follows:
tzinfo_idA unique incremental value automatically generated by SQLite.
timezoneA
timezone, such asAsia/Tokyotable timezonesmetazoneA
metazoneIDThere are 190 known
metazoneIDsstartAn ISO8601 start datetime value for this timezone.
This may be
undefuntilAn ISO8601 datetime value representing the date and time until which this timezone was valid.
It may be
undef
timezones_info
my $all = $cldr->timezones_info;
my $all = $cldr->timezones_info( timezone => 'Europe/Simferopol' );
my $all = $cldr->timezones_info( metazone => 'Singapore' );
my $all = $cldr->timezones_info( start => undef );
my $all = $cldr->timezones_info( until => undef );
Returns all the timezone information as an array reference of hash reference from the table timezones_info
You can adjust the data return by using a combination of the following filtering arguments:
metazoneA Unicode
metazoneIDstartAn ISO8601 date and time from which to find data. For example:
2014-10-25T14:00:00timezoneA
timezonevalue.untilAn ISO8601 date and time until which to find data. For example:
2016-03-26T18:00:00
timezone_names
my $ref = $cldr->timezone_names(
locale => 'ja',
timezone => 'Europe/London',
width => 'long',
);
# Returns an hash reference like this:
{
tz_name_id => 85,
locale => 'ja',
timezone => 'Europe/London',
width => 'long',
generic => undef,
standard => undef,
daylight => '英国夏時間',
}
Returns an hash reference of a timezone names localised information from the table timezones_names for a given locale ID, timezone and width value.
The meaning of the fields are as follows:
tz_name_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localestimezoneA
timezonesuch as can be found in table timezoneswidthA
timezonelocalised namewidth, which can be eitherlongorshortNote that not all timezones names have both
widthdefined.genericThe
timezonegenericname.standardThe
timezonestandardname.standardThe
timezonedaylightname defined if thetimezoneuse daylight saving time system.
See the LDML specifications for more information.
timezones_names
my $all = $cldr->timezones_names;
my $all = $cldr->timezones_names( locale => 'ja' );
my $all = $cldr->timezones_names( width => 'long' );
my $all = $cldr->timezones_names(
locale => 'ja',
width => 'long',
);
Returns all timezone localised formats from table timezones_names as an array reference of hash reference.
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localestimezoneA
timezonesuch as can be found in table timezoneswidthA
timezonelocalised namewidth, which can be eitherlongorshortNote that not all timezones names have both
widthdefined.
unit_alias
my $ref = $cldr->unit_alias( alias => 'meter-per-second-squared' );
# Returns an hash reference like this:
{
unit_alias_id => 3,
alias => 'meter-per-second-squared',
target => 'meter-per-square-second',
reason => 'deprecated',
}
Or, maybe simpler, using the advanced search:
my $ref = $cldr->unit_alias( alias => '~^meter.*' );
or
my $ref = $cldr->unit_alias( alias => qr/^meter.*/ );
Returns an hash reference of a unit alias information from the table unit_aliases based on the alias ID provided.
unit_aliases
my $all = $cldr->unit_aliases;
Returns all the unit alias information as an array reference of hash reference from the table unit_aliases
No additional parameter is needed.
unit_constant
my $ref = $cldr->unit_constant( constant => 'lb_to_kg' );
# Returns an hash reference like this:
{
unit_constant_id => 1,
constant => 'lb_to_kg',
expression => 0.45359237,
value => 0.45359237,
description => undef,
status => undef,
}
Returns an hash reference of a unit constant information from the table unit_constants based on the constant ID provided.
The meaning of the fields are as follows:
unit_constant_idA unique incremental value automatically generated by SQLite.
constantThe unit constant ID.
expressionThe constant expression as defined in
CLDRvalueThe constant resolved value, computed from the
expressionspecified.descriptionA string describing the constant.
statusA string representing the
statusfor thisconstant
unit_constants
my $all = $cldr->unit_constants;
Returns all the unit constants information as an array reference of hash reference from the table unit_constants
No additional parameter is needed.
unit_conversion
my $ref = $cldr->unit_conversion( source => 'kilogram' );
# Returns an hash reference like this:
{
unit_conversion_id => 9,
source => 'kilogram',
base_unit => 'kilogram',
expression => undef,
factor => undef,
systems => ["si", "metric"],
category => 'mass',
}
Returns an hash reference of a unit conversion information from the table unit_conversions based on the source ID provided.
The meaning of the fields are as follows:
unit_conversion_idA unique incremental value automatically generated by SQLite.
sourceA string representing the unit source.
base_unitA string representing the base unit for this unit conversion
expressionA string representing the unit expression, if any.
factorA string representing the unit factor value, if any.
systemsAn array of string representing the unit conversion systems.
categoryA string representing the unit conversion category.
Known category values are:
acceleration,angle,area,catalytic-activity,concentration-mass,digital,electric-capacitance,electric-charge,electric-conductance,electric-current,electric-inductance,electric-resistance,energy,force,frequency,graphics,ionizing-radiation,length,luminance,luminous-flux,luminous-intensity,magnetic-flux,magnetic-induction,mass,portion,power,pressure,pressure-per-length,radioactivity,solid-angle,speed,substance-amount,temperature,th,time,typewidth,voltage,volume,year-duration
unit_conversions
my $all = $cldr->unit_conversions;
my $all = $cldr->unit_conversions( base_unit => 'kilogram' );;
my $all = $cldr->unit_conversions( category => 'mass' );
Returns all the unit conversion information as an array reference of hash reference from the table unit_conversions
A combination of the following fields may be provided to filter the information returned:
base_unitA base unit ID.
categoryA category ID. Known categories are:
acceleration,angle,area,catalytic-activity,concentration-mass,digital,electric-capacitance,electric-charge,electric-conductance,electric-current,electric-inductance,electric-resistance,energy,force,frequency,graphics,ionizing-radiation,length,luminance,luminous-flux,luminous-intensity,magnetic-flux,magnetic-induction,mass,portion,power,pressure,pressure-per-length,radioactivity,solid-angle,speed,substance-amount,temperature,th,time,typewidth,voltage,volume,year-duration
unit_l10n
my $ref = $cldr->unit_l10n(
unit_id => 'length-kilometer',
locale => 'en',
# long, narrow, short
format_length => 'long',
# compound, regular
unit_type => 'regular',
count => 'one',
gender => undef,
gram_case => undef,
);
# Returns an hash reference like this:
{
units_l10n_id => 25599,
locale => 'en',
format_length => 'long',
unit_type => 'regular',
unit_id => 'length-kilometer',
unit_pattern => '{0} kilometer',
pattern_type => 'regular',
locale_name => 'kilometers',
count => 'one',
gender => undef,
gram_case => undef,
}
Returns an hash reference of a unit localised information from the table units_l10n for a given locale ID, format_length, unit_type, unit_id, count, gender, gram_case.
If no count, gender, or gram_case value is provided, it will default to undef
The meaning of the fields are as follows:
units_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesformat_lengthA string representing the unit format length
Known values are:
long,narrow,shortunit_typeA string representing a
unittype.Known values are:
compoundandregularunit_idA string representing a
unitID.unit_patternA string representing a localised
unitpattern.pattern_typeA string representing a pattern type.
Known values are:
per-unit,prefix,regularlocale_nameA string containing the localised representation of this
unitNote that there is no
locale_namevalue forunitof typecompoundin theCLDRdata.countA string used to differentiate identical values.
Known values are:
undef,one,other,zero,two,few,manygenderA string representing the
genderassociated with theunitThe locales that are known to use
genderinformation for units are:arArabic
caCatalan
csCzech
daDanish
deGerman
elGreek
esSpanish
frFrench
fr-CACanadian French
guGujarati
heHebrew
hiHindi
hrCroatian
isIcelandic
itItalian
knKannada
ltLithuanian
lvLatvian
mlMalayalam
mrMarathi
nlDutch
nnNorwegian Nynorsk
noNorwegian
paPunjabi
plPolish
ptPortuguese
roRomanian
ruRussian
skSlovak
slSlovenian
srSerbian
svSwedish
ukUkrainian
urUrdu
gram_caseA string representing a grammatical case.
Known values are:
ablative,accusative,dative,elative,ergative,genitive,illative,instrumental,locative,oblique,partitive,prepositional,sociative,terminative,translative,vocative
See the LDML specifications for more information.
units_l10n
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',
);
Returns all the unit prefixes information as an array reference of hash reference from the table units_l10n
A combination of the following fields may be provided to filter the information returned:
localeA
locale, such asenorja-JPas can be found in table localesformat_lengthA string representing the unit format length
Known values are:
long,narrow,shortunit_typeA string representing a
unittype.Known values are:
compoundandregularunit_idA string representing a
unitID.pattern_typeA string representing a pattern type.
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_idA unique incremental value automatically generated by SQLite.
unit_idA
unitIDsymbolA string representing the unit symbol.
powerA value representing the unit power
factorA 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:
territoryA
territorycode as can be found in table territoriescategoryA 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_idA unique incremental value automatically generated by SQLite.
base_unitA string representing the base unit.
quantityA 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-durationstatusA string representing the unit status.
Known values are:
undefandsimplecommentA text providing some comments about this unit quantity.
unit_quantities
my $all = $cldr->unit_quantities;
my $all = $cldr->unit_quantities( quantity => 'mass' );
Returns all the unit quantities information as an array reference of hash reference from the table unit_quantities
A combination of the following fields may be provided to filter the information returned:
quantityA
quantityID. KnownquantityID 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
variant
my $ref = $cldr->variant( variant => 'valencia' );
# Returns an hash reference like this:
{
variant_id => 111,
variant => 'valencia',
status => 'regular',
}
Returns an hash reference of a variant information from the table variants based on the variant ID provided.
The meaning of the fields are as follows:
variant_idA unique incremental value automatically generated by SQLite.
variantA
variantIDstatusA string representing a status for this variant.
Known values are:
undef,deprecated,regular
variants
my $all = $cldr->variants;
Returns all the variants information as an array reference of hash reference from the table variants
No additional parameter is needed.
variant_l10n
my $ref = $cldr->variant_l10n(
variant => 'valencia',
locale => 'en',
alt => undef,
);
# Returns an hash reference like this:
{
var_l10n_id => 771,
locale => 'en',
variant => 'valencia',
locale_name => 'Valencian',
alt => undef,
}
Returns an hash reference of a variant localised information from the table variants_l10n for a given variant ID and a locale ID and an alt value. If no alt value is provided, it will default to undef
The meaning of the fields are as follows:
var_l10n_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesvariantA
variantID as can be found in the table variantslocale_nameA string representing the localised
variantname based on thelocalealtAn alternative value identifier to distinguish a variant with the same name.
Known values are:
undefandsecondary
variants_l10n
my $all = $cldr->variants_l10n;
my $all = $cldr->variants_l10n( locale => 'en' );
my $all = $cldr->variants_l10n(
locale => 'en',
alt => undef,
);
Returns all the variants localised information as an array reference of hash reference from the table variants_l10n
week_preference
my $ref = $cldr->week_preference( locale => 'ja' );
# Returns an hash reference like this:
{
week_pref_id => 32,
locale => 'ja',
ordering => ["weekOfDate", "weekOfMonth"],
}
Returns an hash reference of a week preference information from the table week_preferences for a given locale ID.
The meaning of the fields are as follows:
week_pref_idA unique incremental value automatically generated by SQLite.
localeA
locale, such asenorja-JPas can be found in table localesorderingThis is "an ordered list of the preferred types of week designations for that"[1]
It is provided as an array of tokens.
Known values in the array are:
weekOfYearweekOfMonthweekOfDateweekOfInterval
See the LDML specifications for more information.
week_preferences
my $all = $cldr->week_preferences;
Returns all the week preferences information as an array reference of hash reference from the table week_preferences
Format Patterns
The following is taken directly from the Unicode LDML specifications and placed here for your convenience.
See also the ICU format patterns table.
Examples:
yyyy.MM.dd G 'at' HH:mm:ss zzz1996.07.10 AD at 15:08:56 PDT
EEE, MMM d, ''yyWed, July 10, '96
h:mm a12:08 PM
hh 'o''clock' a, zzzz12 o'clock PM, Pacific Daylight Time
K:mm a, z0:00 PM, PST
yyyyy.MMMM.dd GGG hh:mm aaa01996.July.10 AD 12:08 PM
See the date field symbols table for more details.
aperiodAM, PM
May be upper or lowercase depending on the locale and other options. The wide form may be the same as the short form if the “real” long form (eg ante meridiem) is not customarily used. The narrow form must be unique, unlike some other fields. See also Parsing Dates and Times.
Examples:
a..aaa(Abbreviated)am. [e.g. 12 am.]
aaaa(Wide)am. [e.g. 12 am.]
aaaaa(Narrow)a [e.g. 12a]
AsecondMilliseconds in day (numeric). This field behaves exactly like a composite of all time-related fields, not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This reflects the fact that it must be combined with the offset field to obtain a unique local time value. The field length specifies the minimum number of digits, with zero-padding as necessary.
Examples:
A+69540000
bperiodam, pm, noon, midnight
May be upper or lowercase depending on the locale and other options. If the locale doesn't have the notion of a unique "noon" = 12:00, then the PM form may be substituted. Similarly for "midnight" = 00:00 and the AM form. The narrow form must be unique, unlike some other fields.
Examples:
b..bbb(Abbreviated)mid. [e.g. 12 mid.]
bbbb(Wide)midnight
[e.g. 12 midnight]
bbbbb(Narrow)md [e.g. 12 md]
Bperiodflexible day periods
May be upper or lowercase depending on the locale and other options. Often there is only one width that is customarily used.
Examples:
B..BBB(Abbreviated)at night
[e.g. 3:00 at night]
BBBB(Wide)at night
[e.g. 3:00 at night]
BBBBB(Narrow)at night
[e.g. 3:00 at night]
cweek dayStand-Alone local day of week number/name.
Examples:
c..cc2
Numeric: 1 digit
ccc(Abbreviated)Tue
cccc(Wide)Tuesday
ccccc(Narrow)T
cccccc(Short)Tu
CInput skeleton symbol
It must not occur in pattern or skeleton data. Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation. In such a context, like 'j', it requests the preferred hour format for the locale. However, unlike 'j', it can also select formats such as hb or hB, since it is based not on the preferred attribute of the hours element in supplemental data, but instead on the first element of the allowed attribute (which is an ordered preferrence list). For example, with "Cmm", 18:00 could appear as “6:00 in the afternoon”.
Example:
C88(morning)Numeric hour (minimum digits), abbreviated dayPeriod if used
CC0808(morning)Numeric hour (2 digits, zero pad if needed), abbreviated dayPeriod if used
CCC88in the morningNumeric hour (minimum digits), wide dayPeriod if used
CCCC0808in the morningNumeric hour (2 digits, zero pad if needed), wide dayPeriod if used
CCCCC88(morn.)Numeric hour (minimum digits), narrow dayPeriod if used
CCCCCC0808(morn.)Numeric hour (2 digits, zero pad if needed), narrow dayPeriod if used
dday of monthDay of month (numeric).
Example:
d1
Numeric: minimum digits
dd01
Numeric: 2 digits, zero pad if needed
Dday of yearThe field length specifies the minimum number of digits, with zero-padding as necessary.
Example:
D...DDDday345 Day of year (numeric).
eweek dayLocal day of week number/name, format style. Same as E except adds a numeric value that will depend on the local starting day of the week. For this example, Monday is the first day of the week.
Example:
e2
Numeric: 1 digit
ee02
Numeric: 2 digits + zero pad
eee(Abbreviated)Tue
eeee(Wide)Tuesday
eeeee(Narrow)T
eeeeee(Short)Tu
Eweek dayDay of week name, format style.
Example:
E..EEE(Abbreviated)Tue
EEEE(Wide)Tuesday
EEEEE(Narrow)T
EEEEEE(Short)Tu
FdayDay of Week in Month (numeric). The example is for the 2nd Wed in July
Example:
F2
gModified Julian day (numeric). This is different from the conventional Julian day number in two regards. First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; that is, it depends on the local time zone. It can be thought of as a single number that encompasses all the date-related fields. The field length specifies the minimum number of digits, with zero-padding as necessary.
Example:
g+2451334
GeraEra name.
Example:
G..GGG(Abbreviated)AD
[variant: CE]
GGGG(Wide)Anno Domini
[variant: Common Era]
GGGGG(Narrow)A
hhourHour [1-12]. When used in skeleton data or in a skeleton passed in an API for flexible date pattern generation, it should match the 12-hour-cycle format preferred by the locale (h or K); it should not match a 24-hour-cycle format (H or k).
Example:
h1, 12
Numeric: minimum digits
hh01, 12
Numeric: 2 digits, zero pad if needed
HhourHour [0-23]. When used in skeleton data or in a skeleton passed in an API for flexible date pattern generation, it should match the 24-hour-cycle format preferred by the locale (H or k); it should not match a 12-hour-cycle format (h or K).
Example:
H0,23Numeric: minimum digits
HH00,23Numeric: 2 digits, zero pad if needed
jInput skeleton symbol
It must not occur in pattern or skeleton data. Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation. In such a context, it requests the preferred hour format for the locale (h, H, K, or k), as determined by the preferred attribute of the hours element in supplemental data. In the implementation of such an API, 'j' must be replaced by h, H, K, or k before beginning a match against availableFormats data.
Note that use of 'j' in a skeleton passed to an API is the only way to have a skeleton request a locale's preferred time cycle type (12-hour or 24-hour).
Example:
j88 AM131 PMNumeric hour (minimum digits), abbreviated dayPeriod if used
jj0808 AM1301 PMNumeric hour (2 digits, zero pad if needed), abbreviated dayPeriod if used
jjj88 A.M.131 P.M.Numeric hour (minimum digits), wide dayPeriod if used
jjjj0808 A.M.1301 P.M.Numeric hour (2 digits, zero pad if needed), wide dayPeriod if used
jjjjj88a131pNumeric hour (minimum digits), narrow dayPeriod if used
jjjjjj0808a1301pNumeric hour (2 digits, zero pad if needed), narrow dayPeriod if used
JInput skeleton symbol
It must not occur in pattern or skeleton data. Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation. In such a context, like 'j', it requests the preferred hour format for the locale (h, H, K, or k), as determined by the preferred attribute of the hours element in supplemental data. However, unlike 'j', it requests no dayPeriod marker such as “am/pm” (it is typically used where there is enough context that that is not necessary). For example, with "jmm", 18:00 could appear as “6:00 PM”, while with "Jmm", it would appear as “6:00” (no PM).
Example:
J88Numeric hour (minimum digits)
JJ0808Numeric hour (2 digits, zero pad if needed)
khourHour [1-24]. When used in a skeleton, only matches k or H, see above.
Example:
k1,24Numeric: minimum digits
kk01,24Numeric: 2 digits, zero pad if needed
KhourHour [0-11]. When used in a skeleton, only matches K or h, see above.
Example:
K0, 11
Numeric: minimum digits
KK00, 11
Numeric: 2 digits, zero pad if needed
LmonthStand-Alone month number/name: For use when the month is displayed by itself, and in any other date pattern (e.g. just month and year, e.g. "LLLL y") that shares the same form of the month name. For month names, this is typically the nominative form. See discussion of month element.
See also the symbol
Mfor month.Example:
L9, 12
Numeric: minimum digits
LL09, 12 Numeric: 2 digits, zero pad if needed
LLL(Abbreviated)Sep
LLLL(Wide)September
LLLLL(Narrow)S
MmonthNumeric: minimum digits Format style month number/name: The format style name is an additional form of the month name (besides the stand-alone style) that can be used in contexts where it is different than the stand-alone form. For example, depending on the language, patterns that combine month with day-of month (e.g. "d MMMM") may require the month to be in genitive form. See discussion of month element. If a separate form is not needed, the format and stand-alone forms can be the same.
See also
LExample:
M9, 12
MM09, 12 Numeric: 2 digits, zero pad if needed
MMM(Abbreviated)Sep
MMMM(Wide)September
MMMMM(Narrow)S
mminuteMinute (numeric). Truncated, not rounded.
Examples:
m8,59Numeric: minimum digits
mm08,59Numeric: 2 digits, zero pad if needed
OzoneExamples:
OGMT-8The short localized GMT format.
OOOOGMT-08:00The long localized GMT format.
qquarterStand-Alone Quarter number/name.
Examples:
q2Numeric: 1 digit
qq02Numeric: 2 digits + zero pad
qqq(Abbreviated)Q2qqqq(Wide)2nd quarterqqqqq(Narrow)2
QquarterQuarter number/name.
Examples:
Q2Numeric: 1 digit
QQ02Numeric: 2 digits + zero pad
QQQ(Abbreviated)Q2QQQQ(Wide)2nd quarterQQQQQ(Narrow)2
rRelated Gregorian year (numeric). For non-Gregorian calendars, this corresponds to the extended Gregorian year in which the calendar’s year begins. Related Gregorian years are often displayed, for example, when formatting dates in the Japanese calendar — e.g. “2012(平成24)年1月15日” — or in the Chinese calendar — e.g. “2012壬辰年腊月初四”. The related Gregorian year is usually displayed using the "latn" numbering system, regardless of what numbering systems may be used for other parts of the formatted date. If the calendar’s year is linked to the solar year (perhaps using leap months), then for that calendar the ‘r’ year will always be at a fixed offset from the ‘u’ year. For the Gregorian calendar, the ‘r’ year is the same as the ‘u’ year. For ‘r’, all field lengths specify a minimum number of digits; there is no special interpretation for “rr”.
Example:
r+2017
ssecondSecond (numeric). Truncated, not rounded.
Example:
s8,12Numeric: minimum digits
ss08,12Numeric: 2 digits, zero pad if needed
SsecondFractional Second (numeric). Truncates, like other numeric time fields, but in this case to the number of digits specified by the field length. (Example shows display using pattern SSSS for seconds value 12.34567)
Example:
S+3456
uExtended year (numeric). This is a single number designating the year of this calendar system, encompassing all supra-year fields. For example, for the Julian calendar system, year numbers are positive, with an era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE years and negative values to BCE years, with 1 BCE being year 0. For ‘u’, all field lengths specify a minimum number of digits; there is no special interpretation for “uu”.
Example:
u+4601
UCyclic year name. Calendars such as the Chinese lunar calendar (and related calendars) and the Hindu calendars use 60-year cycles of year names. If the calendar does not provide cyclic year name data, or if the year value to be formatted is out of the range of years for which cyclic name data is provided, then numeric formatting is used (behaves like 'y').
Currently the data only provides abbreviated names, which will be used for all requested name widths.
Example:
U..UUU(Abbreviated)甲子UUUU(Wide)甲子[for now]UUUUU(Narrow)甲子[for now]
vzoneExample:
vPTThe short generic non-location format Where that is unavailable, falls back to the generic location format ("VVVV"), then the short localized GMT format as the final fallback.
vvvvPacific TimeThe long generic non-location format. Where that is unavailable, falls back to generic location format ("VVVV").
VzoneExample:
VuslaxThe short time zone ID. Where that is unavailable, the special short time zone ID unk (Unknown Zone) is used. Note: This specifier was originally used for a variant of the short specific non-location format, but it was deprecated in the later version of this specification. In CLDR 23, the definition of the specifier was changed to designate a short time zone ID.
VVAmerica/Los_AngelesThe long time zone ID.
VVVLos AngelesThe exemplar city (location) for the time zone. Where that is unavailable, the localized exemplar city name for the special zone Etc/Unknown is used as the fallback (for example, "Unknown City").
VVVVLos Angeles TimeThe generic location format. Where that is unavailable, falls back to the long localized GMT format ("OOOO"; Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.)
This is especially useful when presenting possible timezone choices for user selection, since the naming is more uniform than the "v" format.
wWeek of Year (numeric). When used in a pattern with year, use ‘Y’ for the year field instead of ‘y’.
Example:
w8,27Numeric: minimum digits
ww08,27Numeric: 2 digits, zero pad if needed
WWeek of Month (numeric)
Example:
W3Numeric: 1 digit
xzoneExample:
x-08+0530+00The ISO8601 basic format with hours field and optional minutes field. (The same as X, minus "Z".)
xx-0800+0000The ISO8601 basic format with hours and minutes fields. (The same as XX, minus "Z".)
xxx-08:00+00:00The ISO8601 extended format with hours and minutes fields. (The same as XXX, minus "Z".)
xxxx-0800-075258+0000The ISO8601 basic format with hours, minutes and optional seconds fields. (The same as XXXX, minus "Z".)
Note: The seconds field is not supported by the ISO8601 specification.
xxxxx-08:00-07:52:58+00:00The ISO8601 extended format with hours, minutes and optional seconds fields. (The same as XXXXX, minus "Z".)
Note: The seconds field is not supported by the ISO8601 specification.
XzoneExample:
X-08+0530ZThe ISO8601 basic format with hours field and optional minutes field. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as x, plus "Z".)
XX-0800ZThe ISO8601 basic format with hours and minutes fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xx, plus "Z".)
XXX-08:00ZThe ISO8601 extended format with hours and minutes fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxx, plus "Z".)
XXXX-0800-075258ZThe ISO8601 basic format with hours, minutes and optional seconds fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxxx, plus "Z".)
Note: The seconds field is not supported by the ISO8601 specification.
XXXXX-08:00-07:52:58ZThe ISO8601 extended format with hours, minutes and optional seconds fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxxxx, plus "Z".)
Note: The seconds field is not supported by the ISO8601 specification.
yCalendar year (numeric). In most cases the length of the y field specifies the minimum number of digits to display, zero-padded as necessary; more digits will be displayed if needed to show the full year. However, “yy” requests just the two low-order digits of the year, zero-padded as necessary. For most use cases, “y” or “yy” should be adequate.
Example:
y2,20,201,2017,20173yy02,20,01,17,73yyy002,020,201,2017,20173yyyy0002,0020,0201,2017,20173yyyyy+...
YYear in “Week of Year” based calendars in which the year transition occurs on a week boundary; may differ from calendar year ‘y’ near a year transition. This numeric year designation is used in conjunction with pattern character ‘w’ in the ISO year-week calendar as defined by ISO 8601, but can be used in non-Gregorian based calendar systems where week date processing is desired. The field length is interpreted in the same was as for ‘y’; that is, “yy” specifies use of the two low-order year digits, while any other field length specifies a minimum number of digits to display.
Example:
Y2,20,201,2017,20173YY02,20,01,17,73YYY002,020,201,2017,20173YYYY0002,0020,0201,2017,20173YYYYY+...
zzoneExamples:
z..zzzPDTThe short specific non-location format. Where that is unavailable, falls back to the short localized GMT format ("O").
zzzzPacific Daylight TimeThe long specific non-location format. Where that is unavailable, falls back to the long localized GMT format ("OOOO").
ZExamples:
Z..ZZZ-0800The ISO8601 basic format with hours, minutes and optional seconds fields. The format is equivalent to RFC 822 zone format (when optional seconds field is absent). This is equivalent to the "xxxx" specifier.
ZZZZGMT-8:00The long localized GMT format. This is equivalent to the "OOOO" specifier.
ZZZZZ-08:00-07:52:58The ISO8601 extended format with hours, minutes and optional seconds fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. This is equivalent to the "XXXXX" specifier.
See the LDML specifications for more information on the date and time formatting.
Locale Inheritance
When performing data look-ups, some data, such as width, may be missing and the default wide should be used, and sometime, the data is aliased. For example, narrow would be aliased to abbreviated.
Then, there is also a vertical inheritance, whereby a locale fr-CA would lookup up data in its parent fr. When the inheritance is not natural, the LDML specifies a parent. This information can be found in table locales. Ultimately, the root locale with value und is to be used.
See the LDML specifications for more information.
Errors
This module does not die upon errors, unless you have set fatal to a true value. Instead it sets an error object that can be retrieved.
When an error occurred, an error object will be set and the method will return undef in scalar context and an empty list in list context.
Otherwise, the only occasions when this module will die is when there is an internal design error, which would be my fault.
Advanced Search
You can specify an operator other than the default = when providing arguments values, by placing it just before the argument value.
Possible explicit operators are:
=!=<<=>>=~Will enable the use of regular expression.
Alternatively, you can use a perl regular expression using the perl operator qr
For example:
my $all = $cldr->timezone_info(
timezone => 'Europe/Simferopol',
start => ['>1991-01-01','<1995-01-01'],
);
This would result in:
{
tzinfo_id => 594,
timezone => 'Europe/Simferopol',
metazone => 'Moscow',
start => '1994-04-30T21:00:00',
until => '1997-03-30T01:00:00',
}
or, using the ~ operator:
my $all = $cldr->time_formats(
region => '~^U.*',
);
my $all = $cldr->time_formats(
region => qr/^U.*/,
);
would result in:
[
{
time_format_id => 141,
region => "UA",
territory => "UA",
locale => undef,
time_format => "H",
time_allowed => [qw( H hB h )],
},
{
time_format_id => 142,
region => "UZ",
territory => "UZ",
locale => undef,
time_format => "H",
time_allowed => [qw( H hB h )],
},
{
time_format_id => 155,
region => "UG",
territory => "UG",
locale => undef,
time_format => "H",
time_allowed => [qw( hB hb H h )],
},
{
time_format_id => 194,
region => "UY",
territory => "UY",
locale => undef,
time_format => "h",
time_allowed => [qw( h H hB hb )],
},
{
time_format_id => 226,
region => "UM",
territory => "UM",
locale => undef,
time_format => "h",
time_allowed => [qw( h hb H hB )],
},
{
time_format_id => 227,
region => "US",
territory => "US",
locale => undef,
time_format => "h",
time_allowed => [qw( h hb H hB )],
},
]
For single result methods, i.e. the methods that only return an hash reference, you can provide an array reference instead of a regular string for the primary field you are trying to query. So, for example, using the example above with the timezone info:
my $all = $cldr->timezone_info(
timezone => 'Europe/Simferopol',
start => ['>1991-01-01','<1995-01-01'],
);
or, querying the calendar terms:
my $all = $cldr->calendar_term(
locale => 'und',
calendar => 'gregorian',
# format, stand-alone
term_context => 'format',
# abbreviated, narrow, wide
term_width => 'abbreviated',
term_name => [qw( am pm )],
);
# Returns an array reference like:
[
{
cal_term_id => 23478,
locale => 'und',
calendar => 'gregorian',
term_type => 'day_period',
term_context => 'format',
term_width => 'abbreviated',
alt => undef,
term_name => 'am',
term_value => 'AM',
},
{
cal_term_id => 23479,
locale => 'und',
calendar => 'gregorian',
term_type => 'day_period',
term_context => 'format',
term_width => 'abbreviated',
alt => undef,
term_name => 'pm',
term_value => 'PM',
},
]
Of course, instead of returning an hash reference, as it normally would, it will return an array reference of hash reference.
You can check if a table field containing an array has a certain value. For example:
my $all = $cldr->metazones(
has => [territories => 'CA'],
);
This will return all metazone entries that have the array value CA in the field territories.
You can specify more than one field:
my $all = $cldr->metazones(
has => [territories => 'CA', timezones => 'America/Chicago'],
);
You can also use an hash reference instead of an array reference:
my $all = $cldr->metazones(
has => {
territories => 'CA',
timezones => 'America/Chicago',
},
);
And if the table contains only one array field, then you do not have tp specify the field name:
my $all = $cldr->aliases(
has => 'America/Toronto',
);
This will implicitly use the field replacement. However, if there are more than one array field, and you do not specify which one, then an error will be triggered. For example:
my $all = $cldr->metazones(
has => 'CA',
);
say $cldr->error->message;
# "There are 2 fields with array. You need to specify which one you want to check for value 'CA'"
You can also ensure a certain order based on a field value. For example, you want to retrieve the day terms using calendar_term, but the term_name are string, and we want to ensure the results are sorted in this order: mon, tue, wed, thu, fri, sat and sun
my $terms = $cldr->calendar_terms(
locale => 'en',
calendar => 'gregorian',
term_type => 'day',
term_context => 'format',
term_width => 'wide',
order_by_value => [term_name => [qw( mon tue wed thu fri sat sun )]],
);
my @weekdays = map( $_->{term_name}, @$terms );
# Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
If we had wanted to put Sunday first, we would have done:
my $terms = $cldr->calendar_terms(
locale => 'en',
calendar => 'gregorian',
term_type => 'day',
term_context => 'format',
term_width => 'wide',
order_by_value => [term_name => [qw( sun mon tue wed thu fri sat )]],
);
The parameter order_by_value supersedes the parameter order that may be provided.
You can specify a particular data type to sort the values returned by SQLite, by providing the argument order, such as:
my $months = $cldr->calendar_terms(
locale => 'en',
calendar => 'gregorian',
term_type => 'month',
term_context => 'format',
term_width => 'wide',
order => [term_name => 'integer'],
);
or, alternatively, using an hash reference with a single key:
my $months = $cldr->calendar_terms(
locale => 'en',
calendar => 'gregorian',
term_type => 'month',
term_context => 'format',
term_width => 'wide',
order => { term_name => 'integer' },
);
my @month_names = map( $_->{term_name}, @$months );
# January, February, March, April, May, June, July, August, September, October, November, December
SQL Schema
The SQLite SQL schema is available in the file scripts/cldr-schema.sql
The data are populated into the SQLite database using the script located in scripts/create_database.pl and the data accessible from https://github.com/unicode-org/cldr or from https://cldr.unicode.org/index/downloads/
Tables
The SQL schema used to create the SQLite database is available in the scripts directory of this distribution in the file cldr-schema.sql
The tables used are as follows, in alphabetical order:
Table aliases
alias_idAn integer field.
aliasA string field.
replacementA string array field.
reasonA string field.
typeA string field.
commentA string field.
Table annotations
annotation_idAn integer field.
localeA string field.
annotationA string field.
defaultsA string array field.
ttsA string field.
Table bcp47_currencies
bcp47_curr_idAn integer field.
curridA string field.
codeA string field.
descriptionA string field.
is_obsoleteA boolean field.
Table bcp47_extensions
bcp47_ext_idAn integer field.
categoryA string field.
extensionA string field.
aliasA string field.
value_typeA string field.
descriptionA string field.
deprecatedA boolean field.
Table bcp47_timezones
bcp47_tz_idAn integer field.
tzidA string field.
aliasA string array field.
preferredA string field.
descriptionA string field.
deprecatedA boolean field.
Table bcp47_values
bcp47_value_idAn integer field.
categoryA string field.
extensionA string field.
valueA string field.
descriptionA string field.
Table calendar_append_formats
cal_append_fmt_idAn integer field.
localeA string field.
calendarA string field.
format_idA string field.
format_patternA string field.
Table calendar_available_formats
cal_avail_fmt_idAn integer field.
localeA string field.
calendarA string field.
format_idA string field.
format_patternA string field.
countA string field.
altA string field.
Table calendar_cyclics_l10n
cal_int_fmt_idAn integer field.
localeA string field.
calendarA string field.
format_setA string field.
format_typeA string field.
format_lengthA string field.
format_idAn integer field.
format_patternA string field.
Table calendar_datetime_formats
cal_dt_fmt_idAn integer field.
localeA string field.
calendarA string field.
format_lengthA string field.
format_typeA string field.
format_patternA string field.
Table calendar_eras
calendar_era_idAn integer field.
calendarA string field.
sequenceAn integer field.
codeA string field.
aliasesA string array field.
startA date field.
untilA date field.
Table calendar_eras_l10n
cal_era_l10n_idAn integer field.
localeA string field.
calendarA string field.
era_widthA string field.
era_idA string field.
altA string field.
locale_nameA string field.
Table calendar_formats_l10n
cal_fmt_l10n_idAn integer field.
localeA string field.
calendarA string field.
format_typeA string field.
format_lengthA string field.
altA string field.
format_idA string field.
format_patternA string field.
Table calendar_interval_formats
cal_int_fmt_idAn integer field.
localeA string field.
calendarA string field.
format_idA string field.
greatest_diff_idA string field.
format_patternA string field.
altA string field.
part1A string field.
separatorA string field.
part2A string field.
repeating_fieldA string field.
Table calendar_terms
cal_term_idAn integer field.
localeA string field.
calendarA string field.
term_typeA string field.
term_contextA string field.
term_widthA string field.
altA string field.
yeartypeA string field.
term_nameA string field.
term_valueA string field.
Table calendars
calendar_idAn integer field.
calendarA string field.
systemA string field.
inheritsA string field.
descriptionA string field.
Table calendars_l10n
calendar_l10n_idAn integer field.
localeA string field.
calendarA string field.
locale_nameA string field.
Table casings
casing_idAn integer field.
localeA string field.
tokenA string field.
valueA string field.
Table code_mappings
code_mapping_idAn integer field.
codeA string field.
alpha3A string field.
numericAn integer field.
fips10A string field.
typeA string field.
Table collations_l10n
collation_l10n_idAn integer field.
localeA string field.
collationA string field.
locale_nameA string field.
Table currencies
currency_idAn integer field.
currencyA string field.
digitsAn integer field.
roundingAn integer field.
cash_digitsAn integer field.
cash_roundingAn integer field.
is_obsoleteA boolean field.
statusA string field.
Table currencies_info
currency_info_idAn integer field.
territoryA string field.
currencyA string field.
startA date field.
untilA date field.
is_tenderA boolean field.
hist_sequenceAn integer field.
is_obsoleteA boolean field.
Table currencies_l10n
curr_l10n_idAn integer field.
localeA string field.
currencyA string field.
countA string field.
locale_nameA string field.
symbolA string field.
Table date_fields_l10n
date_field_idAn integer field.
localeA string field.
field_typeA string field.
field_lengthA string field.
relativeAn integer field.
locale_nameA string field.
Table date_terms
date_term_idAn integer field.
localeA string field.
term_typeA string field.
term_lengthA string field.
display_nameA string field.
Table day_periods
day_period_idAn integer field.
localeA string field.
day_periodA string field.
startA string field.
untilA string field.
Table language_population
language_pop_idAn integer field.
territoryA string field.
localeA string field.
population_percentA decimal field.
literacy_percentA decimal field.
writing_percentA decimal field.
official_statusA string field.
Table languages
language_idAn integer field.
languageA string field.
scriptsA string array field.
territoriesA string array field.
parentA string field.
altA string field.
statusA string field.
Table languages_match
lang_match_idAn integer field.
desiredA string field.
supportedA string field.
distanceAn integer field.
is_symetricA boolean field.
is_regexpA boolean field.
sequenceAn integer field.
Table likely_subtags
likely_subtag_idAn integer field.
localeA string field.
targetA string field.
Table locale_number_systems
locale_num_sys_idAn integer field.
localeA string field.
number_systemA string field.
nativeA string field.
traditionalA string field.
financeA string field.
Table locales
locale_idAn integer field.
localeA string field.
parentA string field.
collationsA string array field.
statusA string field.
Table locales_info
locales_info_idAn integer field.
localeA string field.
propertyA string field.
valueA string field.
Table locales_l10n
locales_l10n_idAn integer field.
localeA string field.
locale_idA string field.
locale_nameA string field.
altA string field.
Table metainfos
meta_idAn integer field.
propertyA string field.
valueA string field.
Table metazones
metazone_idAn integer field.
metazoneA string field.
territoriesA string array field.
timezonesA string array field.
Table metazones_names
metatz_name_idAn integer field.
localeA string field.
metazoneA string field.
widthA string field.
genericA string field.
standardA string field.
daylightA string field.
Table number_formats_l10n
number_format_idAn integer field.
localeA string field.
number_systemA string field.
number_typeA string field.
format_lengthA string field.
format_typeA string field.
format_idA string field.
format_patternA string field.
altA string field.
countA string field.
Table number_symbols_l10n
number_symbol_idAn integer field.
localeA string field.
number_systemA string field.
propertyA string field.
valueA string field.
altA string field.
Table number_systems
numsys_idAn integer field.
number_systemA string field.
digitsA string array field.
typeA string field.
Table number_systems_l10n
num_sys_l10n_idAn integer field.
localeA string field.
number_systemA string field.
locale_nameA string field.
altA string field.
Table person_name_defaults
pers_name_def_idAn integer field.
localeA string field.
valueA string field.
Table rbnf
rbnf_idAn integer field.
localeA string field.
groupingA string field.
rulesetA string field.
rule_idA string field.
rule_valueA string field.
Table refs
ref_idAn integer field.
codeA string field.
uriA string field.
descriptionA string field.
Table scripts
script_idAn integer field.
scriptA string field.
rankAn integer field.
sample_charA string field.
id_usageA string field.
rtlA boolean field.
lb_lettersA boolean field.
has_caseA boolean field.
shaping_reqA boolean field.
imeA boolean field.
densityAn integer field.
origin_countryA string field.
likely_languageA string field.
statusA string field.
Table scripts_l10n
scripts_l10n_idAn integer field.
localeA string field.
scriptA string field.
locale_nameA string field.
altA string field.
Table subdivisions
subdivision_idAn integer field.
territoryA string field.
subdivisionA string field.
parentA string field.
is_top_levelA boolean field.
statusA string field.
Table subdivisions_l10n
subdiv_l10n_idAn integer field.
localeA string field.
subdivisionA string field.
locale_nameA string field.
Table territories
territory_idAn integer field.
territoryA string field.
parentA string field.
gdpAn integer field.
literacy_percentA decimal field.
populationAn integer field.
languagesA string array field.
containsA string array field.
currencyA string field.
calendarsA string array field.
min_daysAn integer field.
first_dayAn integer field.
weekendAn integer array field.
statusA string field.
Table territories_l10n
terr_l10n_idAn integer field.
localeA string field.
territoryA string field.
locale_nameA string field.
altA string field.
Table time_formats
time_format_idAn integer field.
regionA string field.
territoryA string field.
localeA string field.
time_formatA string field.
time_allowedA string array field.
Table time_relative_l10n
time_relative_idAn integer field.
localeA string field.
field_typeA string field.
field_lengthA string field.
relativeAn integer field.
format_patternA string field.
countA string field.
Table timezones
timezone_idAn integer field.
timezoneA string field.
territoryA string field.
regionA string field.
tzidA string field.
metazoneA string field.
tz_bcpidA string field.
is_goldenA boolean field.
is_primaryA boolean field.
is_preferredA boolean field.
is_canonicalA boolean field.
aliasA string array field.
Table timezones_cities
tz_city_idAn integer field.
localeA string field.
timezoneA string field.
cityA string field.
altA string field.
Table timezones_cities_supplemental
tz_city_idAn integer field.
localeA string field.
timezoneA string field.
cityA string field.
altA string field.
Table timezones_formats
tz_fmt_idAn integer field.
localeA string field.
typeA string field.
subtypeA string field.
format_patternA string field.
Table timezones_info
tzinfo_idAn integer field.
timezoneA string field.
metazoneA string field.
startA datetime field.
untilA datetime field.
Table timezones_names
tz_name_idAn integer field.
localeA string field.
timezoneA string field.
widthA string field.
genericA string field.
standardA string field.
daylightA string field.
Table unit_aliases
unit_alias_idAn integer field.
aliasA string field.
targetA string field.
reasonA string field.
Table unit_constants
unit_constant_idAn integer field.
constantA string field.
expressionA string field.
valueA decimal field.
descriptionA string field.
statusA string field.
Table unit_conversions
unit_conversion_idAn integer field.
sourceA string field.
base_unitA string field.
expressionA string field.
factorA decimal field.
systemsA string array field.
categoryA string field.
Table unit_prefixes
unit_prefix_idAn integer field.
unit_idA string field.
symbolA string field.
powerAn integer field.
factorAn integer field.
Table unit_prefs
unit_pref_idAn integer field.
unit_idA string field.
territoryA string field.
categoryA string field.
usageA string field.
geqA decimal field.
skeletonA string field.
Table unit_quantities
unit_quantity_idAn integer field.
base_unitA string field.
quantityA string field.
statusA string field.
commentA string field.
Table units_l10n
units_l10n_idAn integer field.
localeA string field.
format_lengthA string field.
unit_typeA string field.
unit_idA string field.
unit_patternA string field.
pattern_typeA string field.
locale_nameA string field.
countA string field.
genderA string field.
gram_caseA string field.
Table variants
variant_idAn integer field.
variantA string field.
statusA string field.
Table variants_l10n
var_l10n_idAn integer field.
localeA string field.
variantA string field.
locale_nameA string field.
altA string field.
Table week_preferences
week_pref_idAn integer field.
localeA string field.
orderingA string array field.
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
Locale::Unicode, DateTime::Locale::FromCLDR, DateTime::Formatter::Unicode, DateTime::Locale::FromData, DateTime::Format::CLDR
CREDITS
Credits to GeoNames (http://www.geonames.org) and its data that helped build the time zones extended exemplar cities data in many localised versions.
GeoNames is a project of Unxos GmbH, Tutilostrasse 17d, 9011 St. Gallen, Switzerland, and managed by Marc Wick.
GeoNames data is licensed under a Creative Commons Attribution 4.0 License.
COPYRIGHT & LICENSE
Copyright(c) 2024 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.