Open AllenPasch opened 4 years ago
Hi @AllenPasch! Thanks for the report. 100% agree that we should not replace an empty string with headers, will try to fix that ASAP. compact will be enabled by default in the next minor version, going to release that soon also.
When using the default arguments for ttag-cli's po2json command, the headers are placed as an object inside the translation of the empty string. Then, when you call
gettext()
with an empty value, the headers are shown in the UI.The typing information for
gettext()
says it returns a string, which isn't true in this case. And the documentation doesn't hint to this very surprising behavior.I think the correct change would be to strip header objects inside
gettext()
and similar functions, in case someone uses ttag-cli's po2json command with the default arguments. It would also be possible change ttag-cli's po2json command to use--force compact
by default, but that could break existing consumers.