Re: [PHPTAL] (no subject)
Tom De Bruyne wrote: Thanks for your feedback. It seems a viable solution, not too complicated. Afterwards I can just call this by using i18n? So, now I have ${status} That would need to become ${status} or ... ? yes, my current iplementation is somthing like that public function translate($key, $htmlencode=true) { if (empty($key)) { return ''; } elseif ('keyword1' == $key) { $key = 'Translation 1'; } elseif ('keyword2' == $key) { $key = 'Translation 2'; } return parent::translate($key, $htmlencode); } but, i am already using gettext. so for you it might indeed be overkill ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] (no subject)
GRolf wrote: I have records in a table that have a "status" field, which contains a status in 'code' (i.e. "NEW", "PENDING", "APPROVED", ...). There is no conversion table for the moment When outputting this, I'd like to convert this status code to some more human-readable form ('Awaits approval', ...). I have a vague memory of a suggestion to use i18n: to solve this. But I don't want to make it to complicated. All I need to translate is this one particular field, I'm not planning on installing gettext etc. If there is no easy solution, I'd rather run through my results in PHP first to convert them to the required output... Any help? class MyTranslator extends PHPTAL_GetTextTranslator { /** * translate given key. * * @param bool $htmlencode if true, output will be HTML-escaped. */ public function translate($key, $htmlencode=true) { return $translation; // do what you want with } } $phptal->setTranslator(new MyTranslator()); ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] (no subject)
I have records in a table that have a "status" field, which contains a status in 'code' (i.e. "NEW", "PENDING", "APPROVED", ...). There is no conversion table for the moment When outputting this, I'd like to convert this status code to some more human-readable form ('Awaits approval', ...). I have a vague memory of a suggestion to use i18n: to solve this. But I don't want to make it to complicated. All I need to translate is this one particular field, I'm not planning on installing gettext etc. If there is no easy solution, I'd rather run through my results in PHP first to convert them to the required output... Any help? ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal