-
Notifications
You must be signed in to change notification settings - Fork 371
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
#296: Add pseudolocalization #309
Conversation
} | ||
|
||
function pseudoLocalize(message) { | ||
pseudoloc.option.delimiter = delimiter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do these properties need to be specified again for each message? Is there some global state that needs to be reset every time? I haven't studied pseudoloc so closely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not needed every time. I will try to do it only once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it. It is run only once with boolean switch. I didn't want to move setting the option outside of pseudoLocalize file
Codecov Report
@@ Coverage Diff @@
## master #309 +/- ##
==========================================
+ Coverage 91.66% 95.38% +3.71%
==========================================
Files 42 43 +1
Lines 1104 1127 +23
==========================================
+ Hits 1012 1075 +63
+ Misses 92 52 -40
Continue to review full report at Codecov.
|
@MartinCerny-awin Looks pretty good! Is it ready for merge? |
I did documentation in my IDE. It might be good to check it. Otherwise I am happy with it. |
@MartinCerny-awin There are conflicts. Can you fix those, please? |
@FredyC I've just merged it. It was probably caused when I removed opencollective... |
@MartinCerny-awin Thank you! There're few minor formatting issues in docs, but I'll fix them on master. Great work! Thank you for working on this 👏 |
Closes #296
Documentation
It is without documentation. I will add it later after we discuss that the code is ok.Pseudolo Library
Newly published library https://www.npmjs.com/package/pseudolocale forked from pseudoloc with idempotence and option to specify delimiter using Regex special characters.
I have tried to use pseudoloc https://github.com/bunkat/pseudoloc library, but there there two behaviours which made it impossible. The first one was that the library was returning different results every time. This would cause changes in versioning system for unchanged translations. The second one was incompatibility with RegEx special characters. This made escaping HTML tags impossible.I have also tried to use another libraries, but it required RegExp to match non HTML tags. I could not find the solution and SO did not have understanding for my question https://stackoverflow.com/questions/52121600/regular-expression-to-match-non-html-tagsAt the end, I have fixed these problems in my fork: https://github.com/MartinCerny-awin/pseudoloc/commits/masterI can try to merge it into original library, but it doesn't look very active and it might take time or it might not even get merged as the author could have different opinion on idempotence. Should I create a new library while waiting for the merge?Flow
I had to remove flow from packages/cli/src/lingui-extract.test.js as I could not type mocks.
Tests
Are there more tests to verify that pseudolocalization works correctly?