Skip to content

fix: Make pseudolocal use the message AST instead of the key#1293

Merged
semoal merged 2 commits into
lingui:mainfrom
sharonyogev:fix-pseudolocalization
Nov 7, 2022
Merged

fix: Make pseudolocal use the message AST instead of the key#1293
semoal merged 2 commits into
lingui:mainfrom
sharonyogev:fix-pseudolocalization

Conversation

@sharonyogev
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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

Hello: "Ahoj",
Missing: "",
Select: "{id, select, Gen {Genesis} 1John {1 John} other {____}}"
Select: "{id, select, Gen {Genesis} 1John {1 John} other {____}}",
Copy link
Copy Markdown
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)

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
Copy Markdown
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)

Comment thread packages/cli/src/api/pseudoLocalize.test.ts
Comment thread packages/cli/src/api/compile.ts
Comment thread packages/cli/src/api/compile.test.ts
Comment thread packages/cli/src/api/compile.test.ts
@sharonyogev sharonyogev force-pushed the fix-pseudolocalization branch from 7097313 to 5b3b6a8 Compare October 23, 2022 06:36
expect(pseudoLocalize("replace { count }")).toEqual("ŕēƥĺàćē { count }")
})

it("multiple plurals pseudolocalize gives wrong ICU message", () => {
Copy link
Copy Markdown
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
Copy Markdown

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