-
Notifications
You must be signed in to change notification settings - Fork 386
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
Optional --config argument for advanced configuration scenarios #501
Conversation
Allows multiple config files to be used within a single project
Codecov Report
@@ Coverage Diff @@
## master #501 +/- ##
=========================================
Coverage ? 91.13%
=========================================
Files ? 51
Lines ? 1421
Branches ? 0
=========================================
Hits ? 1295
Misses ? 126
Partials ? 0
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #501 +/- ##
=========================================
Coverage ? 91.13%
=========================================
Files ? 51
Lines ? 1421
Branches ? 0
=========================================
Hits ? 1295
Misses ? 126
Partials ? 0
Continue to review full report at Codecov.
|
Hey @brandonc, thank you! This is handy! I've added one paragraph to docs and it's ready for release. Could you please take a look at proposal for new configuration for catalog? I'm gonna finish the PR once I merge #499 and it would be great to get a feedback from you, because you use multiple source directories and multiple locale targets. |
Released in v2.8.0 |
This is a breaking change for many webpack users who already specify --config option for webpack. |
@hamczu I'm having trouble picturing the use case. Are you using webpack-cli to invoke lingui? This should work even if you are chaining commands together ( |
@brandonc I guess the problem might be regular webpack build - when you run |
yep, exactly this is happening - I'm just running a webpack dev server: and in my (react) application I use @lingui/loader to load the translated messages: |
@tricoder42 It seems to me that for this feature to be compatible with @lingui/loader, there needs to be options loading support added there. I'm working on that change, in addition to passing in command args to getConfig instead of checking process.argv |
Fix: #509 |
Overview
I have an advanced configuration scenario that requires multiple locale targets and with multiple source directories. I want to end up with multiple catalogs that are loaded in different circumstances.
Presently, I work around the obvious config issue by swapping out my .linguirc file in between runs of
lingui extract
andlingui compile
. This isn't ideal and I thought lingui might benefit from a CLI option to specify a configuration file.This change allows a
--config <path>
option on add-locale, compile, and extract commands. If the path exists, I usecosmiconfig#loadSync
instead of the normal config file probe.If you find this change welcome, I can work more to add details to the docs.
Tradeoffs