`lingui extract <..files>` overwrites obsolete flag
When using lingui extract <some file> the result overwrite the obsolete flag of all the messages in the catalog to false. This is unexpected because lingui extract only adds obsolete: true flags and we probably don't want to overwrite this.
Eg lingui extract <file with obsolete translation> will produce the following patch that overwrite the obsolete flag
20
]
],
- "obsolete": true
+ "obsolete": false
},
Also Eg lingui extract <file with changed translation> will produce the following change on listed files
+ ],
+ "obsolete": false
To Reproduce
do a lingui extract <some file> on a project with several files and see that "obsolete": false are added to catalog to translation of unlisted files, or have their "obsolete": true changed to "obsolete": false
Expected behavior
obsolete obsolete flag should be kept pristine when a list of file is supplied to the command line
Code fix proposal
Modify the line at https://github.com/lingui/js-lingui/blob/v4.11.1/packages/cli/src/api/catalog/mergeCatalog.ts#L52
from obsolete: !options.files, to ...(!options.files && { obsolete: true }),
in order to do nothing on obsolete flags for files not listed on command line.
You can prepare a PR with fix and tests we happily accept it.