Merging new .pot file with .po. Managing translations in WordPress
I was strugling with translations in WordPress. That wasnt easy to copy and paste some old stuff from last .po file to new based on .pot file. How to do that without copy+paste method?
Firstly you need to install gettext with brew and link it
brew install gettext brew link gettext
In my case it wasnt possible to link gettext so easy and I needed force method:
brew link gettext --force
msgmerge yourold.po new.pot > yournew.po
And it is ready!
Sometimes you will need to open new .po file in PoEdit and check if there is no errors or conflicts (for example with n-plural problem). After that your .po file is ready to convert to .mo (in PoEdit .mo file is autogenerated). Then you just need to upload file to your server. Remember to upload plugin files into wp-content/languages/plugins folder :)