· Ubuntu

Convert mailman translation to UTF-8

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.)

5 comments

Comments are archived from the original blog and closed.

  1. CJP ·

    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.

  2. Matías ·

    Thanks! Your post helped me a lot.

  3. leoboiko ·

    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.

  4. David · · reply to leoboiko

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

  5. smg ·

    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.