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: Make pseudolocal use the message AST instead of the key #1293

Merged
merged 2 commits into from
Nov 7, 2022

Conversation

sharonyogev
Copy link
Contributor

This is fixing this issue: #1213

I'm not sure why in this PR (#1165) there was a change from the message to the key, but I hope I don't mess anything

Also, I wonder if we should remove the addDelimitersVariables & addDelimitersMacro and keep only the handling of HTML inside the pseudoLocalize.ts code

@vercel
Copy link

vercel bot commented Oct 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
js-lingui ✅ Ready (Inspect) Visit Preview Oct 23, 2022 at 6:37AM (UTC)

@sharonyogev sharonyogev changed the title Make pseudoLocalization use the message AST instead of the key fix: Make pseudoLocalization use the message AST instead of the key Oct 19, 2022
})

describe("createCompiledCatalog", () => {
it("nested message", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just added this test for more coverage on this file

@@ -113,7 +265,7 @@ describe("createCompiledCatalog", () => {
{
Hello: "Ahoj",
Missing: "",
Select: "{id, select, Gen {Genesis} 1John {1 John} other {____}}"
Select: "{id, select, Gen {Genesis} 1John {1 John} other {____}}",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier changes (this and the following)

@@ -50,20 +50,20 @@ describe("PseudoLocalization", () => {
it("with HTML tags", () => {
expect(
pseudoLocalize(
"{count, plural, zero {There's # <span>message</span>} other {There are # messages}"
"{count, plural, zero {There's # <span>message</span>} other {There are # messages}}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these weren't valid ICU messages (it does not make the tests failed, since these tests does not validate it's a valid ICU message), but still need to be correct (unless we'll remove the ICU handling from this file)

packages/cli/src/api/pseudoLocalize.test.ts Show resolved Hide resolved
packages/cli/src/api/compile.ts Show resolved Hide resolved
packages/cli/src/api/compile.test.ts Outdated Show resolved Hide resolved
packages/cli/src/api/compile.test.ts Show resolved Hide resolved
@@ -92,4 +92,14 @@ describe("PseudoLocalization", () => {
expect(pseudoLocalize("replace {count}")).toEqual("ŕēƥĺàćē {count}")
expect(pseudoLocalize("replace { count }")).toEqual("ŕēƥĺàćē { count }")
})

it("multiple plurals pseudolocalize gives wrong ICU message", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the test that shows why the currently implemented ICU support in pseudoLocalize.ts is wrong

@codecov
Copy link

codecov bot commented Oct 28, 2022

Codecov Report

Base: 81.67% // Head: 82.08% // Increases project coverage by +0.41% 🎉

Coverage data is based on head (5b3b6a8) compared to base (da070ba).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1293      +/-   ##
==========================================
+ Coverage   81.67%   82.08%   +0.41%     
==========================================
  Files          56       56              
  Lines        1779     1781       +2     
  Branches      495      496       +1     
==========================================
+ Hits         1453     1462       +9     
+ Misses        196      192       -4     
+ Partials      130      127       -3     
Impacted Files Coverage Δ
packages/cli/src/api/compile.ts 100.00% <100.00%> (+11.66%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@semoal semoal changed the title fix: Make pseudoLocalization use the message AST instead of the key fix: Make pseudolocal use the message AST instead of the key Nov 7, 2022
@semoal semoal merged commit 7c85cb7 into lingui:main Nov 7, 2022
@andrii-bodnar andrii-bodnar linked an issue Dec 29, 2022 that may be closed by this pull request
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.

Fallback locales not taken into account for pseudoLocale
3 participants