用于Zend_Translate的MySQL适配器 [英] Mysql adapter for Zend_Translate

查看:85
本文介绍了用于Zend_Translate的MySQL适配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正处于一个大型项目的计划阶段,该项目将在Zend框架中开发.我面临的问题之一是客户不仅要翻译内容,还要翻译界面.我目前正在使用gettext和poedit来管理我的语言文件,但这对客户来说不是一种选择,因为他们(其中一个人)将无法通过FTP访问该网站.

I'm currently in the planning phase of a rather large project that I'll develop in the Zend Framework. One of the problems I'm facing is that the customers will want to translate not only the content but also the interface. I'm currently using gettext and poedit to manage my language files but this is not an option for the customer as they, for one, wont have FTP access to the site.

因此,我正在考虑一个mysql后端,该后端在前端具有一个接口,供客户管理自己的接口转换.但是,对于Zend_Translate仍然没有mysql adapater.

Hence, I'm thinking of a mysql back end with an interface in the front end for the customer to manage his own translations of the interface. There is however still no mysql adapater for Zend_Translate.

那么,现在有人可以使用Zend_Translate的适配器脚本了,以便它可以与mysql表一起使用吗?还是有任何反对使用mysql的争论以及针对此问题的其他可能解决方案?

So, does anybody now of an adapter script for Zend_Translate so it can work with a mysql table? Or any arguments against using mysql and possible other solutions for this problem?

推荐答案

您可以通过不同的方式解决此问题:

You could solve this problem on different ways:

扩展Zend_Translate_Adapter来创建自己的.所有新适配器仅负责从源代码中获取翻译内容.也就是说,您只需要从数据库中获取翻译.查看其他适配器,看看它们如何实现.

Extend Zend_Translate_Adapter to create your own. All new adapters are only responsible from getting the translations out from the source. That is, you would need only to fetch the translations from the database. Look at other adapters and see how they are implemented.

从数据库中获取数据,并将其传递给Zend_Translate_Adapter_Array

Fetch the data from the database and pass it to Zend_Translate_Adapter_Array

使用Zend_Translate_Adapter_Csv或Ini.随着阅读更多有关翻译的文章,此解决方案将减少对数据库的查询数量.当客户端添加新语言或更改现有语言时,只需将其写到文件中,而不是数据库中.

Use Zend_Translate_Adapter_Csv or Ini. As there would be more reading the writing on the translations, this solution would cut down the number of queries to the database. When the client adds a new language or changes an existing one, simply write it to a file, not the database.

如果您决定使用数据库适配器,也许您可​​以以某种方式标记"翻译,以便在主页上仅获取主页的翻译,在联系页面上仅获取联系页面的翻译. ...

If you decide to go with the database adapter, maybe you could "tag" somehow the translations, so that on the home page you fetch only the translations for the home page, on the contact page only the translations for the contact page...

HTH!

这篇关于用于Zend_Translate的MySQL适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆