Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

gettext("") returns headers when using ttag-cli's po2json with default arguments #196

Open
AllenPasch opened this issue Apr 22, 2020 · 1 comment

Comments

@AllenPasch
Copy link

AllenPasch commented Apr 22, 2020

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.

@AlexMost
Copy link
Member

AlexMost commented Apr 22, 2020

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants