The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DateTime::Locale::Catalog - Provides a list of all valid locale names

SYNOPSIS

See DateTime::Locale for usage details.

DESCRIPTION

This module contains a list of all known locales.

LOCALES

Any method taking locale id or name arguments should use one of the values listed below. Ids and names are case sensitive. The id starts with the ISO639-1 language code, and may also include information identifying any or all of territory, script, or variant.

Always select the closest matching locale - for example, French Canadians would choose fr_CA over fr - and always use locale ids in preference to names; locale ids offer greater compatibility when using localized third party modules.

The available locales are:

 Locale id           Locale name
 ==================================================
$locales_in_pod

There are also many aliases available, mostly for three-letter (ISO639-2) language codes, these are:

 Locale id           Is an alias for
 ==================================================
$aliases_in_pod

SUPPORT

See DateTime::Locale.

AUTHOR

Dave Rolsky <autarch\@urth.org>

COPYRIGHT

Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license.

NAME

$class

SYNOPSIS

  use DateTime;

  my \$dt = DateTime->now( locale => '$id' );
  print \$dt->month_name();

DESCRIPTION

This is the DateTime locale package for $name.

DATA

EOF

    if ( $id ne 'root' ) {
        print {$fh} 'This locale inherits from the L<DateTime::Locale::'
            . $ldml->parent_id()
            . "> locale.\n\n";
    }

    print {$fh} "It contains the following data.\n\n";
}

sub pod_for_days { my $locale = shift;

    return pod_for_variations( $locale, 'day' );
}

sub pod_for_months { my $locale = shift;

    return pod_for_variations( $locale, 'month' );
}

sub pod_for_quarters { my $locale = shift;

    return pod_for_variations( $locale, 'quarter' );
}

sub pod_for_eras { my $locale = shift;

    return pod_for_variations( $locale, 'era' );
}

sub pod_for_variations { my $locale = shift; my $thing = shift;

    my $pod = '';

    my $pl = PL_N($thing);
    $pod .= "=head2 \u$pl\n\n";

    my @forms = $thing eq 'era' ? ('') : ( 'format', 'stand_alone' );

    for my $form (@forms) {
        for my $size (qw( wide abbreviated narrow )) {
            my $meth
                = $form
                ? $thing . q{_} . $form . q{_} . $size
                : $thing . q{_} . $size;

            next unless $locale->can($meth);

            my $head = ucfirst $size;

            if ($form) {
                ( my $f = $form ) =~ s/_/-/;
                $head .= " ($f)";
            }

            $pod .= "=head3 $head\n\n";

            for my $val ( @{ $locale->$meth() } ) {
                $pod .= "  $val\n";
            }

            $pod .= "\n";
        }
    }

    return $pod;
}

sub pod_for_formats { my $locale = shift;

    unless ( DateTime->can('new') ) {
        eval "use DateTime 0.43";
        die $@ if $@;
    }

    my @dts = (
        DateTime->new(
            year      => 2008,
            month     => 2,
            day       => 5,
            hour      => 18,
            minute    => 30,
            second    => 30,
            locale    => $locale,
            time_zone => 'UTC',
        ),
        DateTime->new(
            year       => 1995,
            month      => 12,
            day        => 22,
            hour       => 9,
            minute     => 5,
            second     => 2,
            nanosecond => 505_196,
            locale     => $locale,
            time_zone  => 'UTC',
        ),
        DateTime->new(
            year      => -10,
            month     => 9,
            day       => 15,
            hour      => 4,
            minute    => 44,
            second    => 23,
            locale    => $locale,
            time_zone => 'UTC',
        ),
    );

    return pod_for_standard_formats( $locale, \@dts )
        . pod_for_available_formats( $locale, \@dts );
}

sub pod_for_standard_formats { my $locale = shift; my $dts = shift;

    my $pod = '';

    for my $type (qw( date time datetime )) {
        $pod .= "=head2 \u$type Formats\n\n";

        for my $length (qw( full long medium short default )) {
            $pod .= "=head3 \u$length\n\n";

            my $meth = $type . q{_} . 'format' . q{_} . $length;

            for my $dt ( @{$dts} ) {
                $pod .= sprintf(
                    '  %20s = %s',
                    $dt->iso8601(),
                    $dt->format_cldr( $locale->$meth() ),
                );
                $pod .= "\n";
            }

            $pod .= "\n";
        }
    }

    return $pod;
}

sub pod_for_available_formats { my $locale = shift; my $dts = shift;

    my $pod = '';

    $pod .= "=head2 Available Formats\n\n";

    for my $format ( sort { lc $a cmp lc $b or $a cmp $b }
        $locale->available_formats() ) {
        my $cldr = $locale->format_for($format);

        $pod .= "=head3 $format ($cldr)\n\n";

        for my $dt ( @{$dts} ) {
            $pod .= sprintf(
                '  %20s = %s',
                $dt->iso8601(),
                $dt->format_cldr($cldr),
            );

            $pod .= "\n";
        }

        $pod .= "\n";
    }

    return $pod;
}

sub pod_for_misc { my $locale = shift;

    my $pod = "=head2 Miscellaneous\n\n";

    $pod .= "=head3 Prefers 24 hour time?\n\n";

    $pod .= $locale->prefers_24_hour_time() ? 'Yes' : 'No';
    $pod .= "\n\n";

    $pod .= "=head3 Local first day of the week\n\n";

    $pod .= $locale->day_format_wide()->[ $locale->first_day_of_week() - 1 ];
    $pod .= "\n\n";

    return $pod;
}

sub pod_footer { return <<'EOF';

SUPPORT

See DateTime::Locale.

AUTHOR

Dave Rolsky <autarch@urth.org>

COPYRIGHT

Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license.