DateTime-Locale-FromCLDR
view release on metacpan or search on metacpan
string.
native_variant
my $locale = DateTime::Locale::FromCLDR->new( 'es-valencia' );
say $locale->native_variant; # Valenciano
my $locale = DateTime::Locale::FromCLDR->new( 'es' );
say $locale->native_variant; # undef
my $locale = DateTime::Locale::FromCLDR->new( 'en-Latn-005' );
say $locale->native_variant; # undef
Returns the "locale"'s "variant" name as written in the "locale" own
language.
If there is no "variant" specified in the "locale", it will return
"undef", and if there is more than one "variant" it will return the
value for the first one only. To get the values for all variants, use
native_variants
If there is a "variant" in the "locale", but, somehow, it cannot be
found in the "locale"'s own language tree, it will return an empty
string.
native_variants
my $locale = DateTime::Locale::FromCLDR->new( 'ja-Latn-fonipa-hepburn-heploc' );
say $locale->native_variants;
# ["IPA Phonetics", "Hepburn romanization", ""]
Here, "heploc" is an empty string in the array, because it is a
deprecated "variant", and as such there is no localised name value for
it in the "CLDR" data.
my $locale = DateTime::Locale::FromCLDR->new( 'es' );
say $locale->native_variants; # []
Returns an array reference of each of the "locale"'s "variant" subtag
name as written in the "locale" own language.
If there is no "variant" specified in the "locale", it will return an
empty array.
If a "variant" subtag cannot be found in the "locale"'s own language
tree, then an empty string will be set in the array instead.
Either way, the size of the array will always be equal to the number of
variants in the "locale"
number_symbols
my $locale = DateTime::Locale::FromCLDR->new( 'en' );
my $ref = $locale->number_symbols;
my $ref = $locale->number_symbols( 'latn' );
# {
# approximately => "~",
# decimal => ".",
# exponential => "E",
# group => ",",
# infinity => "â",
# list => ";",
# minus => "-",
# nan => "NaN",
# per_mille => "â°",
# percent => "%",
# plus => "+",
# superscript => "\xD7",
# time_separator => ":",
# }
Returns an hash reference of a locale's number symbols.
If somehow, none were found, it returns an empty hash reference, so make
sure to check for the size of the hash reference returned.
Upon error, it sets an exception object and returns "undef" in scalar
context, and an empty list in list context.
Below are all the possible symbols available:
Quoted sentences are from the Unicode LDML specifications
<https://unicode.org/reports/tr35/tr35-numbers.html#Number_Symbols>.
* "approximately"
"Symbol used to denote a value that is approximate but not exact."
For example "~", "â", "â", "ç´"
* "currency_decimal"
"Used as the decimal separator instead of using the regular
"decimal" separator"
For example "."
* "currency_group"
"Used as the group separator instead of using the regular "group"
separator"
For example "."
* "decimal"
"Separates the integer and fractional part of the number."
For example ".", "Ù«", ","
* "exponential"
"Symbol separating the mantissa and exponent values."
For example "E", "e", "Ã10^", "·10^"
* "group"
"Separates clusters of integer digits to make large numbers more
legible"
For example ",", "Ù¬", ".", "Ø", "â", "â¹"
* "infinity"
"The infinity sign. Corresponds to the IEEE infinity bit pattern."
For example "â", "INF"
* "list"
"Symbol used to separate numbers in a list intended to represent
structured data such as an array; must be different from the decimal
value."
For example ";"
* "minus"
"Symbol used to denote negative value."
For example "-"
Note that, in the CLDR data, although it is always a visually
identical representation, the character itself used varies,
depending on the locale used. For example: "-" ("\x{2D}") vs "-"
("\x{D8}\x{9C}\x{2D}")
* "nan"
The NaN sign. Corresponds to the IEEE NaN bit pattern.
For example "NaN", "не ÑиÑло"
* "per_mille"
"Symbol used to indicate a per-mille (1/1000th) amount."
For example "â°", "Ø", "0/00"
* "percent"
"Symbol used to indicate a percentage (1/100th) amount."
For example "%", "Ùª"
* "plus"
"Symbol used to denote positive value."
For example "+"
* "superscript"
For example "Ã", "(^)"
* "time_separator"
This is intended to replace "any use of the "timeSeparator" pattern
character in a date-time format pattern"
For example ":", "Ù«", "."
number_system
my $locale = DateTime::Locale::FromCLDR->new( 'ar-EG' );
say $locale->number_system;
# arab
my $locale = DateTime::Locale::FromCLDR->new( 'ja' );
say $locale->number_system;
# latn
Returns a string representing the number system for the "locale"
number_system_digits
my $locale = DateTime::Locale::FromCLDR->new( 'en' );
my $digits = $locale->number_system_digits( 'latn' );
say $digits; # [0, 1, 2, 3, 4, 5, 6, 7, 8. 9];
# Japanese traditional numbering system
my $digits = $locale->number_system_digits( 'jpan' );
say $digits; # ["ã","ä¸","äº","ä¸","å","äº","å
","ä¸","å
«","ä¹"];
Provided with a valid number system ID, and this will return an array
reference of digits for that number system, from 0 to 9.
It sets an exception object upon error, and returns "undef" in scalar
context, or an empty list in list context.
prefers_24_hour_time
This checks whether the "locale" prefers the 24H format or the 12H one
and returns true (1) if it prefers the 24 hours format or false (0)
otherwise.
( run in 1.030 second using v1.01-cache-2.11-cpan-39bf76dae61 )