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

feat: add support for runtimeConfigModule w/ Trans #895

Merged
merged 2 commits into from
Nov 30, 2020

Conversation

arcanis
Copy link
Contributor

@arcanis arcanis commented Nov 29, 2020

The runtimeConfigModule setting cannot be used to transform the hardcoded import {Trans} from '@lingui/react' statements, which is problematic when the Trans symbol is expected to be provided by an intermediary layer (#822).

This diff addresses that by adding support for runtimeConfigModule being an object, in which case the key is the symbol name (either i18n or Trans), and the value is the symbol name and from where to import it. This change is completely backward compatible, only adding syntax.

The test framework doesn't seem to allow for testing runtimeConfigModule (its current implementation doesn't seem tested) so I couldn't add relevant tests.

@vercel
Copy link

vercel bot commented Nov 29, 2020

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/1hcd6rmou
✅ Preview: https://js-lingui-git-mael-runtimeconfigmodule-object.lingui-js.vercel.app

@codecov
Copy link

codecov bot commented Nov 29, 2020

Codecov Report

Merging #895 (319bd8e) into main (ed5f110) will decrease coverage by 0.24%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #895      +/-   ##
==========================================
- Coverage   83.08%   82.84%   -0.25%     
==========================================
  Files          51       51              
  Lines        1437     1446       +9     
  Branches      395      400       +5     
==========================================
+ Hits         1194     1198       +4     
- Misses        142      146       +4     
- Partials      101      102       +1     
Impacted Files Coverage Δ
packages/conf/src/index.ts 87.14% <ø> (ø)
packages/macro/src/index.ts 81.35% <50.00%> (-6.65%) ⬇️

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 ed5f110...319bd8e. Read the comment docs.

@arcanis arcanis force-pushed the mael/runtimeConfigModule-object branch from 257961c to 4880889 Compare November 29, 2020 22:41
@arcanis arcanis changed the title Adds support for objects to runtimeConfigModule feat: add support for runtimeConfigModule w/ Trans Nov 29, 2020
packages/macro/src/index.ts Outdated Show resolved Hide resolved
@semoal
Copy link
Contributor

semoal commented Nov 30, 2020

Looks good to me, except one question that is confusing, thanks for your contribution Maël

Copy link
Contributor

@tricoder42 tricoder42 left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

@tricoder42 tricoder42 merged commit 23b06b5 into lingui:main Nov 30, 2020
@semoal
Copy link
Contributor

semoal commented Dec 8, 2020

😱 Released 3.3.0 with this fix/feature introduced!

npx update-by-scope @lingui

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