[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/i18n/tests/cases/template/tags/i18n/ -> lmbI18NStringFilterTest.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/i18n/src/translation/lmbI18NDictionary.class.php');
  10  
  11  class lmbI18NStringFilterTest extends lmbWactTestCase
  12  {
  13    function testUseCurrentLocale()
  14    {
  15      $dictionary = new lmbI18NDictionary();
  16      $dictionary->add('Apply filter', 'Применить фильтр');
  17  
  18      $this->toolkit->setDictionary('ru', 'foo', $dictionary);
  19      $this->toolkit->setLocale('ru');
  20  
  21      $template = '{$"Apply filter"|i18n:"foo"}';
  22  
  23      $this->registerTestingTemplate('/limb/locale_string_filter_locale.html', $template);
  24  
  25      $page = $this->initTemplate('/limb/locale_string_filter_locale.html');
  26  
  27      $this->assertEqual($page->capture(), 'Применить фильтр');
  28    }
  29  
  30    function testWithAttributes()
  31    {
  32      $dictionary = new lmbI18NDictionary();
  33      $dictionary->add('Apply %1 filter and %2', 'Применить фильтр %1 и %2');
  34  
  35      $this->toolkit->setDictionary('ru', 'foo', $dictionary);
  36      $this->toolkit->setLocale('ru');
  37  
  38      $template = '{$"Apply %1 filter and %2"|i18n:"foo", "%1", "1", "%2", "2"}';
  39  
  40      $this->registerTestingTemplate('/limb/locale_string_filter_with_attributes.html', $template);
  41  
  42      $page = $this->initTemplate('/limb/locale_string_filter_with_attributes.html');
  43  
  44      $this->assertEqual($page->capture(), 'Применить фильтр 1 и 2');
  45    }
  46  
  47    function testWithDBEAttributes()
  48    {
  49      $dictionary = new lmbI18NDictionary();
  50      $dictionary->add('Apply %name% filter to %var%', 'Применить фильтр %name% к %var%');
  51  
  52      $this->toolkit->setDictionary('ru', 'foo', $dictionary);
  53      $this->toolkit->setLocale('ru');
  54  
  55      $template = '{$"Apply %name% filter to %var%"|i18n:"foo", "%name%", name, "%var%", variable.name}';
  56  
  57      $this->registerTestingTemplate('/limb/locale_string_filter_with_dbe_attributes.html', $template);
  58  
  59      $page = $this->initTemplate('/limb/locale_string_filter_with_dbe_attributes.html');
  60      $page->set('name', 'ИмяФильтра');
  61      $page->set('variable', array('name' =>'ИмяПеременной'));
  62      $this->assertEqual($page->capture(), 'Применить фильтр ИмяФильтра к ИмяПеременной');
  63    }
  64  
  65    function testDBEVariable()
  66    {
  67      $dictionary = new lmbI18NDictionary();
  68      $dictionary->add('Apply filter', 'Применить фильтр');
  69  
  70      $this->toolkit->setDictionary('ru', 'foo', $dictionary);
  71      $this->toolkit->setLocale('ru');
  72  
  73      $template = '{$var|i18n:"foo"}';
  74  
  75      $this->registerTestingTemplate('/limb/locale_string_filter_dbe.html', $template);
  76  
  77      $page = $this->initTemplate('/limb/locale_string_filter_dbe.html');
  78      $page->set('var', 'Apply filter');
  79  
  80      $this->assertTrue($page->capture(), 'Применить фильтр');
  81    }
  82  
  83  }
  84  ?>


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7