Skip to content

Fix string extraction for Webpack function renaming#11775

Merged
aduth merged 1 commit intomainfrom
aduth-i18n-strings
Jan 17, 2025
Merged

Fix string extraction for Webpack function renaming#11775
aduth merged 1 commit intomainfrom
aduth-i18n-strings

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Jan 17, 2025

🛠 Summary of changes

Updates Webpack i18n string extraction to match on a pattern of Webpack renamed source code for references to t in @18f/identity-i18n.

Example source:

 children: i18n_t('in_person_proofing.headings.cta')

This isn't an especially resilient solution, but since we don't currently operate on the raw source of the files, we have to try to extract with some transformations from Webpack and Babel applied (see related #6359).

Related Slack thread: https://gsa-tts.slack.com/archives/C03FA4VBN76/p1737138493859829

📜 Testing Plan

Verify that production-optimized build includes previously-missing strings in output.

NODE_ENV=production yarn build
find ./public/packs -type f -name 'document-capture-*.en.js' -exec grep "in_person_proofing.headings.cta" {} +

The result of the find command should be non-empty. (On main, the result is empty)

changelog: Internal, Localization, Improve reliability of JavaScript string extraction
@aduth aduth requested review from a team and shanechesnutt-ft January 17, 2025 21:30
Copy link
Contributor

@solipet solipet left a comment

Choose a reason for hiding this comment

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

Tested the regex change witih https://regex101.com/r/DBJqyc/1

Copy link
Contributor

@shanechesnutt-ft shanechesnutt-ft left a comment

Choose a reason for hiding this comment

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

Ran the production build locally and everything looks good to me!

@aduth aduth merged commit fef58c2 into main Jan 17, 2025
2 checks passed
@aduth aduth deleted the aduth-i18n-strings branch January 17, 2025 21:50
@eileen-nava
Copy link
Contributor

Thanks for fixing this. 🙏🏻

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.

4 participants