[limb-svn] r5852 - in 3.x/trunk/limb/i18n: i18n/locale src/template/tags/i18n tests/cases/template/tags/i18n
svn at limb-project.com
svn at limb-project.com
Thu May 10 13:16:47 MSD 2007
Author: wiliam
Date: 2007-05-10 13:16:47 +0400 (Thu, 10 May 2007)
New Revision: 5852
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5852
Modified:
3.x/trunk/limb/i18n/i18n/locale/ru_RU.ini
3.x/trunk/limb/i18n/src/template/tags/i18n/i18n.filter.php
3.x/trunk/limb/i18n/tests/cases/template/tags/i18n/lmbI18NStringFilterTest.class.php
Log:
-- DBE support added to i18n.filter.php;
Modified: 3.x/trunk/limb/i18n/i18n/locale/ru_RU.ini
===================================================================
--- 3.x/trunk/limb/i18n/i18n/locale/ru_RU.ini 2007-05-10 08:52:00 UTC (rev 5851)
+++ 3.x/trunk/limb/i18n/i18n/locale/ru_RU.ini 2007-05-10 09:16:47 UTC (rev 5852)
@@ -11,7 +11,7 @@
content_language = ru-RU
[currency]
-symbol = ?.
+symbol = р.
name = Ruble
short_name = RBL
decimal_symbol = .
Modified: 3.x/trunk/limb/i18n/src/template/tags/i18n/i18n.filter.php
===================================================================
--- 3.x/trunk/limb/i18n/src/template/tags/i18n/i18n.filter.php 2007-05-10 08:52:00 UTC (rev 5851)
+++ 3.x/trunk/limb/i18n/src/template/tags/i18n/i18n.filter.php 2007-05-10 09:16:47 UTC (rev 5852)
@@ -45,9 +45,32 @@
return $result;
}
+ function generatePreStatement($code)
+ {
+ parent :: generatePreStatement($code);
+
+ $this->params_var = $code->getTempVarRef();
+ $code->writePhp($this->params_var . ' = array();');
+
+ for($i=1; $i < sizeof($this->parameters); $i+=2)
+ {
+ $var = $this->parameters[$i]->getValue();
+ $code->writePhp($this->params_var . '["' . $this->parameters[$i]->getValue() . '"] = ');
+ $code->writePhp($this->parameters[$i+1]->generateExpression($code));
+ $code->writePhp(';'. "\n");
+ }
+ }
+
function generateExpression($code)
{
- throw new lmbException('DBE mode is not supported in i18n filter');
+ $code->writePhp('lmb_i18n(');
+
+ $this->base->generateExpression($code);
+
+ $code->writePhp(',' . $this->params_var . ', ');
+
+ $code->writePhp($this->parameters[0]->generateExpression($code));
+ $code->writePhp(')');
}
}
Modified: 3.x/trunk/limb/i18n/tests/cases/template/tags/i18n/lmbI18NStringFilterTest.class.php
===================================================================
--- 3.x/trunk/limb/i18n/tests/cases/template/tags/i18n/lmbI18NStringFilterTest.class.php 2007-05-10 08:52:00 UTC (rev 5851)
+++ 3.x/trunk/limb/i18n/tests/cases/template/tags/i18n/lmbI18NStringFilterTest.class.php 2007-05-10 09:16:47 UTC (rev 5852)
@@ -47,9 +47,27 @@
$this->assertEqual($page->capture(), 'Применить фильтр 1 и 2');
}
- function testDBENotSupported()
+ function testWithDBEAttributes()
{
$dictionary = new lmbI18NDictionary();
+ $dictionary->add('Apply %name% filter to %var%', 'Применить фильтр %name% к %var%');
+
+ $this->toolkit->setDictionary('ru', 'foo', $dictionary);
+ $this->toolkit->setLocale('ru');
+
+ $template = '{$"Apply %name% filter to %var%"|i18n:"foo", "%name%", name, "%var%", variable.name}';
+
+ $this->registerTestingTemplate('/limb/locale_string_filter_with_dbe_attributes.html', $template);
+
+ $page = $this->initTemplate('/limb/locale_string_filter_with_dbe_attributes.html');
+ $page->set('name', 'ИмяФильтра');
+ $page->set('variable', array('name' =>'ИмяПеременной'));
+ $this->assertEqual($page->capture(), 'Применить фильтр ИмяФильтра к ИмяПеременной');
+ }
+
+ function testDBEVariable()
+ {
+ $dictionary = new lmbI18NDictionary();
$dictionary->add('Apply filter', 'Применить фильтр');
$this->toolkit->setDictionary('ru', 'foo', $dictionary);
@@ -57,18 +75,13 @@
$template = '{$var|i18n:"foo"}';
- try
- {
- $this->registerTestingTemplate('/limb/locale_string_filter_dbe.html', $template);
+ $this->registerTestingTemplate('/limb/locale_string_filter_dbe.html', $template);
- $page = $this->initTemplate('/limb/locale_string_filter_dbe.html');
+ $page = $this->initTemplate('/limb/locale_string_filter_dbe.html');
+ $page->set('var', 'Apply filter');
- $page->set('var', 'Apply filter');
+ $this->assertTrue($page->capture(), 'Применить фильтр');
+ }
- $page->capture();
- $this->assertTrue(false);
- }
- catch(lmbException $e){}
- }
}
?>
More information about the limb-svn
mailing list