| 1 | =head1 NAME | ||
| 2 | |||
| 3 | Cz::Time - Routines for printing dates in Czech | ||
| 4 | |||
| 5 | =head1 SYNOPSIS | ||
| 6 | |||
| 7 | use Cz::Time; | ||
| 8 | my $today = cz_wday() . " " . cz_date(); | ||
| 9 | my $new_year = " 1. " . cz_month_base(1); | ||
| 10 | |||
| 11 | =head1 DESCRIPTION | ||
| 12 | |||
| 13 | Implements czech names of months and weekdays. The following functions | ||
| 14 | are exported: | ||
| 15 | |||
| 16 | =over 4 | ||
| 17 | |||
| 18 | =item cz_date | ||
| 19 | |||
| 20 | Converts time (localtime if not specified) into Czech string, eg. | ||
| 21 | 15. ledna 1997. | ||
| 22 | |||
| 23 | =item cz_month_base, cz_month | ||
| 24 | |||
| 25 | Czech names of months (1..12) | ||
| 26 | |||
| 27 | =item cz_wday, cz_ab_wday | ||
| 28 | |||
| 29 | Czech names of weekdays and weekdays' abreviation. | ||
| 30 | |||
| 31 | =back | ||
| 32 | |||
| 33 | By default they are returned in ISO-8859-2. | ||
| 34 | |||
| 35 | =head1 AUTHORS | ||
| 36 | |||
| 37 | (c) 1997 Jan Pazdziora | ||
| 38 | 1997 Michael Mráka | ||
| 39 | |||
| 40 | at Faculty of Informatics, Masaryk University, Brno | ||
| 41 | |||
| 42 | =head1 VERSION | ||
| 43 | |||
| 44 | 0.02 | ||
| 45 | |||
| 46 | =head1 SEE ALSO | ||
| 47 | |||
| 48 | perl(1), Cz::Cstocs(3). | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | package Cz::Time; | ||
| 53 | |||
| 54 | use strict; | ||
| 55 | use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK ); | ||
| 56 | |||
| 57 | use Exporter; | ||
| 58 | |||
| 59 | @ISA = qw(Exporter); | ||
| 60 | @EXPORT = qw( cz_date cz_month cz_wday cz_month_base cz_ab_wday ); | ||
| 61 | @EXPORT_OK = qw( cz_date cz_month cz_wday cz_month_base cz_ab_wday ); | ||
| 62 | |||
| 63 | $VERSION = '0.02'; | ||
| 64 | |||
| 65 | my @CZ_MONTH_BASE = qw( leden únor bøezen duben kvìten èerven èervenec | ||
| 66 | srpen záøí øíjen listopad prosinec ); | ||
| 67 | my @CZ_WEEK_DAYS = qw( nedìle pondìlí úterý støeda ètvrtek pátek sobota ); | ||
| 68 | my @CZ_AB_WEEK_DAYS = qw( Ne Po Út St Èt Pá So ); | ||
| 69 | |||
| 70 | sub cz_month_base | ||
| 71 | { | ||
| 72 | my $month = shift; | ||
| 73 | return $CZ_MONTH_BASE[$month-1]; | ||
| 74 | } | ||
| 75 | sub cz_month | ||
| 76 | { | ||
| 77 | my $month = shift; | ||
| 78 | local $_ = $CZ_MONTH_BASE[$month-1]; | ||
| 79 | s!en$!na! or s!ec$!ce! or s!ad$!adu! or s!or$!ora!; | ||
| 80 | $_; | ||
| 81 | } | ||
| 82 | sub cz_date | ||
| 83 | { | ||
| 84 | my @t; | ||
| 85 | if (@_) { @t = @_; } else { @t = localtime; } | ||
| 86 | return $t[3] . '. ' . cz_month($t[4] + 1) . ' ' . ($t[5] + 1900); | ||
| 87 | } | ||
| 88 | sub cz_wday | ||
| 89 | { | ||
| 90 | my @t; | ||
| 91 | if (@_) { @t = @_; } else { @t = localtime; } | ||
| 92 | $CZ_WEEK_DAYS[$t[6]]; | ||
| 93 | } | ||
| 94 | sub cz_ab_wday | ||
| 95 | { | ||
| 96 | my @t; | ||
| 97 | if (@_) { @t = @_; } else { @t = localtime; } | ||
| 98 | $CZ_AB_WEEK_DAYS[$t[6]]; | ||
| 99 | } | ||
| 100 | |||
| 101 | 1; | ||
| 102 | __END__ |