Problem/Motivation
I'd like to export a list of all translation strings with `drush locale:export en | msguniq -`.
However, `msquniq` fails with a fatal error due to duplication of the empty string msgid:
$ ./bin/drush locale:export en | msguniq
: warning: Charset missing in header.
Message conversion to user's charset will not work.
:4632: duplicate message definition...
:4: ...this is the location of the first definition
msguniq: found 1 fatal error
$ ./bin/drush locale:export en | head -6
# Global translation of ...........
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2021-07-08 10:28+0000\n"
testing@xpc:~/src$
and the lines 4632-4633
$ ./bin/drush locale:export en | head -4633 | tail -2
msgid ""
msgstr ""
Steps to reproduce
Not sure HOW the empty message string got in, so no steps to reproduce available.
This issue is identical to the report in
https://www.drupal.org/project/drupal/issues/1940436 β
- so apparently there's a general pattern, spanning generations that this problem "returns".
So it's most likely something trivial like "import doesn't check whether msgid is empty :-p
Proposed resolution
- Never export the empty string at the API level
- Change the data model or API to raise a violation when trying to store the equivalent of an empty string for source
.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet