Yak-Shaving, Printing Emails Edition

„Martin, could you provide me that email as a signed PDF?” was the request by a good friend of mine. „That should be easy,” I thought. Famous last words.

The first try, printing directly from (neo)mutt to the CUPS PDF printer failed from the start, as I did not have the PDF printer installed yet. A quick „sudo apt install cups-pdf” later, I failed by being unable to specify the correct printer. After reading up on lpr and lpstat I finally got a print result. And after a few more minutes fiddling around with the border settings of the print driver, I was finally able to create a decently looking PDF of an email.

But it did not look „good” so I kept searching and found „muttprint”. A quick „sudo apt install muttprint” later, I was again unable to print at all. After some tweaking, I was able to remedy that situation. And it looked „LaTeXy” in a good way :D After some more tweaking, even the Umlauts and the date were printed with the correct encoding and formatting (ISO 8601).

Except the date in the footer of the page which kept using the funky date format used in the USA. So I started experimenting with multiple locale settings to change the date format in the footer. Which of course just wasted time but did not render useful results.

So, grasping at straws, I started to do, what nobody wants to do. I started reading the documentation. As the manpage did not yield any solutions, I did some more „research” (aka. frantic googeling) and finally found the muttprint manual SGML source code (I could not find the HTML or PDF version, stupid me), which clearly states:

The date in the footer is generated by LaTeX and so it’s in the language specified by LC_MESSAGES.

Even though I was quite sure that I did set LC_MESSAGE before, I tried again. And it failed again. So I had to dig deeper. The locale was set correctly, so what is failing here? It had to be LaTeX.

So, after some research, I learned that this has to do something with „babel”. And the muttprint sourcecode also contained the relevant statements:

\\usepackage[$babellanguage]{babel}
...
\\lfoot{\\today}

But it should pick up the language from the locale and not stick with the stupid USA-format. Even using „--print-locale” showed the correct settings:

$ LC_MESSAGES=de /usr/bin/muttprint -f example.eml --date local --date-format '%Y-%m-%d %H:%M:%S' -p PDF --print-locale
...
Encoding ......: ANSI_X3.4-1968
Language ......: de
Country .......: US
Babel option ..: ngerman
TeX inputenc ..: latin1
TeX fontenc ...: T1

Look, LaTex, THERE! It says „ngerman”, why do you not use it ????

Well, after some additional time poking around, I FINALLY looked into the muttprint logfile (/tmp/muttprint.log) and lo and behold:

Package babel Error: Unknown option 'ngerman'. Either you misspelled it
(babel)                or the language definition file ngerman.ldf
(babel)                was not found.

But why? Muttprint says everything is fine. dpkg shows that language support for European languages is installed:

$ dpkg -l | grep -i texlive-lang
ii  texlive-lang-european ... TeX Live: Other European languages

Well, after some more online-digging I found out that the organization of the babel language files has „recently changed” [insert „burn everything down meme here”]. Apparently, you need to manually install „texlive-lang-[LANGUAGE]” to get proper language support.

A quick „sudo apt-get install texlive-lang-german” and half an hour later (due to „Building latex-based formats –byhyphen language.dat”), I was finally able to print an email from mutt using muttprint with a German „long date” in the footer.

That was easy, wasn’t it? Took almost no time …

Tagged as: , , , , , , , | Author:
[Sonntag, 20241103, 15:21 | permanent link | 0 Kommentar(e)

Name: (required)
E-Mail: (required, never published)
URL: (not required, published)
Comments:
Use a working email address, unless you want your comment to be removed.

Disclaimer

„Leyrers Online Pamphlet“ ist die persönliche Website von mir, Martin Leyrer. Die hier veröffentlichten Beiträge spiegeln meine Ideen, Interessen, meinen Humor und fallweise auch mein Leben wider.
The postings on this site are my own and do not represent the positions, strategies or opinions of any former, current or future employer of mine.
Impressum / Offenlegung gemäß § 25 Mediengesetz

Search

Me, Elsewhere

Tag Cloud

2007, 2blog, 2do, 2read, a-trust, a.trust, a1, accessability, acta, advent, age, ai, amazon, ankündigung, apache, apple, at, audio, austria, backup, barcamp, basteln, bba, big brother awards, birthday, blog, blogging, book, books, browser, Browser_-_Firefox, bruce sterling, buch, bürgerkarte, cars, cartoon, ccc, cfp, christmas, cloud, coding, collection, command line, commandline, computer, computing, concert, conference, copyright, covid19, css, database, date, datenschutz, debian, delicious, demokratie, design, desktop, deutsch, deutschland, dev, developer, development, devops, digitalisierung, digitalks, dilbert, disobay, dna, dns, Doctor Who, documentation, Domino, domino, Douglas Adams, download, downloads, drm, dsk, dvd, e-card, e-government, e-mail, e-voting, E71, education, Ein_Tag_im_Leben, elga, email, encryption, essen, EU, eu, event, events, exchange, Extensions, fail, fedora, feedback, film, firefox, flash, flightexpress, food, foto, fsfe, fun, future, games, gaming, geek, geld, git, gleichberechtigung, google, graz, grüne, grüninnen, hack, hacker, handtuch, handy, hardware, HHGTTG, history, how-to, howto, hp, html, humor, ibm, IBM, ical, iCalendar, image, innovation, intel, internet, internet explorer, iot, iphone, ipod, isp, IT, it, itfails, itfailsAT, itfailsDE, java, javascript, job, jobmarket, journalismus, keyboard, knowledge, konzert, language, laptop, law, lego, lenovo, life, links, linux, Linux, linuxwochen, linuxwochenende, live, living, lol, london, lost+found, lotus, Lotus, Lotus Notes, lotus notes, LotusNotes, lotusnotes, Lotusphere, lotusphere, Lotusphere2006, lotusphere2007, Lotusphere2008, lotusphere2008, lustig, m3_bei_der_Arbeit, mac, mail, marketing, mathematik, media, medien, metalab, microsoft, Microsoft, mITtendrin, mobile, mood, motivation, movie, mp3, multimedia, music, musik, männer, nasa, nerd, netwatcher, network, netzpolitik, news, nokia, notes, Notes, Notes+Domino, office, online, OOXML, open source, openoffice, opensource, orf, orlando, os, outlook, patents, pc, pdf, performance, perl, personal, php, picture, pictures, podcast, politics, politik, pr, press, presse, privacy, privatsphäre, productivity, programming, protest, public speaking, qtalk, quintessenz, quote, quotes, radio, rant, recherche, recht, release, review, rezension, rip, rss, science, search, security, server, settings, sf, shaarli, Show-n-tell thursday, sicherheit, silverlight, smtp, SnTT, social media, software, sony, sound, space, spam, sprache, spö, ssh, ssl, standards, storage, story, stupid, summerspecial, sun, surveillance, sysadmin, talk, talks, technology, The Hitchhikers Guide to the Galaxy, theme, think, thinkpad, thunderbird, tip, tipp, tools, topgear, torrent, towel, Towel Day, TowelDay, travel, truth, tv, twitter, ubuntu, ui, uk, unix, update, usa, usb, vds, video, videoüberwachung, vienna, vim, Vim, vintage, vista, vorratsdatenspeicherung, vortrag, wahl, wcm, web, web 2.0, web2.0, web20, Web20, webdesign, werbung, wien, wiener linien, wikileaks, windows, windows 7, wired, wishlist, wissen, Wissen_ist_Macht, wlan, work, workshops, wow, writing, wtf, Wunschzettel, wunschzettel, www, xbox, xml, xp, zensur, zukunft, zune, österreich, övp, übersetzung, überwachung

AFK Readinglist