Lingui extract doesn't handle i18n._ strings
See original GitHub issueDescribe the bug Lingui extract ignores i18n._
To Reproduce
import { i18n } from "@lingui/core"
export default function App() {
return i18n._('This should be translated!')
}
Expected behavior The text should appear in the .po file
Additional context I review the source code and I found the function isI18nMethod defined at babel-plugin-extract-messages but it looks like is never used.
- jsLingui version
3.12.1
- Babel version
7.16.0
- Your Babel config (
.babelrc
):.babelrc { "presets": [ "@babel/preset-env", "@babel/preset-react", "@lingui/babel-preset-react", "@babel/preset-typescript" ] }
- Lingui config (
.linguirc
).linguirc { "locales": ["en", "es", "de"], "sourceLocale": "en", "catalogs": [{ "path": "<rootDir>/src/app-react/locales/{locale}/translations", "include": ["<rootDir>/src/app-react"], "exclude": ["**/node_modules/**"] }], "format": "po-gettext", "compileNamespace": "ts" }
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
lingui/js-lingui - Gitter
When I run lingui compile it doesn't compile strings for my pseudoLocale which is registered in the config. The culprit seems to be...
Read more >lingui-react - npm
The simplest i18n component is Trans. It's used for simple, singular translations. It supports both variables and inline components. Suppose we ...
Read more >Working with LinguiJS CLI
@lingui/cli provides the lingui command for extracting, ... The extract command looks for messages in the source files and extracts them: yarn extract....
Read more >React i18n break lines in JSON String - Stack Overflow
I did set the text directly and it doesn't work either. I'm setting the text for the dialog via props. You think that...
Read more >How to Localize JavaScript and React Apps with LinguiJS
Its simple syntax makes it easy to get started with, and should be familiar for users of other React i18n libraries. Lingui uses...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@juanluispaz , you can use this workaround:
The extractor uses
/*i18n*/
as a marker for things to extract.I can confirm that this workaround works, thanks @tannerlyons