Use native line endings when saving .ts files on Windows


lupdate opens .ts files with QIODevice::WriteOnly (binary mode),
so QTextStream always writes LF regardless of platform. On Windows,
this means new .ts files get Unix line endings, and existing CRLF
files lose their line endings, triggering git warnings on every run.

Detect whether the file uses CRLF (or is new/unreadable) and open
with QIODevice::Text so QTextStream translates \n to \r\n. Existing
LF-only files are left as-is.

Change-Id: I0fd60de1bf2e9bd5f31100447990b1b08c5e05d5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Masoud Jami <masoud.jami@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
commitda90870190435247aff3dcfb98eb0dc9e12634ed
parentd88db581046725aa16165f88e0d7c6c7ff3eaf94
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>
commit timeFri, 17 Apr 2026 07:46:43 +0000