Make `descriptorFields` option available in `LinguiConfig` and `LinguiConfigNormalized`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 457
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 16
Description
Problem Description
Along with runtimeconfigmodule option (and others like macrojsxplaceholderattribute or macrojsxplaceholderdefaults, ...), which are available to be set in LinguiConfig and read from LinguiConfigNormalized, would it be possible to make the new descriptorFields the same ?
At the moment, descriptorFields config option is stuck inside babel/swc plugins' config only.
Is there any reason this option not being available to be set in the top-level lingui config ?
Reason I am asking is I am creating a lib that enables using Lingui within Sveltekit apps. The lib plugs-in into the vite/rolldown/sveltekit pipeline, and makes Lingui transparently usable in Svelte. Under the hood, it does not use Babel nor Swc for macro compilation, but the raw vite/rolldown transform pipeline along with estree ASTs manipulations. Would like to open-source that very soon.
As far as the macro compilation process goes, I need to be able to read the descriptorFields from the lingui config somewhere ...
Hence my request.
Proposed Solution
import { makeConfig } from "@lingui/conf";
// Should be able to set "descriptorFields" option on LinguiConfig ...
const linguiConfig = makeConfig({
...
descriptorFields: "id-only"
});
// ... and read it from LinguiConfigNormalized
console.log(linguiConfig.descriptorFields);
Alternatives Considered
See proposed solution above.
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the @lingui/conf entry point and inspect how makeConfig produces LinguiConfigNormalized, comparing descriptorFields with runtimeconfigmodule and other top-level options. The work is done when descriptorFields can be supplied to makeConfig and is available on the normalized configuration for consumers outside the Babel and SWC plugins.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, internationalization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100