I'm currently working on a new app and decided that just for giggles, I would start out with localization in mind, if for no other reason than because-I-can. :-)

With a quick scan of Locale::Maketext I created MyApp::L10N and MyApp::L10N::en_us files. Everything works fine. Happy happy.

Now back to my question. In everyone's opinion, which is the most preferred way to do your %Lexicon?

I. Use primary language as the keys and rely on the _AUTO to do what you want until we have things filled in.

package MyApp::L10N::en_us; ... %Lexicon = ( 'Item Not Found' => 'Item Not Found' ); package MyApp::L10N::jibberish; ... %Lexicon = ( 'Item Not Found' => 'sdfrty dfr5 ffgdfg' );

II. Use more constant like key names and create your entire primary language lexicon from the start?

package MyApp::L10N::en_us; ... %Lexicon = ( 'ITEM_NOT_FOUND' => 'Item Not Found' ); package MyApp::L10N::jibberish; ... %Lexicon = ( 'ITEM_NOT_FOUND' => 'sdfrty dfr5 ffgdfg' );

I'm torn about which method to use really. On the one hand, making my lexicon keys the primary language statements (I.) makes sense. I can delay the completion of my primary lexicon until I'm finished, or allow _AUTO to do the right thing. But the programmer in me screams that I shouldn't force other language lexicons to have the english version as their key.

Consider this: I mispell my english lexicon key "Ite Not Found". Now every seperate language lexicon has to alter it's key to correct the spelling mistake. That's more work than needed if we just created the key as ITEM_NOT_FOUND instead. Sure, I could mispell my keys here also, but it's more likely I'll get my key names correct, than entire sentences in english sometimes. :-)

I've seen both ways touted, usually the first method more than the latter. I just wanted to see what the prevailing practice seems to be.

-=Chris


In reply to Locale::Maketext Lexicon Opinions by jk2addict

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.