In advance of you providing answers to jcwren's questions, I have one sort of suggestion to make that I think will work for a number of setups. warning : it involves a relatively complex data structure (to fully grok it, you'll need to read up on how to use references in Perl!)

Suppose you've got a runtime variable that selects the language, what you can do is have a hash, whose keys are the names of the various languages, and whose values are *references to* anonymous arrays, which hold the names of the months in that language.

The syntax below is not sacrosanct, personally if I could figure out right at this moment how to use the qw(...) to get the names of the months without all the fiddly quotes, I'd be happier, but the following seems suitable for small to medium-sized projects.

Here's a code snippet (that won't work cut n' paste! =):

use strict; # =) my %months = ( 'English'=> ['January', 'February' ... ], 'French'=> ['Janvier', 'Fevrier', ... ], 'Italian'=> ['gennaio', 'febbraio', ...], #etc ... );
What's nice about this setup is that since the month *numbers* are universal across the different languages (well, give or take certain Eastern Orthodox churches etc. =) you can access the name of the month quite easily :
# $language is set at run time and would be one of 'English', # 'Italian' etc. -- the keys of your $months hash # also assumes $month_number ranges from 1 to 12; if it's 0 to 11, eli +minate the '-1' my $month_name = $month{$language}[$month_number-1];
HTH

In reply to Re: Month Names by arturo
in thread Month Names by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.