Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Unicode characters are removed from .po when they are in msgstr #1098

Closed
Tracked by #1128
JSteunou opened this issue Jul 20, 2021 · 4 comments · Fixed by #1125
Closed
Tracked by #1128

Unicode characters are removed from .po when they are in msgstr #1098

JSteunou opened this issue Jul 20, 2021 · 4 comments · Fixed by #1125

Comments

@JSteunou
Copy link
Contributor

JSteunou commented Jul 20, 2021

Describe the bug

When using po format and adding some unicode char like \xA0 in msgstr it works at runtime, but running the CLI to extract messages remove all of those char

To Reproduce

msgid "Welcome!"
msgstr "Bienvenue\xA0!"

Save it, extract again, boom, \xA0 is gone

Expected behavior

Should keep this char

Additional context
Add any other context about the problem here.

  • jsLingui version lingui --version 3.10.4
  • Babel version npm list @babel/core 7.14.6
  • Your Babel config (e.g. .babelrc) or framework you use (Create React App, Meteor, etc.)

I tried to play with jsesc configuration, all kind... no luck :(

@semoal
Copy link
Contributor

semoal commented Aug 30, 2021

https://github.com/lingui/js-lingui/pull/1032/files
We remove extra-scaped literals, probably we should add there. /x together with /u.

What do you think?

@JSteunou
Copy link
Contributor Author

I m not sure, because my issue is not for char in the key or message extracted by the macro logic, but in po files msgstr section aka the final translation.

The issue here is that running the CLI to discover new translation keys corrupt the current dictionary which is kind of worse I guess?

@semoal
Copy link
Contributor

semoal commented Aug 30, 2021

Macro is the responsible of generating the final translation.

@JSteunou
Copy link
Contributor Author

Ho ok I did not understand that. With that name I supposed it was only the part responsible for extraction from code (babel-macros / Macro). Also the tests from the commit you linked shows a test with extraction key, not value from dictionary.

Then yeah it might be linked, worth the shot

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

Successfully merging a pull request may close this issue.

2 participants