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

refactor: getTranslations, prepare for hash-based ids #1443

Merged

Conversation

timofei-iatsenko
Copy link
Collaborator

Description

#1440 (comment)

Yesterday I thought that i was close to finish this task, but inverting logic with explicit-id flag revealed many issues in the other part of code which should be fixed to get this merged.

Many of them due to the fact that while compiling catalogs lingui operates with only key and translation, where key is a natural language string. Many places in the code works based on that assumptions, and in many places there is a fallback to the "key" if no translation found.

With new hashbased id, key is always a hash, and this fallback just doesn't work. Instead, i should change the logic to operate with id, source string, translation, and in case there are no translation fallback to source string first and to id as last resort.

Unfortunately, there is complicated fallbacks logic, which is not fully covered by tests, so i need to refactor this first.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Feb 17, 2023

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

Name Status Preview Comments Updated
js-lingui ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 17, 2023 at 3:11PM (UTC)

@github-actions
Copy link

github-actions bot commented Feb 17, 2023

size-limit report 📦

Path Size
./packages/core/build/esm/index.js 1.76 KB (0%)
./packages/detect-locale/build/esm/index.js 812 B (0%)
./packages/react/build/esm/index.js 1.79 KB (0%)
./packages/remote-loader/build/esm/index.js 7.29 KB (0%)

@codecov
Copy link

codecov bot commented Feb 17, 2023

Codecov Report

Base: 71.31% // Head: 71.88% // Increases project coverage by +0.57% 🎉

Coverage data is based on head (944b340) compared to base (5ba7460).
Patch coverage: 95.45% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1443      +/-   ##
==========================================
+ Coverage   71.31%   71.88%   +0.57%     
==========================================
  Files          74       75       +1     
  Lines        1921     1921              
  Branches      515      518       +3     
==========================================
+ Hits         1370     1381      +11     
+ Misses        443      435       -8     
+ Partials      108      105       -3     
Impacted Files Coverage Δ
packages/cli/src/lingui-compile.ts 32.18% <84.61%> (+1.59%) ⬆️
packages/cli/src/api/catalog.ts 90.62% <100.00%> (+4.05%) ⬆️
packages/cli/src/api/getTranslationsForCatalog.ts 100.00% <100.00%> (ø)
packages/snowpack-plugin/src/index.ts 100.00% <100.00%> (ø)
packages/vite-plugin/src/index.ts 81.81% <100.00%> (-3.90%) ⬇️

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.

@timofei-iatsenko timofei-iatsenko mentioned this pull request Feb 17, 2023
14 tasks
Copy link
Contributor

@Martin005 Martin005 left a comment

Choose a reason for hiding this comment

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

Great job, thanks 🚀

@andrii-bodnar andrii-bodnar merged commit d8dd570 into lingui:next Feb 17, 2023
@timofei-iatsenko timofei-iatsenko deleted the refactor/get-translations branch February 17, 2023 15:42
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.

3 participants