JMSTranslationBundle
JMSTranslationBundle copied to clipboard
Desc is not overrwrite on extraction
I have made a custom extractor to pull translation key strings from DB
In the sql table there is a field with the key and a field with the description (think annotation @DESC)
in the extractor i do
$catalogue = new MessageCatalogue();
$result = .....
foreach ($result as $res) {
$message = new Message($res['tradKey'], 'messages');
$message->setDesc($res['tradDesc']);
$catalogue->add($message);
}
return $catalogue;
if i fill my tables without the description and extract i get in the files:
<trans-unit id="5eb0cb20f24177a19746b8460b33fe56eb3899ba" resname="this.is.the.key">
<source>this.is.the.key</source>
<target state="new">this.is.the.key</target>
</trans-unit>
if, after that, i fill my tables with description and extract, i get the same thing in the file, but i'd expect to have :
<trans-unit id="5eb0cb20f24177a19746b8460b33fe56eb3899ba" resname="this.is.the.key">
<source>my new description that i just wrote</source>
<target state="new">my new description that i just wrote</target>
</trans-unit>
I think a newly added description should overwrite the old one but the mergeExisting method in the Message.php does it the other way
Is it a wanted behavior ? if yes, can someone explain it to me ?
Thanks for the bundle and coming answer
I think it is simply because the code to detect changes is not implemented.
https://github.com/schmittjoh/JMSTranslationBundle/blob/master/Translation/Comparison/CatalogueComparator.php#L69
The comparison function does nothing when there exists an old messages and a new extracted message with the same id.
I know it was a long time ago you posted this issue. Do you still experiencing this? Or is it fixed in the latest version of the bundle?