Creating Language pack [Guide]

Customizing ZModeler3 UI with language packs for localization.

Moderator: Oleg

Locked
User avatar
Oleg
Site Admin
Posts: 14045
Joined: Fri Feb 06, 2004 3:54 am
Contact:

Creating Language pack [Guide]

Post by Oleg »

Making your own localizations.

ZModeler version 3.0.8 and higher supports user localization via .xml files. You can have several localizations, but only one can be active at a time, and this localization controls most of the settings.

If you wish to make your own localization, you can use "Russian" localization as a start point. Be sure to set proper encoding in first line:

Code: Select all

<?xml version="1.0" encoding="windows-1251" ?>
"windows-1251" is a standard Cyrillic encoding for Russian localization; If you need to use another char-set, be sure to write proper value there. Localization supports UTF-8, UTF-16 and Windows-**** char-sets only.

It is suggested to use Notepad++, since you can explicitly specify the encoding char-set of XML file on save.


Most of items are self-explaining, so just write your translations in a trans="..." and hint="..." entries. Be sure to restart ZModeler each time you need changes to take effect. Commands bar entries allow to display multiple hints per button, so you can create multiple <zml:hint> tags inside <zml:tool> branch.

There is no internal difference between tags zml:tool, zml:br and zml:dlg, they are for human-reading semantic only (tool localization, hierarchical branch of localization and a dialog localization). An entry of <zml:item> should be used inside <zml:dlg> to populate a set of localizeable items inside a dialog: these items can have a trans (translation) attribute only; hint attribute is ignored inside zml:item tag.

Language Installation Script.
Since some configuration data is stored in profile and bounded to titles or names, localization could make obsolete some data in user profile and could drop some functionality too. For example, tool hot-keys are saved in localized state, so changing language will drop all hot-keys. To retain functionality of ZModeler3, it's important to ship your localization with installation scripts that will update or populate user profile with required data. At least, default hot-keys and commands bar buttons layout should be configured. Dialogs sizes and layout configuration is preferable too.

The very minimum requirement is a hot-key assignment for the event known as Status Bar&#10;Bump the input box for current tool localized inside "Services" -> "Hotkeys" -> "Events".

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
  <profile xmlns:zmp="http://www.zmodeler2.com/xsd/zmp">
    <zmp:folder name="Services">
      <zmp:folder name="Hotkeys">
        <zmp:inst action="clear" />
        <zmp:folder name="Key_0000">
          <zmp:key name="Title" type="s" value="[RUS]Status Bar&#10;[RUS]Show input box"/>
          <zmp:key name="Key" type="u" value="0x4000009"/>
        </zmp:folder>
      </zmp:folder>
    </zmp:folder>
    <zmp:folder name="Preference">
      <zmp:key name="Localization" type="s" value="Russian"/>
    </zmp:folder>
  </profile>
The script shows clearing available hot-keys and assigning "Tab" hotkey for an event "Show input box". It also specifies "Russian" localization as default startup localization ("Language\Russian.xml" will be loaded).


Installation script is just a truncated ZModeler3_profile.xml file where unnecessary branches are removed. You can use your profile XML as a base of installation script (assuming you have configured hot-keys, buttons, dialogs and such).

Take a look at installation script for Russian localization: it includes instructions to clear certain branches of profile (<zmp:inst action="clear"/> and supplies localized settings for dialogs, layout, hot-keys and so on. Be accurate while cutting pieces
out of your profile, or, preferable, copy whole profile and delete most of unused (non-localized) stuff.

An example Russian localization can be located here: http://www.zmodelerf3.com/files/lang/ru ... zation.zip
Locked