Skip to content

Commit

Permalink
Replace Date::Language::Hungarian with version already on CPAN
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoddard authored and gbarr committed Sep 25, 2009
1 parent 121ec2f commit 40a3895
Showing 1 changed file with 60 additions and 14 deletions.
74 changes: 60 additions & 14 deletions lib/Date/Language/Hungarian.pm
Original file line number Diff line number Diff line change
@@ -1,24 +1,64 @@
##
## Hungarian tables
##
## Contributed by Konrad Lorinczi (webmaster33@bigfoot.com)
## Hungarian tables based on English
##
#
# This is a just-because-I-stumbled-across-it
# -and-my-wife-is-Hungarian release: if Graham or
# someone adds to docs to Date::Format, I'd be
# glad to correct bugs and extend as neeed.
#

package Date::Language::Hungarian;

use Date::Language ();
use vars qw(@ISA @DoW @DoWs @MoY @MoYs @AMPM @Dsuf %MoY %DoW $VERSION);
@ISA = qw(Date::Language);
$VERSION = "1.00";
=head1 NAME
Date::Language::Hungarian - Magyar format for Date::Format
=head1 SYNOPSIS
my $lang = Date::Language->new('Hungarian');
print $lang->time2str("%a %b %e %T %Y", time);
@lt = localtime(time);
print $lang->time2str($template, time);
print $lang->strftime($template, @lt);
print $lang->time2str($template, time, $zone);
print $lang->strftime($template, @lt, $zone);
print $lang->ctime(time);
print $lang->asctime(@lt);
print $lang->ctime(time, $zone);
print $lang->asctime(@lt, $zone);
See L<Date::Format>.
=head1 AUTHOR
Paula Goddard (paula -at- paulacska -dot- com)
=head1 LICENCE
Made available under the same terms as Perl itself.
=cut

use strict;
use warnings;
use base "Date::Language";
use vars qw( @DoW @DoWs @MoY @MoYs @AMPM @Dsuf %MoY %DoW $VERSION);
$VERSION = "1.01";

@DoW = qw(Vasárnap Hétfõ Kedd Szerda Csütörtök Péntek Szombat);
@MoY = qw(Január Február Március Április Május Június
@MoY = qw(Január Február Március Április Május Június
Július Augusztus Szeptember Október November December);
@DoWs = qw(Va Hé Ke Sze Cs Pé Szo);
@MoYs = qw(Jan Feb Márc Ápr Máj Jún Júl Aug Szept Okt Nov Dec);
@DoWs = map { substr($_,0,3) } @DoW;
@MoYs = map { substr($_,0,3) } @MoY;
@AMPM = qw(DE. DU.);

@Dsuf = ('.') x 31;
# There is no 'th or 'nd in Hungarian, just a dot
@Dsuf = (".") x 31;

@MoY{@MoY} = (0 .. scalar(@MoY));
@MoY{@MoYs} = (0 .. scalar(@MoYs));
Expand All @@ -34,9 +74,15 @@ sub format_B { $MoY[$_[0]->[4]] }
sub format_h { $MoYs[$_[0]->[4]] }
sub format_p { $_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0] }
sub format_P { lc($_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0]) }
sub format_o { $_[0]->[3].'.' }



sub format_D { &format_y . "." . &format_m . "." . &format_d }

sub format_y { sprintf("%02d",$_[0]->[5] % 100) }
sub format_d { sprintf("%02d",$_[0]->[3]) }
sub format_m { sprintf("%02d",$_[0]->[4] + 1) }

sub format_d { $_[0]->[3] }
sub format_m { $_[0]->[4] + 1 }
sub format_o { $_[0]->[3] . '.' }

1;

0 comments on commit 40a3895

Please sign in to comment.