Is the #: (file, line number) line in a wordpress .po file necessary Is the #: (file, line number) line in a wordpress .po file necessary wordpress wordpress

Is the #: (file, line number) line in a wordpress .po file necessary


Its a comment and its not required. Its there mostly for historical reason, where it were more difficult to find out, where a specific string occurs. Additional this is usually (then and now) added automatically by a parser, that creates the translate-templates right from the source, and not manually by hand.


All lines starting with # are optionals in .po files. Still, this does not mean that they are unnecessary or useless.

For example the lines with #: do specify location of the strings in source code, something very useful when you try to solve internationalization issues.

Also, I would not recommend you to write your own parser for .po files because even it this format may seam simple to read, it is not so simple to parse - it has lots of features that are not obvious. You will end up wasting time on improving your partial parser. Instead go for an existing one.