https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35332

--- Comment #5 from Jonathan Druart <[email protected]> ---
Created attachment 211597
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211597&action=edit
Bug 35332: Force Content-Transfer-Encoding in messages POT header

- po_extract_messages merges the GNU xgettext (Perl) and xgettext-tt2
  streams with gulp-concat-po, which takes the header from whichever
  stream arrives first
- xgettext-tt2 writes Content-Transfer-Encoding as the last header line
  without a trailing \n, and pofile parses it as '8bit"'
- When the TT2 stream wins, Koha-messages.pot gets
  "Content-Transfer-Encoding: 8bit"\n" and msgmerge fails with
  'keyword "n" unknown' / 'end-of-line within string'
- Set Content-Transfer-Encoding in the forced headers, as already done
  for Project-Id-Version and Content-Type

Test plan:
1. In KTD, show how pofile handles the xgettext-tt2 header:
   cd /kohadevbox/koha
   perl misc/translator/xgettext-tt2 --from-code=UTF-8 -o /tmp/tt.pot
koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
   node -e 'const PO = require("pofile"); const po =
PO.parse(require("fs").readFileSync("/tmp/tt.pot", "utf8"));
require("fs").writeFileSync("/tmp/merged.pot", po.toString())'
   grep Content-Transfer /tmp/merged.pot
   msgcat /tmp/merged.pot -o /dev/null
2. The header line is "Content-Transfer-Encoding: 8bit"\n" and msgcat
   fails with 'keyword "n" unknown'
3. Apply the patch and run:
   gulp po:extract --task messages
   grep Content-Transfer misc/translator/Koha-messages.pot
   msgcat misc/translator/Koha-messages.pot -o /dev/null
4. The header line is "Content-Transfer-Encoding: 8bit\n" and msgcat
   succeeds
5. gulp po:update --lang de-DE completes without msgmerge errors

Assisted-by: Opus 5.5 (Anthropic)
Signed-off-by: Paul Derscheid <[email protected]>
Signed-off-by: David Nind <[email protected]>

Signed-off-by: Jonathan Druart <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to