load_textdomain: Incorrect PHPDoc and possibly unwanted merging behaviour
|Reported by:||rovo89||Owned by:||nbachiyski|
The PHPDoc for load_textdomain in wp-includes/l10n.php says that loading a file for an already existing domain will fail. This was correct at the time when the comment was written, but the function has been changed after that and now merges the translations.
However, if a string has been translated in both the already loaded and the new file, the existing translation will be used. In my opinion, it should be the other way round. If I'm satisfied with the translations in general, but want to change just a few of the strings, I have to change the translation file (which would be necessary again for every new version). It would be easier to create a new file with only the changed translations. However, the default domain is loaded at the very beginning, so I can't simply use load_textdomain('default', $myfile);
The attached patch changes this behaviour so that new translations will overwrite existing ones. The PHPDoc should then be changed to reflect the actual behaviour in case of an existing domain. Maybe the @uses references are outdated as well, I'm not sure.