How to make i18n and create a Haskell Windows Installer program?

I am considering using Haskell to develop a small commercial project. The program must be internationalized (in simplified Chinese, to be specific), and my client requests that it be delivered in the form of a Windows Installer with one click. So basically these are two problems that I am facing right now:

  • I18n Haskell programs: The method described in Internationalizing Haskell Programs worked (partially) if I change the program execution command from LOCALE=zh_CN.UTF-8 ./Mainto LANG=zh_CN.UTF-8 ./Main(I work on Ubuntu 10.10), however, the exit from China is distorted, and I don't know why this is.
  • Distribution on Windows: I'm used to working under Linux, as well as building and bundling my Haskell programs with Cabal, but what is the most natural way to create a one-click Windows installer from a Haskell bonded package? Is bamse package the right way?

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

What I've done:

$ 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 result was like this:

terminal output

This means that gettext actually works, but for some reason the generated zh_CN.mo file is broken (my guess). I am sure my zh_CN.po file is encoded in UTF-8. Also, in addition to using System.IO.putStrLn, I also tried System.IO.UTF8.putStrLnto output a string that didn't work either.

+3
source share
2 answers

, decodeString Codec.Binary.UTF8.String gettext __, :

__ :: String -> String
__ = decodeString . unsafePerformIO . getText

.

+4

, , , .

0

Source: https://habr.com/ru/post/1792393/


All Articles