Repository navigation
feat: New @wxt-dev/i18n package - #758
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #758 +/- ##
==========================================
+ Coverage 81.72% 82.02% +0.30%
==========================================
Files 125 125
Lines 6592 6592
Branches 1092 1098 +6
==========================================
+ Hits 5387 5407 +20
+ Misses 1191 1171 -20
Partials 14 14 ☔ View full report in Codecov by Sentry. |
590d804 to
2a6d5ad
Compare
|
Amazing, can't wait to test it. As for now, I've duplicated browser i18n with |
|
Yeah, that's one thing this won't be able to provide, choosing a different language at runtime. Limitation of the i18n APIs :/ |
9855f26 to
46fe694
Compare
|
Alright, everything is implemented and tested, it's looking good! I need to extract some changes to |


Usage
Overview
This closes #327, newer version of PR #343. It's out of date, and now that the repo is a monorepo, it can be it's own package.
i18n.t(...))createI18n<MyI18n>(...))t(..., options)AddNot something all editors support, so skipping@seelinks in JSDoc to link to original messages file?default_localeis missingThis PR should cover all the feedback from:
Additional Info
I decided not to build this on top of
i18nextor a similar library and write it all from scratch. The reason is that thebrowser.i18nAPIs are extremely basic and do not integrate withi18next:i18nextonly supports being in-charge of loading the JSON files, support to "wrap" another library is non-existent.This means we would have to bundle and duplicate all the localization files across all the entrypoints.Edit: It is possible to load translations with a fetch call, without needing to "wrap" another librarybrowser.i18n, and this conflicts withi18next's behavior. This would cause confusion.So, no
i18next. Build on top ofbrowser.i18nwith minimal overhead for features to improve DX.