=head2 Subclass an existing locale.
The following example sublasses the United Kingdom English locale to
provide different date/time formats:
package Ridas::Locale::en_GB_RIDAS1;
use strict;
use DateTime::Locale::en_GB;
@Ridas::Locale::en_GB_RIDAS1::ISA = qw ( DateTime::Locale::en_GB );
my $locale_id = 'en_GB_RIDAS1';
my $date_formats =
{
'full' => '%A %{day} %B %{ce_year}',
'long' => '%{day} %B %{ce_year}',
'medium' => '%{day} %b %{ce_year}',
'short' => '%{day}/%m/%y',
};
my $time_formats =
{
'full' => '%H h %{minute} %{time_zone_short_name}',
'long' => '%{hour12}:%M:%S %p',
'medium' => '%{hour12}:%M:%S %p',
'short' => '%{hour12}:%M %p',
};
sub short_date_format { $date_formats{short} }
sub medium_date_format { $date_formats{medium} }
sub long_date_format { $date_formats{long} }
sub full_date_format { $date_formats{full} }
sub short_time_format { $time_formats{short} }
sub medium_time_format { $time_formats{medium} }
sub long_time_format { $time_formats{long} }
sub full_time_format { $time_formats{full} }
1;
Now register it:
DateTime::Locale->register
( id => 'en_GB_RIDAS1',
# name, territory, and variant as described in register() documentation
class => 'Ridas::Locale::en_GB_RIDAS1' );
=head2 Creating a completely new locale
A completely new custom locale must implement the following methods:
id
month_names
month_abbreviations
day_names
day_abbreviations
am_pms
eras
short_date_format
medium_date_format
long_date_format
full_date_format
short_time_format
medium_time_format
long_time_format
full_time_format
datetime_format_pattern_order
date_parts_order
_default_date_format_length
_default_time_format_length
See C<DateTime::Locale::Base> for a description of each method, and
take a look at F<DateTime/Locale/root.pm> for an example of a complete
implementation.
You are, of course, free to subclass C<DateTime::Locale::Base> if you
want to, though this is not required.
Once created, remember to register it!
Of course, you can always do the registration in the module itself,
and simply load it before using it.
=head1 LOCALE OBJECT METHODS
All objects that inherit from C<DateTime::Locale::Base> will offer
certain methods. All the included locales are
C<DateTime::Locale::Base> subclasses.
The following methods can be used to get information about the
locale's id and name.
=7= |