How to do i18n and create Windows Installer of Haskell programs?

Posted by Aufheben on Stack Overflow See other posts from Stack Overflow or by Aufheben
Published on 2011-02-16T02:21:15Z Indexed on 2011/02/16 7:25 UTC
Read the original article Hit count: 209

I'm considering using Haskell to develop for a little commercial project. The program must be internationalized (to Simplified Chinese, to be specific), and my customer requests that it should be delivered in a one-click Windows Installer form. So basically these are the two problems I'm facing now:

  1. I18n of Haskell programs: the method described in Internationalization of Haskell programs did work (partially) if I change the command of executing the program from LOCALE=zh_CN.UTF-8 ./Main to LANG=zh_CN.UTF-8 ./Main (I'm working on Ubuntu 10.10), however, the Chinese output is garbled, and I've no idea why is that.
  2. Distribution on Windows: I'm used to work under Linux and build & package my Haskell programs using Cabal, but what is the most natural way to create a one-click Windows Installer from a cabalized Haskell package? Is the package bamse the right way to go?

------ Details for the first problem ------

What I did was:

$ hgettext -k __ -o messages.pot Main.hs
$ msginit --input=messages.pot --locale=zh_CN.UTF-8
  (Edit the zh_CN.po file, adding Chinese translation)
$ mkdir -p zh_CN/LC_MESSAGES
$ msgfmt --output-file=zh_CN/LC_MESSAGES/hello.mo zh_CN.po
$ ghc --make Main.hs
$ LANG=zh_CN.UTF-8 ./Main

And the output was like:

terminal output

This indicates gettext is actually working, but for some reason the generated zh_CN.mo file is broken (my guess). I'm pretty sure my zh_CN.po file is encoded in UTF-8. Plus, aside from using System.IO.putStrLn, I also tried System.IO.UTF8.putStrLn to output the string, which didn't work either.

© Stack Overflow or respective owner

Related posts about haskell

Related posts about internationalization