Results 1 to 10 of 85

Thread: HOWTO: CJK in Wine (Chinese, Japanese & Korean)

Threaded View

  1. #1
    Join Date
    Jan 2007
    Location
    Beijing, China
    Beans
    61

    HOWTO: CJK in Wine (Chinese, Japanese & Korean)

    The system I tested it on was 32-bit Ubuntu Feisty 7.04.

    The guide is provided at users' own risk. I will try to provide support and answer questions in the thread, but if you somehow type something wrong and send your OS spiraling into /dev/null, don't blame me.


    UPDATE: The new WineLocale 0.41 attached to this thread also supports Arabic, Greek, Hebrew and Russian. It is no longer CJK only. However, because this thread is marked CJK in Wine, I won't add the directions to it. Download the file and follow the extra steps in INSTALL to get these languages working.

    OK, the web proved totally unhelpful for me to figure this out, so I imagine some of your out there in Ubuntu user-land are having the same problems.

    Ordinarily, running a CJK application in Wine results in lots of garbled text. On a good day, you will get empty boxes. On a bad day, it looks like the ASCII table exploded.

    No more. I put together a little shell script called WineLocale (after Microsoft's AppLocale which solves the same problem on Windows). So far, it only supports Japanese, Korean, Simplified Chinese and Traditional Chinese. I don't know enough about Hebrew, Arabic and Russian to add those. If you want to help out, by all means. Read ~/.wineloc/patches/HOWTO after installing.

    The below directions are all in WineLocale's INSTALL file, but I've repeated them here because they have great generic use for anyone wondering about locales.

    Just a note, purgelocales is not a solution because it refuses to show non-ASCII compatible mappings (for example, SJIS, which all pre-XP Japanese applications are).

    Step 1: Getting the Locales

    Execute the following:
    Code:
    $ cd /var/lib/locales/supported.d/
    # touch ja
    # touch ko
    # touch zh
    Now open up the three files in a text editor and make certain each contains the following lines.

    /var/lib/locales/supported.d/ja
    Code:
    ja_JP.UTF-8 UTF-8
    ja_JP SJIS
    ja_JP.EUC-JP EUC-JP
    /var/lib/locales/supported.d/ko
    Code:
    ko_KR.UTF-8 UTF-8
    ko_KR.EUC-KR EUC-KR
    /var/lib/locales/supported.d/zh
    Code:
    zh_CN.UTF-8 UTF-8
    zh_TW.UTF-8 UTF-8
    zh_CN GB2312
    zh_CN.GBK GBK
    zh_CN.GB18030 GB18030
    zh_TW Big5
    If the lines are there and everything is saved, run:

    Code:
    # dpkg-reconfigure locales
    It will throw a warning about SJIS, but trust me, it's OK. Run the command again and everything will say "up-to-date" this time.

    Next, prepare for a hellishly long download depending on which fonts you have installed (and if you live in, say, China, like me--our Ubuntu mirror sucks)

    Code:
    # apt-get install ttf-arphic-ukai ttf-arphic-uming ttf-kochi-gothic ttf-kochi-mincho ttf-mikachan ttf-mona ttf-sazanami-gothic ttf-saxanami-mincho ttf-vlgothic ttf-alee ttf-arphic-ukai ttf-arphic-uming ttf-baekmuk ttf-unfonts ttf-arphic-bkai00mp ttf-arphic-bsmi00lp ttf-arphic-gbsn00lp ttf-arphic-gkai00mp ttf-arphic-ukai ttf-arphic-uming
    Next up, even with all those installed, we will be missing a true Chinese font that handles multiple encodings. Don't suggest any of the AR fonts. It will FAIL on the menu bar of a Wine application. This step is necessary.

    We will install Vera Sans YuanTi provided by the Chinese Ubuntu project. Sadly, there's no easy package for this one. We have to do:

    Code:
    $ wget http://download.ubuntu.org.cn/software/VeraSansYuanTi.tar.gz
    $ tar -zxpvf VeraSansYuanTi.tar.gz
    # mv VeraSansYuanTi /usr/share/fonts/
    # fc-cache -f
    # cp /etc/fonts/fonts.conf /etc/fonts/fonts.conf.old
    # cp /usr/share/fonts/VeraSansYuanTi/fonts.conf /etc/fonts/
    If you check the INSTALL file of WineLocale, you'll find information about installing Windows fonts. I will leave it out of this guide, because even without those we will get a fully functioning CJK Wine this way If you want the exact same fonts found in Window, follow that part of the guide.

    Step 2: Stealing a nice Wine setup

    The default ~/.wine/drive_c created when you run Wine sucks. Hard. It would take a lot of configuring to get something usable, so instead of suffering that, we'll steal one.

    Your best bet is to get one from the IEs4Linux project. They provide an amazing setup that, when complete, will contain most of the major system DLLs. I find many applications Wine cannot normally run work fine when I use the IEs4Linux setup. So that's what this guide recommends you do.

    Make sure your apt-get sources.list has universe and multiverse enabled, then run the following:

    Code:
    # apt-get update
    # apt-get install cabextract wine
    $ wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
    $ tar zxpvf ies4linux-latest.tar.gz
    $ cd ies4linux-*
    $ ./ies4linux
    Run the new "ie6" command once and close it. Now do:

    Code:
    $ rm -rf ~/.wine/*
    $ cp -r ~/.ies4linux/ie6/* ~/.wine/
    Step 3: Install WineLocale

    Download WineLocale from my website <http://www.cinnamonpirate.com/software/winelocale/> or grab it with wget:

    Code:
    $ wget http://www.cinnamonpirate.com/pub/software/sh/wineloc-0.41.tar.gz
    $ tar zxpvf wineloc-0.41.tar.gz
    $ cd wineloc-0.41
    $ ./install
    This will install the WineLocale default files in /usr/local/share/wineloc and create a symlink in /usr/local/bin. You can now run "wineloc" from anywhere on your system.

    Step 4: Using WineLocale

    WineLocale, at base, is extremely easy to use. The simplest command line is:

    Code:
    $ wineloc -l zh_CN /path/to/executable.exe
    -l is the locale flag. If omitted, WineLocale will run it in your current system locale. Valid options are:
    [*]ja_JP - Japanese[*]ko_KR - Korean[*]zh_CN - Chinese (Simplified)[*]zh_TW - Chinese (Traditional)

    zh_HK and zh_SG will just alias to the other two Chinese modes if you use them. There is also a -o flag that will let you enable DLL overrides (use real DLLs instead of Wine's). This option is tied to a IEs4Linux created Wine setup. If you didn't use theirs, don't touch it or evil magic may happen. Hey, don't complain about "choice": you have the choice not to follow this guide

    There's also one more option, -f, which lets you specify a different font group. "common" is the default, but there is also a "win" packed in if you followed the guide to install Windows fonts.

    You can create your own font themes and overrides if you explore ~/.wineloc/patches, but that's a topic for another guide.

    If you followed everything so far, congratulation, you can now run CJK applications in Wine. On launch, the registry will be hacked up to fit your locale. On exit, everything reverts back to the default so your normal Wine applications won't exhibit any odd behavior. If you manage to "crash" it so settings get stuck, you can run this command to reset all font preferences. Ignore any "errors":

    Code:
    $ regedit /usr/local/share/wineloc/patches/default.reg
    If you check my website, you can see pictures of CJK applications running using WineLocale. To get your Wine applications looking close to the rest of your UI, you need to use "winecfg". Check section iii of INSTALL, "Configuring Wine with winecfg," to see how to do this.

    Have fun
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by D--; July 2nd, 2007 at 06:03 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •