Convert mailman translation to UTF-8

August 17th, 2009 | by David |

Why is the Swedish translation in ISO8859-1? Sooooo 20th century! :-)

Templates

cd /usr/share/mailman/sv
for f in *; do
  mv $f $f.old; iconv -f iso8859-1 -t utf-8 $f.old > $f
done
rm *.old

Translations

cd /var/lib/mailman/messages/sv/LC_MESSAGES
mv mailman.po mailman.po.original
iconv -f iso8859-1 -t utf-8 mailman.po.original > mailman.po
msgfmt mailman.po -o mailman.mo

/etc/mailman/mm_cfg.py

DEFAULT_CHARSET = 'utf-8'

def _(s):
  return s
add_language('sv',    _('Swedish'),       'utf-8')
del _

Update On Ubuntu 8.04 LTS it is also a good idea to apply the patch for Logrotate is noisy with: Re-opening all log files. (It’s a issue with the mailman 2.1.9-9 package, which is the latest one released for Hardy.)

  1. 5 Responses to “Convert mailman translation to UTF-8”

  2. By CJP on Jun 9, 2011 | Reply

    Thank you! Mailman’s archive looked like a puzzle with question marks where all the swedish characters were supposed to be. It would have taken me days to figure out a solution, and it wouldn’t have been this elegant.

  3. By Matías on May 22, 2012 | Reply

    Thanks! Your post helped me a lot.

  4. By leoboiko on Dec 5, 2012 | Reply

    Thanks for the help!

    I stumbled on two little problems after conversion:

    – Some of my existing list descriptions were saved in ISO-8859-1. Converting to UTF-8 broke python (visibly in /var/log/mailman/error ), resulting in shunted messages. Changing the descriptions manually and running /usr/lib/mailman/bin/unshunt fixed it.
    – Also, the list admin overview page broke because it’s in English, and it forced encoding ‘us-ascii’ via the META tag. I fixed it by AddDefaultCharset ‘utf-8′ in Apache, then

    add_language(‘en’, _(‘English (USA)’), ‘utf-8′)

    below the other add_language() calls.

  5. By David on Dec 5, 2012 | Reply

    Great to hear my blog post was useful to you, and I’m sure that your additional information will be useful to other visitors!

  6. By smg on Dec 24, 2012 | Reply

    Great post!

    My mailman work in Debian Squeeze; we don’t have a msgfmt command but a rmsgfmt command (libgettext-ruby1.8). Works fine!

    Thanks very much.

Post a Comment