Gettext is great for creating multi-lingual sites, but in some cases (e.g. for performance reasons) you may wish to replace the gettext calls with the translations of the strings; that's what this task is for. Note that this is similar to ReplaceTokens, but both the find and the replace aspect is more complicated -- hence this is a separate, stand-alone filter.

Example:


See also: BaseFilterReader
Author: Hans Lellelid (hans@xmpl.org)
Inheritance: extends BaseParamFilterReader, implements ChainableReader
 /**
  * Creates a new TranslateGettext filter using the passed in
  * Reader for instantiation.
  * 
  * @param Reader $reader A Reader object providing the underlying stream.
  *               Must not be <code>null</code>.
  * 
  * @return TranslateGettext A new filter based on this configuration, but filtering
  *         the specified reader
  */
 function chain(Reader $reader)
 {
     $newFilter = new TranslateGettext($reader);
     $newFilter->setProject($this->getProject());
     $newFilter->setDomain($this->getDomain());
     $newFilter->setLocale($this->getLocale());
     $newFilter->setDir($this->getDir());
     return $newFilter;
 }
Example #2
0
 function addGettext(TranslateGettext $o)
 {
     $o->setProject($this->project);
     $this->filterReaders[] = $o;
 }