Localizing UI Text

From Multiverse

Jump to: navigation, search

Contents

Overview

The Multiverse Client can display international characters as well as standard ASCII characters.

To make enable international character display, do the following:

  1. Modify Interface\FrameXML\MvFonts.xml file in your asset repository as described below.
  2. Add a command to make the server to send the localized characters to the client
  3. Test

Modifying font XML file

In Interface\FrameXML\MvFonts.xml file, there is an entry that defines the ChatFont as follows:

<FontString name="ChatFont" font="Fonts\MUFN____.TTF" virtual="true">
    <FontHeight>
        <AbsValue val="16"/>
    </FontHeight>
    <Color r="1.0" g="1.0" b="1.0"/>
</FontString>

To make the client use a different font with more characters, do the following:

  • Place the font that contains the characters you wish to display in the Fonts folder of your asset repository.
  • Change the XML that defines the font template to reference this font (for example, SIMHEI.TTF), and generate characters for 65536 unicode characters (with the bytes attribute).

Here is an example:

<FontString name="ChatFont" font="Fonts\SIMHEI.TTF" bytes="65536" virtual="true">
    <FontHeight>
        <AbsValue val="16"/>
    </FontHeight>
    <Color r="1.0" g="1.0" b="1.0"/>
</FontString>

Now the client will display international characters.

Modifying old chat frame XML file

Older versions of MvChat.xml explicitly limited the character set to 256 bytes. The older version had the following line:

<FontString inherits="ChatFont" bytes="256">

The bytes argument should be removed so that the line is:

<FontString inherits="ChatFont">

Sending international characters to the client

The make the server to send the localized characters to the client, add the following to extensions_proxy.py in your world directory on the server:

class TestFontCommand(ProxyPlugin.CommandParser):
    def parse(self, cmdEvent):
        playerOid = cmdEvent.getObjectOid()
        WorldManagerClient.sendObjChatMsg(playerOid, 1, u"你好!")
        Log.debug("/testfont: oid=" + str(playerOid))
        return None

proxyPlugin.registerCommand("/testfont", TestFontCommand())

Be sure to precde the Python string with the u character to indicate that the string is Unicode. Also be sure that extensions_proxy.py is saved using UTF-8. Unfortunately, Jython does not support the UTF-8 signature that is usually placed at the beginning of the file, so this may need to be removed.

Testing

Launch the client, connect to the server, and send a /testfont command. You should see the appropriate response.

Personal tools