Here's the thing - doing a milti-lingual site (wish I wasn't!!!) with a file (language.lib) that contains all common on-screen elements.

Based upon the user language ($lang) being a value from 0-3 (defining the various languages: 0-English, 1=Spanish etc...) the on-screen elements are called from the respective array contained within the language.lib file thus;

@scr_name=("Name","Nombre","Nom"); - in language.lib
$scr_name[$lang] - displays appropriate word on screen

I've come across a situation where I use numeric values for other areas but find that a single array obviously wont work.

Here's what I have in mind (and I'm sure it's possible - I just don't know how to do it yet!). OK:

$lang = (values of 0-3)
$colour = either
(0=red, 1=blue, 2=yellow) (if $lang = 0 [English])
or
(0=rojo, 1=azul, 2=amarillo) (if $lang = 1 #91;Spanish])

Is it possible to have something like this

$scr_display[$lang][$colour]
so that if $lang=1 and $colour=0, rojo would be displayed on screen.

Answers on a postcard please, to....

Thanks for any help you can give, and kindest regards from Andorra,

Richard.

PS: I did look throught the FAQ's and got a bit confused... :-|


In reply to Do I need an array within an array by meetn2veg

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.