Translation of database with poedit and zend translate

你离开我真会死。 提交于 2019-12-06 01:33:57

You should not translate database contents with poedit. You would do that inside the database. The short answer: what you want cannot be achieved, unfortunately.

You can translate "fixed" strings and if you want to get variables, constant or database values translated, you have to do that via literal string translations, in the case poedit has to scan them:

<?php
if($var === 'foo') {
    echo $this->translate('foo');
} else {
    echo $this->translate('bar');
}

It's easier if you have a 1:n relation with a Translation object. The view would then pull the translation from user generated content:

<?php
echo $foo->Translation['en-us']->bar;

An example of this last possibility is provided in the Gedmo doctrine extension: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/translatable.md

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