Skip to content

[localization-plugin] Add a feature for injecting custom localized values into a compilation #5262

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

iclanton
Copy link
Member

Summary

This PR adds a feature to the Webpack 5 localization plugin that allows users to inject custom localized values into a compilation.

How it was tested

Introduced unit tests.

private readonly _pseudolocalizers: Map<string, (str: string) => string> = new Map();
private _customValueSuffixCounter: number = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Using a counter makes the algorithm nondeterministic and therefore not play nicely with running in watch mode. That's why I swapped the string replacement engine to use hashes instead of an auto-incrementing id.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a unique ID parameter, but I can't say I love that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs triage
Development

Successfully merging this pull request may close these issues.

2 participants