views:

144

answers:

1

I'm updating my current framework's i18n method from a Localization class that stores language strings in arrays to gettext + Zend_Translate.

There's a certain situation which leaves me puzzled, single string outputting is simple but using my current method I'm grouping certain strings together, for collections such as cities, states, prefixes in order such that they can be manipulated and transformed easily into html ( such as dropdown options ).

Would I have no choice but to store arrays such as the one below in order such that they are still grouped together? Or is there some sort of method I'm missing out on when using gettext, which allows me to do this in a more convenient fashion?

class Localization
{
    var $prefixes = array(
     ""=>"Prefix", 
     "Mr."=>"Mr.", 
     "Mrs."=>"Mrs.", 
     "Ms."=>"Ms.", 
     "Dr."=>"Dr."
    );

To reiterate, I want to be able to basically retain my method, in which the invocation is used as such:

<label for="prefixes"><?php echo $local->_('Prefix');?></label>
<?php echo Class::grab_prefixes(); // generates a dropdown of prefixes ?>

And this would grab a collection of prefixes including text values and actual form values from a localized string collection.

I'm currently still relying on the arrays and then applying the Zend_Translate invocation on them.

A: 

Actually re-thinking about it, because I'm selectively grouping certain strings together in order such that they become <option value="value">text</option> the only feasible and practical way would probably be to store them as I already have them as arrays.

This is how other frameworks generate entire dropdowns for states, cities, countries.. no?

meder