Hi Robert, Am Freitag, 7. April 2006 13:43 schrieb Robert Millan: > How does one operate to merge different branches in a PO file? It seems > traditional "diff & patch" methods are very fragile. > > Let's say I modify a PO file, then prepare a patch to send the maintainer. > However, since PO files are full of references to C source line numbers, it's > very likely that when the PO is updated by the maintainer, my patch will no > longer work (context broken; fuzzy/offset matching is useless).
first of all: a PO file patch is completely useless, you need at least two full files such as branch1.po.old and branch1.po.new which you can merge with branch2.po. Nevertheless I suggest (and I do so) to provide only diffs/patches to update translations. Why? * A diff is smaller than the whole file * It's easy to see the differences in the messages, changes in line numbers to source files should not occur * The maintainer can not overwrite the old (possible further modified) file with the new one The last point is important since this makes it much harder to lost previous changes to the now outdated PO file which are not yet in the patch (because for example another person fixed a typo in the upstream version you were not able to find). In such a case you get a conflict when you try to apply the patch. Manual work is needed to resolve the conflict. Here is how to to it: If you have only a diff you should try to obtain the original PO file the patch was created against. Now apply the patch (no conflicts should occur) to create branch1.po.new. Now let's try to merge differences between branch1.po.old and branch1.po.new into branch2.po. The only useful command I know is msgmerge. I can not remember whether I used it already for such merging but according to the info page the following should work: Update all line numbers in branch1.po.old to the ones from branch2.po but keep translations in branch1.po.old (only in branch2.po not used strings will be removed). $ msgmerge --update branch1.po.old branch2.po The same for branch1.po.new $ msgmerge --update branch1.po.new branch2.po Now you should be able to patch branch2.po: diff -u branch1.po.old branch1.po.new | patch branch2.po Again, it's untested and it may also be possible to play with --compendium=FILE option to obtain (missing?) translations from FILE during merge ... Jens -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

