Question

Poedit does not automatically recognise the content of a table in a database. What is the best way to get the content of a table recognized by poedit for its translation in zend. I would like it to be done automatically....do I have to create an xml file from the database ?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top