[英]Translating English to other language using zend framework
I am beginner with the Zend Framework. 我是Zend Framework的初学者。
I have one simple small web application which is in English Language. 我有一个简单的小型Web应用程序,使用英语。 I want to translate it in Hindi. 我想将其翻译成印地语。 I referred to Zend_Translate but I wasn't able to understand how it works, would someone be able to help me? 我提到过Zend_Translate,但我无法理解它是如何工作的,有人可以帮助我吗? I m not getting idea for zend_translate... Please give me a controller, bootstrap and form code which translate a simple english string to hindi... 我没有zend_translate的主意...请给我一个控制器,引导程序和表单代码,以将简单的英语字符串转换为后代...
Zend_Translate is a component used for localization, this component enable you to store your different translated string in some various formats(XML, PHP, CSV, gettext). Zend_Translate是用于本地化的组件,该组件使您能够以各种格式(XML,PHP,CSV,gettext)存储不同的翻译字符串。 After loading your translated content, you can use the component to show your translated pieces in your view. 加载翻译的内容后,您可以使用该组件在视图中显示翻译的作品。
Here an example extracted from the manual 这里是从手册中摘录的一个例子
$translate = new Zend_Translate(
array(
'adapter' => 'gettext',
'content' => '/my/path/source-de.mo',
'locale' => 'de'
)
);
$translate->addTranslation(
array(
'content' => '/path/to/translation/fr-source.mo',
'locale' => 'fr'
)
);
print $translate->_("Example") . "\n";
print "=======\n";
print $translate->_("Here is line one") . "\n";
printf($translate->_("Today is the %1\$s") . "\n", date('d.m.Y'));
print "\n";
$translate->setLocale('fr');
print $translate->_("Here is line two") . "\n";
The steps you have to make depend on which adapter you choose (for example gettext requires using editor for .po files (Poedit)). 您必须执行的步骤取决于您选择的适配器(例如,gettext要求对.po文件使用编辑器(Poedit))。
Generally you have to: 通常,您必须:
To my mind, documentation about Zend_Translate on zendframework.com is quite good add one should be able to start using translation based on information from reference guide. 在我看来,zendframework.com上有关Zend_Translate的文档非常不错,并且应该能够根据参考指南中的信息开始使用翻译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.