majelbstoat wrote:
> 
> This is what I ended up doing.  I have a dummy class with a single
> function that just performs a whole host of translations.  The class will
> never be used and it doesn't feel good, but it does allow the error codes
> to appear in the .pot file.  I know Zend_Validate isn't supposed to
> actually provide real error messages, just error codes, but it's a shame
> that such a method was chosen that forces such hacks if you want to use
> probably the most popular method of localisation...  Not that I can think
> of a better method at the moment, and not that I'm sure there isn't a
> better way of using what we have.  Ah well.  For reference, here's what
> I'm doing:
> 
> <?php
> 
> abstract class My_Translate {
>       public static function dummy() {
>               $translator = Zend_Registry::get('Zend_Translate');
>               $translator->translate('isEmpty');
>               // More translations here...
>       }       
> }
> 
> ?>
> 
> Any better ways than this out there?
> 

There is no reason to create a class, a simple php file with message codes
is enough in order to make gettext work, something like this:

<?php
$a = 'isEmpty';
$a = 'notString';
...
?>

and parse it with 'xgettext -a strings.php'. Option -a stands for all string
so every PHP string in this file will be included in the output catalog
file.
-- 
View this message in context: 
http://www.nabble.com/Using-a-gettext-Zend_Translate-object-with-Zend_Form-tp16092578s16154p16206447.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to