http://www.perlmonks.org?node_id=263023

jk2addict has asked for the wisdom of the Perl Monks concerning the following question:

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