CLI command `extract --overwrite` deletes msgstr values in source locale po file
See original GitHub issueDescribe the bug
The first time lingui extract --overwrite
is run then it generates po file entries for the source locale with identical msgid
and msgstr
values, e.g.
#: src/file.ts:105
msgid "Hello world"
msgstr "Hello world"
But then future runs of lingui extract --overwrite
will remove the msgstr
values in existing unedited entries, and changes the above to,
#: src/file.ts:105
msgid "Hello world"
This renders the source locale po file seemingly invalid, and breaks integrations with some cloud translation services like CrowdIn with errors like The imported messages.po localization file is invalid. GetText PO validation module said: line ###: missing msgstr section
.
To Reproduce
Config looks like
module.exports = {
sourceLocale: 'en',
srcPathDirs: ['<rootDir>/src'],
format: 'po',
sorting: 'origin',
localeDir: '<rootDir>/src/locale',
}
And we’re just using the plain JS approach (not React), e.g.
import { t } from '@lingui/macro'
i18n._(t`Hello world`)
Expected behavior
Repeated runs of lingui extract --overwrite
do not remove msgstr
entries for existing translations in the source locale po file. Although this is an assumption, and my understanding of the process may be faulty.
Additional context
Add any other context about the problem here.
- jsLingui version
2.9.1
- Babel version
babel-core@7.0.0-bridge.0
- Your Babel config
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: '10',
},
modules: 'cjs',
},
],
'@babel/typescript',
],
plugins: [
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread',
'macros',
],
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
any update on this? I don’t think it should be [wontfix]…
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.