Add ability to merge with existing POT file#31
Conversation
|
I tried to look through the code to see what is missing for:
I wonder though what header data would be considered the correct one if you merge two files. So, when using the
Here's what a general header would look like: Here's my first guess at how headers would be handled then, provided that we can assume we're always working on the same "Project":
Does the above make sense? |
That probably depends on what you want to do with the two files. If you just want a simple POT file that can be imported into GlotPress, I don't think GlotPress checks the headers at all. I think the main use case for merging strings would be the one I mentioned in #29: generating a POT file from JS strings and then extracting strings from PHP afterwards.
I'm not sure I'd suggest not adding such a requirement for now (or max. a warning) and see how that goes.
The date should be the current date in both cases, I think. It's a new POT file with new strings after all.
I think so! :-) Right now, the command creates a new POT file and first adds the strings from the existing POT file to it. Now, I just need to add some tests to check for the POT headers. After that, we can iterate from there and perhaps add more strict checks in separate PRs etc. |
src/MakePotCommand.php
Outdated
| * | ||
| * [--merge[=<file>]] | ||
| * : Existing POT file file whose content should be merged with the extracted strings. | ||
| * By default, the following files and folders are ignored: node_modules, .git, .svn, .CVS, .hg, vendor. |
There was a problem hiding this comment.
Merging seems to have messed up the docblocks. --merge & --exclude have the wrong explanations.
There was a problem hiding this comment.
This will also need a refresh of the README.md once fixed.
|
Awesome, @swissspidy, merged another one! |
Add ability to merge with existing POT file
Fixes #29.
Todo:
--mergeand have it pick the destination file.