/**
  * Returns an instance of the class ezcTranslationFilterLeet
  *
  * @return ezcTranslationFilterLeet Instance of ezcTranslationFilterLeet
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new ezcTranslationLeetFilter();
     }
     return self::$instance;
 }
 public function testGetContextWithFilter4()
 {
     $leet = ezcTranslationLeetFilter::getInstance();
     $context = array();
     $context[] = new ezcTranslationData("The %fruit is round.", "%Fruit er rund.", false, ezcTranslationData::TRANSLATED);
     $expected = array();
     $expected[] = new ezcTranslationData("The %fruit is round.", "%Fruit 3r rund.", false, ezcTranslationData::TRANSLATED);
     $leet->runFilter($context);
     self::assertEquals($expected, $context);
 }
 public function testGetContextWithFilters()
 {
     $currentDir = dirname(__FILE__);
     $backend = new ezcTranslationTsBackend("{$currentDir}/files/translations");
     $backend->setOptions(array('format' => '[LOCALE].xml'));
     $leet = ezcTranslationLeetFilter::getInstance();
     $fillin = ezcTranslationComplementEmptyFilter::getInstance();
     $trm = new ezcTranslationManager($backend);
     $trm->addFilter($fillin);
     $trm->addFilter($leet);
     $context = $trm->getContext('nl-nl', 'design/admin/content/browse_bookmark');
     $expected = array();
     $expected[] = new ezcTranslationData("Choose items to bookmark", "Ki3s i73ms 0m 23 73 v03g3n 44n uw f4v0ri373n", false, ezcTranslationData::TRANSLATED);
     $expected[] = new ezcTranslationData("Select the items that you want to bookmark using the checkboxes and click \"OK\".", "S313c7 7h3 i73ms 7h47 u w4n7 2 b00km4rk using 7h3 ch3ckb0x3s 4nd c1ick \"0K\".", false, ezcTranslationData::UNFINISHED);
     $expected[] = new ezcTranslationData("Navigate using the available tabs (above), the tree menu (left) and the content list (middle).", "N4vig8 using 7h3 4v4i14b13 74bs (4b0v3), 7h3 7r33 m3nu (13f7) 4nd 7h3 c0n73n7 1is7 (midd13).", false, ezcTranslationData::UNFINISHED);
     $expected = new ezcTranslation($expected);
     self::assertEquals($expected, $context);
 }
Beispiel #4
0
<?php

require_once 'tutorial_example_03.php';
$manager = new ezcTranslationManager($backend);
$manager->addFilter(ezcTranslationBorkFilter::getInstance());
$search = $manager->getContext('nl_NL', 'search');
$params = array('search_string' => 'appelmoes', 'matches' => 4);
echo $search->getTranslation("Search for '%search_string' returned %matches matches.", $params), "\n";
$manager = new ezcTranslationManager($backend);
$manager->addFilter(ezcTranslationLeetFilter::getInstance());
$search = $manager->getContext('nl_NL', 'search');
$params = array('search_string' => 'appelmoes', 'matches' => 4);
echo $search->getTranslation("Search for '%search_string' returned %matches matches.", $params), "\n";