Zend_Translate:如何进行反向翻译
我的网站是用Zend框架构建的,默认是英文的。我有一个 csv 文件可以将从英语翻译成法语:fr.csv
但是,我的数据库中的数据是英语的。所以我想将用户前端输入从法语翻译成英语,以便与我的数据库交互。如何使用 Zend_translate 进行反向查找,即从法语到英语?或者还有其他方法可以实现这一目标吗?
my site is built with Zend framework, and default in English. i have a csv file to translate from english to french: fr.csv
however, the datas in my db are in English. So I want to translate user frontend input from French to English so as to interact with my db. How can I use Zend_translate to do a reverse lookup, i.e. from french to english? Or are there any other ways to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,您不会从英语翻译成另一种语言,而是从 ID(包括英语)翻译,即使 ID 是英文的。原因是,ID 不应该是完整的句子或短语,而应该是简短而有意义的语句,例如
Forbidden
(英文翻译为“您无权访问此资源”或其他内容)像这样)。使用短键,拼写错误的可能性较小。如果您想显示翻译公式(据我所知,这就是您想要做的),我建议仅在内部显示 ID,并将首选/当前翻译显示为标签
您可以使用以下命令获取当前定义的 ID:
Zend_Translate_Adapter::getMessageIds()
Usually you don't translate from English to another language, but from IDs (including English) even if the IDs are in English. The reason is, that the IDs should not be full sentences or phrases, but short and meaningful statements, such as
Forbidden
(with the English translation "You don't have access to this resource", or something like that). With short keys typos are less likely.If you want to show a formular for translations (as far as I can see that is what you are trying to do), I recommend to just the IDs internally and show the preferred/current translation as label
You can get the currently defined IDs with
Zend_Translate_Adapter::getMessageIds()
您可以使用该方法访问源数据,然后在其中搜索您需要的内容并进行反向翻译,从消息到 ID。
结果:
资源:http://framework.zend.com/ Manual/1.12/en/zend.translate.additional.html
希望它对某些人有帮助,但我有一个问题,使用一个大翻译文件是个好主意,或者最好创建一些用于此目的的数组?谢谢,抱歉英语不好。
You can use the method for access source data and after search in him what you need and doing a reverse translate, from message to id.
The results:
Resource: http://framework.zend.com/manual/1.12/en/zend.translate.additional.html
Hope it's help some one, but i have one question, it's a good idea with a big translation file, or it's better create some arrays for this purpose? Thanks and sorry for bad English.