Translations and Symfony2 in database

为君一笑 提交于 2020-01-11 17:55:09

问题


File based translations don't work for me because clients need to change the texts.

So I am thinking about implementing this interface to fetch data from the database and cache the results in an APC cache. Is this a good solution?


回答1:


This could be what you are looking for

http://blog.elendev.com/development/php/symfony/use-a-database-as-translation-provider-in-symfony-2/




回答2:


Take a look at the Translatable behavior extension for Doctrine 2. StofDoctrineExtensionsBundle integrates it with Symfony.




回答3:


You may want to take a look into this Loader + Resource using PDO connection: https://gist.github.com/3315472

You then only need to make it cache aware, like adding a memcache, apc, .. in between. If so, you can then disable the filecaching of the Translator itself.



来源:https://stackoverflow.com/questions/10220206/translations-and-symfony2-in-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!