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

fix: unicode chars were extracting with double slashes #1035

Merged
merged 1 commit into from
Apr 8, 2021
Merged

fix: unicode chars were extracting with double slashes #1035

merged 1 commit into from
Apr 8, 2021

Conversation

semoal
Copy link
Contributor

@semoal semoal commented Apr 8, 2021

Re-fixes the unicode error we found migrating the passCulture application to v3.

I went for a walk and start to think about this and saw that we weren't extracting correctly the unicodes.

\\unicode is not correct => \unicodethis is correct

probably with this adjustment we fix the wrong behaviour when we built the application to production

About the string failing in development about not being processed as a string, we'll see tomorrow debuggin the node_modules which is the root cause

https://media0.giphy.com/media/LmNwrBhejkK9EFP504/200.gif

#1022

@vercel
Copy link

vercel bot commented Apr 8, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/lingui-js/js-lingui/De3JPP6YZa39dTnF2WTo3Q6ZUxTJ
✅ Preview: https://js-lingui-git-fix-lingui-js.vercel.app

@github-actions
Copy link

github-actions bot commented Apr 8, 2021

size-limit report 📦

Path Size
./packages/core/build/cjs/core.production.min.js 2.73 KB (0%)
./packages/detect-locale/build/cjs/detect-locale.production.min.js 798 B (0%)
./packages/react/build/cjs/react.production.min.js 4.85 KB (0%)

@codecov
Copy link

codecov bot commented Apr 8, 2021

Codecov Report

Merging #1035 (5ab3b12) into main (9b2705f) will not change coverage.
The diff coverage is 66.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1035   +/-   ##
=======================================
  Coverage   83.21%   83.21%           
=======================================
  Files          53       53           
  Lines        1626     1626           
  Branches      441      441           
=======================================
  Hits         1353     1353           
  Misses        158      158           
  Partials      115      115           
Impacted Files Coverage Δ
packages/macro/src/macroJsx.ts 91.11% <50.00%> (ø)
packages/macro/src/macroJs.ts 91.11% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b2705f...5ab3b12. Read the comment docs.

@semoal semoal changed the title fix: correct unicode chars formatting fix: unicode chars were extracting with double slashes Apr 8, 2021
@semoal semoal merged commit aed49b1 into main Apr 8, 2021
@semoal semoal deleted the fix branch April 8, 2021 18:43
@kopax-polyconseil
Copy link

I've just tested it and it seems NOK, read more here #1022 (comment)

@semoal
Copy link
Contributor Author

semoal commented Apr 9, 2021

Absolutely right. Drunk some coffees and took the playground i've built yesterday of React Native and start trying out things.

What i've found:

  • 1st the GENIOUS fix i've merged here, it's not ok and the default behaviour is correct.

Cool things I've think I found a fix:

Screenshot 2021-04-09 at 11 34 53
Screenshot 2021-04-09 at 11 34 42

What extracts?:

/*eslint-disable*/ export const messages = {
  'Autoriser l’envoi d’e‑mails': 'Autoriser l’envoi d’e‑mails',
  EAN: 'EAN',
  'Profite de 300 €': 'Profite de 300 €',
  'Version {0}': ['Version ', ['0']],
};
#: App.tsx:41
#: App.tsx:43
msgid "Autoriser l’envoi d’e‑mails"
msgstr "Autoriser l’envoi d’e‑mails"

#: App.tsx:33
#: App.tsx:35
msgid "EAN"
msgstr "EAN"

#: App.tsx:37
#: App.tsx:39
msgid "Profite de 300 €"
msgstr "Profite de 300 €"

#: App.tsx:45
msgid "Version 300 €  {0}"
msgstr "Version 300 €  {0}"

In the case you want strings with unicode chars in the compiled and the .po file, you can use this option in the lingui.config.js:

  compilerBabelOptions: {
    jsescOption: {
      minimal: false,
    },
  },

More info about this option here: https://lingui.js.org/ref/conf.html#compilerbabeloptions

I think we're close of fixing this, the pending one is to make sure that this fixes are fixed also in the prod build

@semoal
Copy link
Contributor Author

semoal commented Apr 9, 2021

Also i saw that we use EventEmitter class for our internal events inside Lingui but React Native doesn't have EventEmitter, I'm looking already on it

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

Successfully merging this pull request may close these issues.

2 participants