# perldoc > DateTime::Locale

---
type: CommandReference
command: DateTime::Locale
mode: perldoc
section: 
source: perldoc
---

## Quick Reference
- `DateTime::Locale->load('en-GB')` — load locale by code or English/native name
- `$loc->native_name` — get locale's native name (UTF-8)
- `$loc->datetime_format_long` — get long datetime format pattern
- `DateTime->now( locale => 'fr' )` — use locale in DateTime constructor
- `DateTime::Locale->codes` — list all available locale codes (no aliases)
- `DateTime::Locale->names` — list all English locale names
- `DateTime::Locale->native_names` — list all native locale names
- `DateTime::Locale->register_from_data(\%data)` — register a custom locale

## Name
Localization support for DateTime.pm

## Synopsis
perl
use DateTime::Locale;

my $loc = DateTime::Locale->load('en-GB');
print $loc->native_name, "\n", $loc->datetime_format_long, "\n";

my $dt = DateTime->now( locale => 'fr' );
print "Aujourd'hui le mois est " . $dt->month_name, "\n";
## Methods
- `load( $locale_code | $locale_name )` — returns the locale object for the given code or name. If not found, falls back through `{language}-{script}-{territory}`, `{language}-{script}`, `{language}-{territory}-{variant}`, `{language}-{territory}`, `{language}`. Throws exception if no match. Loaded locales are cached; cache cleared by `register_from_data`, `add_aliases`, or `remove_alias`.
- `codes` — unsorted list of available locale codes (without aliases). Returns array in list context, arrayref in scalar.
- `names` — unsorted list of English locale names.
- `native_names` — unsorted list of native locale names (UTF-8).
- `register_from_data( $locale_data )` — registers a custom locale from a hashref. Keys match accessor methods in [DateTime::Locale::FromData](https://metacpan.org/pod/DateTime::Locale::FromData). Derived keys like `*_code`, `id`, `prefers_24_hour_time`, `date_format_default`, etc., are computed automatically.

## Examples
### Custom locale based on en-US
perl
my $locale = DateTime::Locale->load('en-US');
my %data   = $locale->locale_data;
$data{code}               = 'en-US-CUSTOM';
$data{time_format_medium} = 'HH:mm:ss';

DateTime::Locale->register_from_data(\%data);

# Prints 18:24:38
say DateTime->now( locale => 'en-US-CUSTOM' )->strftime('%X');

# Prints 6:24:38 PM
say DateTime->now( locale => 'en-US' )->strftime('%X');
## See Also
- [DateTime::Locale::FromData](https://metacpan.org/pod/DateTime::Locale::FromData) — locale object methods
- [DateTime::Locale::Catalog](https://metacpan.org/pod/DateTime::Locale::Catalog) — available codes/names
- [DateTime](https://metacpan.org/pod/DateTime) — the core DateTime module
- [CLDR bug reports](http://unicode.org/cldr/filing_bug_reports.html) — report data errors upstream
- Mailing list: [datetime@perl.org](mailto:datetime@perl.org)