1

This is a recurrent problem I have when building WordPress Theme or Plugin: each new feature added to the code breaks the i18n files consistency. POT/PO files store the line number of the translated string, so if I add a new ten-lines block of code to my Theme's functions file for instance, all translated strings' line numbers from this point will be wrong.

Currently I'm stuck with generating a new POT file with makepot and using a diff tool to update all line numbers accordingly. This is a waste of time especially when dealing with large translation files and/or multiple POT files… Did anyone ever came up with a clever way to update language files line numbers without crippling the already translated texts?

Thanks!

1

use poedit, and build a translation database with it.

Even without poedit you can probably parse an old po file to read all the translation and replace the matching string in the new file.

  • Poedit works by far the best for me as Mark said. When you open your pot or po file with poedit, and click update, poedit will search the complete theme or plugin template files. It will return all new strings, and it will also delete all reduntant strings that has been removed. It will also update line number and etc – Pieter Goosen Feb 11 '14 at 10:16
  • you can also use the translation database feature to store your previous translations and then reuse them in new unrelated projects. – Mark Kaplun Feb 11 '14 at 10:25
  • O yes, thanks Mark. Forgot about that feauture. Poedit automatically then adds translations to that strings, you must just go and accept if you want to use that translation – Pieter Goosen Feb 11 '14 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.