NAME
Time::Keeper::Locale - what CLDR says of every locale Time::Keeper knows
VERSION
Version 0.01
SYNOPSIS
use Time::Keeper::Locale;
my @codes = Time::Keeper::Locale->codes; # 1121 of them
Time::Keeper::Locale->name('fr_CA'); # French (Canada)
Time::Keeper::Locale->native_name('fr-CA'); # français (Canada)
Time::Keeper::Locale->first_day_of_week('en-GB'); # 1, Monday
Time::Keeper::Locale->names('de', 'months', 'abbreviated');
Time::Keeper::Locale->cldr_version; # 48.2.3
DESCRIPTION
The calendar names and formats a Time::Keeper value uses come from the Unicode Common Locale Data Repository (CLDR). This module answers questions about that data without a value.
Every method is a class method and takes a locale's code first. A code is matched without regard to case, with _ taken as -: fr_CA, fr-ca and fr-CA are one locale. Every locale in CLDR's full set is here, and every code CLDR lists as default content, which names its parent's data (fr-FR is fr), as DateTime::Locale has them; and CLDR's aliases for retired codes, such as iw for he, in for id. A code it does not know is an error.
A locale's data is read the first time something asks for it, and kept for the life of the process. English is always there and reads nothing.
METHODS
codes
The codes of every locale, English first.
code
Time::Keeper::Locale->code('EN_gb'); # en-GB
Time::Keeper::Locale->code('iw'); # he
Time::Keeper::Locale->code('xx'); # undef
The locale's code as Time::Keeper writes it, or undef for one it does not know. This is the one method that does not die for an unknown code.
name
native_name
The locale's name in English, and in its own language: French (Canada) and français (Canada), as CLDR's display pattern makes them.
cldr_version
The CLDR release the data was compiled from.
first_day_of_week
The first day of the week where the locale is used, 1 for Monday to 7 for Sunday: 7 in the United States, 1 in most of Europe, 6 in some countries. The locale's region decides it; a language with no region takes the one CLDR thinks most likely (fr is France).
min_days_in_first_week
How many days of January the first week of a year must hold: 4 where weeks are counted as ISO 8601 counts them, 1 in the United States.
prefers_24_hour_time
True if the locale's own times are written with a 24-hour clock.
names
my @months = Time::Keeper::Locale->names('fr', 'months');
my @days = Time::Keeper::Locale->names('fr', 'days', 'abbreviated', 'stand-alone');
A list of names: months (January first), days (Monday first), quarters, eras (before Christ, then after) or am_pm. A width may follow, wide (the default), abbreviated or narrow, and short for days; and a context, format (the default), the form used inside a date, or stand-alone, the form used alone. Where a language has only one form the two are the same.
formats
my ($full, $long, $medium, $short) = Time::Keeper::Locale->formats('ja', 'date');
The locale's four CLDR patterns for date, time or datetime. In a datetime pattern {1} is the date and {0} the time.
available_formats
A hash reference of the locale's patterns by skeleton, as "format_skeleton" in Time::Keeper uses them.
parts
my $p = Time::Keeper::Locale->parts('zh-Hant-TW');
$p->{territory}; # TW
$p->{script_name}; # Traditional
$p->{native_territory_name}; # 台灣
The locale's subtags, language, script, territory and variant (undef for those it does not have), with each one's name in English (language_name and so on) and in the locale itself (native_language_name and so on), as a hash reference.
digits
The ten digits the locale writes, 0 to 9: 0 to 9 in most, ٠ to ٩ in ar-EG, ০ to ৯ in bn.
SEE ALSO
Time::Keeper, https://cldr.unicode.org/
AUTHOR
LNATION, <email at lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
The locale data is from the Unicode Common Locale Data Repository, Copyright (c) 1991-2026 Unicode, Inc., under the Unicode License v3.