开发者

How to get an ad hoc translation with Zend_Translate

I'm using Zend_Translated to translated all my strings

$translator->_('hello')

If my locale is in french this code will print "Bonjour".

When browsing the french version开发者_JS百科 of the site i'd like to output some german text.

$translator->_('hello', array(locale=>'en'))

This will still output "Bonjour" but i'd like "Guten Tag"

How can I get a translation of a string in another language than the current locale?


If you would like to output some german text you should use

$translator->setLocale('de');
$translator->_('hello');

or

$translator->_('hello', 'de');

ie. either set the locale before translating or specify the locale string as 2nd parameter.

Refer to Handling languages for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜