Configuration:Create Menu Language

From Scrabble3D Manual
Revision as of 13:37, 1 October 2014 by Ocye (Talk | contribs) (Created page with " This page describes the alternate, legacy method of localization. The current procedure can be found here. By choosing a menu language, the d...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This page describes the alternate, legacy method of localization.
The current procedure can be found here.

By choosing a menu language, the dialog elements of the program are shown in your localization. The items are read from a simple text file, using the ini style formatting but with the file extension .lang. The file has to be stored with UTF-8 encoding. If not available the program creates a new file english.lang which could be used as basis for new translations.

At the top of the file some general information are collected under the key word [Header]. That is Author, Version, and Date which are shown in the configuration dialog. The identifier of LangID=<value> will be used for the flag on the game server. It follows the ISO 639-1 code. Furthermore you can add more information in the header like licensing or comments.

The section [Translation] lists all items that can be localized. The hard-coded controls have a name and a property which is used for identification. This is mi=Menuitem, cb=Checkbox, gb=Groupbox, lb=Label, for example. The properties Caption and Hint contain the text, caption is the actual label, hint the respective tooltip. Captions may contain of accelerator keys defined by the ampersand which allows the activation by alt+<key> of the respective feature. You can use any letter of the caption, or omit it at all. For example, the ampersand at &Game at the line with tbNewGame.Caption=New &Game makes the G underlined and provides access via alt+G. Alternatively you can use New Ga&me to have alt+M as accelerator key.

Many controls are created after program start and do not follow the default identification. For example, r2dview_caption=2D-view or rmain_infoappstarted=Program started.

[Header]
Author=John Doe
Version=1
Date=2010-01-30
LangID=eo
Licence=Creative Commons
Comment=Just a demo
[Translation]
fmMain.Caption=Scrabble3D
tbExit.Caption=E&xit
tbExit.Hint=Fini programo
rMain_GameEnd=Ludofino

A completely new localization can be created by copying and renaming an existing file or by just creating an empty file. If the empty file has the extension .lang and if it's placed in the configuration directory, you can "load it" after next restart. And loading means that all non-existing entries are replaced by the current setting.

Special formatting are %s (strings) and %d (decimal numbers). The position of these place holders is free but make sure the items contains it. For example, you can replace rmain_gameendwin=Game is won by %s by rmain_gameendwin=%s wins the game.. The statement %s will be replaced dynamically by the name of the player. In case of more than one formatting the sequence matters. In particular you must not interchange %s and %d.

For hints it is possible to define line breaks. To do so, add \\n at the position where you want to break the text. You may add as many line breaks as you need.

In case of multiple plurals you can use the pipe char to separate the forms. The plural forms are fix implemented and defined by language ID at the header. For example Zero items|One item|Many items, in case of French.

GeoLogo.png Language:

DeutschEnglishEspañolFrançaisGaeilgeGàidhligItalianoSvenska