Closed trevcodesjs closed 1 month ago
You need to load catalog in any case. Even if user is on a "default" language. The Lingui is trying to make i18n footprint as small as possible. It drops default messages from the bundle in production builds. Simply image if you will not drop default messages and you switched to ES, user will have to load EN + ES messages. With current lingui strategy, it loads only messages for the one language.
Regarding differences between SWC / babel, there shouldn't be any differences, both of them dropping non-essential props during production builds. The inconsistencies rather related to the setup of this tooling and do they receive NODE_ENV properly.
Describe the bug When I load Lingui without a message catalog but activate a locale, should it render the default English text or the generated key values?
In my case:
My goal is to avoid loading anything unless the user requires i18n. Is this a valid concern, or should the default behavior be different?
To Reproduce Steps to reproduce the behavior, possibly with minimal code sample, e.g:
Expected behavior Expected that the default English strings will render
Additional context
jsLingui version
lingui --version
"@lingui/core": "^4.11.4", "@lingui/macro": "^4.11.4", "@lingui/react": "^4.11.4",Babel version
npm list @babel/core
"@babel/core": "~7.24.3",Macro support:
@lingui/swc-plugin
babel-macro-plugin
Your Babel config (e.g.
.babelrc
) or framework you use (Create React App, NextJs, Vite)