Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Date::Language::Finnish

by Mr. Muskrat (Abbot)
on Dec 12, 2002 at 19:12 UTC ( #219400=sourcecode: print w/ replies, xml ) Need Help??

Category: Date / Time
Author/Contact Info

Matthew Musgove <muskrat@mindless.com>
/msg Mr. Muskrat

Description: Another Date::Language sub-module. Look for it on CPAN first quarter 2003.
##
## Finnish tables
## Contributed by Matthew Musgrove <muskrat@mindless.com>
##

package Date::Language::Finnish;

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

# In Finnish, the names of the months and days are only capitalized at
+ the beginning of sentences.
@MoY  = map($_ . "kuu", qw(tammi helmi maalis huhti touko kesä heinä e
+lo syys loka marras joulu));
@DoW  = qw(sunnuntai maanantai tiistai keskiviikko torstai perjantai l
+auantai);

# it is not customary to use abbreviated names of months or days
# per Graham's suggestion:
@MoYs = @MoY;
@DoWs = @DoW;

# the short form of ordinals
@Dsuf = ('.') x 31;

# doesn't look like this is normally used...
@AMPM = qw(ap ip);


@MoY{@MoY}  = (0 .. scalar(@MoY));
@MoY{@MoYs} = (0 .. scalar(@MoYs));
@DoW{@DoW}  = (0 .. scalar(@DoW));
@DoW{@DoWs} = (0 .. scalar(@DoWs));

# Formatting routines

sub format_a { $DoWs[$_[0]->[6]] }
sub format_A { $DoW[$_[0]->[6]] }
sub format_b { $MoYs[$_[0]->[4]] }
sub format_B { $MoY[$_[0]->[4]] }
sub format_h { $MoYs[$_[0]->[4]] }
sub format_p { $_[0]->[2] >= 12 ?  $AMPM[1] : $AMPM[0] }
sub format_o { sprintf("%2de",$_[0]->[3]) }

1;

Updated: Thanks roke!

Comment on Date::Language::Finnish
Download Code
Re: Date::Language::Finnish
by roke (Curate) on Dec 13, 2002 at 08:46 UTC
    Hi Mr. Muskrat,

    Two small corrections...

    @MoY = map($_ . "kuu", qw(tammi helmi maalis huhti touko kesä heinä e +lo syys loka marras joulu);

    Second ")" is missing in the end of line.

    @DoW = map($_ . "tai", qw(sunnun maanan tiis keskivii tors perjan lau +an));

    Fourth day should be "keskiviikko", not "keskiviitai".

    -Roke

Back to Code Catacombs

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://219400]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2015-07-05 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls