DateTime-Locale-FromCLDR
view release on metacpan or search on metacpan
my $locale = DateTime::Locale::FromCLDR->new( 'es' );
my $script = $locale->variant;
# undef
# No such thing as variant 'klingon'. Language 'tlh' exists though :)
my $locale = DateTime::Locale::FromCLDR->new( 'en-klingon' );
my $script = $locale->variant;
# ''
Returns the name of the "locale"'s "variant" in English.
If there is no "variant" specified in the "locale", it will return
"undef"
If there is a "variant" in the "locale", but, somehow, it cannot be
found in the "en" "locale"'s language tree, it will return an empty
string.
variant_code
my $locale = DateTime::Locale::FromCLDR->new( 'es-valencia' );
my $script = $locale->variant_code;
# valencia
my $locale = DateTime::Locale::FromCLDR->new( 'es-ES' );
my $script = $locale->variant_code;
# undef
Returns the "locale"'s "variant" ID, or "undef" if there is none.
variant_id
This is an alias for variant_code
variants
my $locale = DateTime::Locale::FromCLDR->new( 'es-valencia' );
my $array = $locale->variants;
# ["valencia"]
my $locale = DateTime::Locale::FromCLDR->new( 'ja-Latn-fonipa-hepburn-heploc' );
my $array = $locale->variants;
# ["fonipa", "hepburn", "heploc"]
my $locale = DateTime::Locale::FromCLDR->new( 'en' );
my $array = $locale->variants;
# []
This returns an array reference of "variant" subtags for this "locale",
even if there is no variant.
version
my $locale = DateTime::Locale::FromCLDR->new( 'en' );
say $locale->version; # 45.0
Returns the Unicode "CLDR" data version number.
SERIALISATION
"Locale::Unicode" supports Storable::Improved, Storable, Sereal and CBOR
serialisation, by implementing the methods "FREEZE", "THAW",
"STORABLE_freeze", "STORABLE_thaw"
For serialisation with Sereal, make sure to instantiate the Sereal
encoder with the "freeze_callbacks" option set to true, otherwise,
"Sereal" will not use the "FREEZE" and "THAW" methods.
See "FREEZE/THAW CALLBACK MECHANISM" in Sereal::Encoder for more
information.
For CBOR, it is recommended to use the option "allow_sharing" to enable
the reuse of references, such as:
my $cbor = CBOR::XS->new->allow_sharing;
Also, if you use the option "allow_tags" with JSON, then all of those
modules will work too, since this option enables support for the
"FREEZE" and "THAW" methods.
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
Locale::Unicode, Locale::Unicode::Data, DateTime::Format::Unicode
DateTime::Locale
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.
( run in 1.034 second using v1.01-cache-2.11-cpan-39bf76dae61 )