GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.25k stars 9.35k forks source link

refactor: share i18n formatting and locales between core and report #13120

Open brendankenny opened 3 years ago

brendankenny commented 3 years ago

tl;dr: our formatting code + intl-messageformat is relatively small. At the very least we can rearrange it to easily ship with swap-locale (#10148), but we should seriously consider shipping it with the main report as well.

This came up in https://github.com/GoogleChrome/lighthouse/pull/10148#discussion_r713454527 most recently, but also just came up in the context of the flow-report (https://github.com/GoogleChrome/lighthouse/pull/13034#discussion_r708637669). We've also had a few instances where we've wanted to format strings in the standalone report with replacement values and haven't been able to.

Starting with concrete plans and moving to more fanciful ideas:

brendankenny commented 3 years ago

for next steps: happy to open a WIP PR for https://github.com/GoogleChrome/lighthouse/compare/master...shared-i18n for more concrete discussion, or we can save for the next eng sync

connorjclark commented 3 years ago

Possible dir structure: