Difference between revisions of "NML:Language files"
Planetmaker (talk | contribs) (string tags partially explained) |
Planetmaker (talk | contribs) (→String codes: some more examples) |
||
Line 39: | Line 39: | ||
|NBSP || non-breaking space |
|NBSP || non-breaking space |
||
|- |
|- |
||
− | |COPYRIGHT || |
+ | |COPYRIGHT || copyright symbol |
|- |
|- |
||
|TINYFONT || switch to small font |
|TINYFONT || switch to small font |
||
Line 55: | Line 55: | ||
|WORD_U || display variable (2 bytes): unsigned word |
|WORD_U || display variable (2 bytes): unsigned word |
||
|- |
|- |
||
− | |CURRENCY || display variable (2 bytes): money in proper currency units |
+ | |CURRENCY || display variable (2 bytes): money in proper currency units|| 24,492 € |
|- |
|- |
||
|STRING || include other string |
|STRING || include other string |
||
|- |
|- |
||
− | |DATE1920_LONG || display variable (2 bytes): days since 1920 as long date || |
+ | |DATE1920_LONG || display variable (2 bytes): days since 1920 as long date || 12 August 1935 |
|- |
|- |
||
− | |DATE1920_SHORT|| display variable (2 bytes): days since 1920 as short date || |
+ | |DATE1920_SHORT|| display variable (2 bytes): days since 1920 as short date || 12 Aug 1935 |
|- |
|- |
||
|VELOCITY || display variable (2 bytes): velocity in proper units || 35 km/h |
|VELOCITY || display variable (2 bytes): velocity in proper units || 35 km/h |
||
Line 69: | Line 69: | ||
|ROTATE || |
|ROTATE || |
||
|- |
|- |
||
− | |VOLUME || display variable (2 bytes): volume in proper units || 29 |
+ | |VOLUME || display variable (2 bytes): volume in proper units || 29,000 l |
|- |
|- |
||
− | |CURRENCY_QWORD|| display variable (8 bytes): money in proper currency units |
+ | |CURRENCY_QWORD|| display variable (8 bytes): money in proper currency units|| 4,402,204,201€ |
|- |
|- |
||
|PUSH_WORD || |
|PUSH_WORD || |
||
Line 77: | Line 77: | ||
|UNPRINT || |
|UNPRINT || |
||
|- |
|- |
||
− | |BYTE_HEX || display variable (1 byte): hexadecimal presentation |
+ | |BYTE_HEX || display variable (1 byte): hexadecimal presentation || F0 |
|- |
|- |
||
− | |WORD_HEX || display variable (2 bytes): hexadecimal presentation |
+ | |WORD_HEX || display variable (2 bytes): hexadecimal presentation || F0 3D |
|- |
|- |
||
− | |DWORD_HEX || display variable (4 bytes): hexadecimal presentation |
+ | |DWORD_HEX || display variable (4 bytes): hexadecimal presentation || F0 3D D4 33 |
|- |
|- |
||
− | |QWORD_HEX || display variable (8 bytes): hexadecimal presentation |
+ | |QWORD_HEX || display variable (8 bytes): hexadecimal presentation || 4F 4D 4D 33 49 32 FF A3 |
|- |
|- |
||
|WORD_S_TONNES || display variable (2 bytes): weight in tons || 42t |
|WORD_S_TONNES || display variable (2 bytes): weight in tons || 42t |
||
|- |
|- |
||
− | |DATE_LONG || display variable (2 bytes): days since 0 as long date || |
+ | |DATE_LONG || display variable (2 bytes): days since 0 as long date || 12 August 1610 |
|- |
|- |
||
− | |DATE_SHORT || display variable (2 bytes): days since 0 as short date || |
+ | |DATE_SHORT || display variable (2 bytes): days since 0 as short date || 12 Aug 3049 |
|- |
|- |
||
− | |POWER || display variable (2 bytes): power in proper units |
+ | |POWER || display variable (2 bytes): power in proper units || 2,030 kW |
|- |
|- |
||
|BLUE || switch to blue text |
|BLUE || switch to blue text |
||
Line 127: | Line 127: | ||
|BLACK || switch to black text |
|BLACK || switch to black text |
||
|- |
|- |
||
− | |TRAIN || |
+ | |TRAIN || display train symbol |
|- |
|- |
||
− | |LORRY || |
+ | |LORRY || display lorry symbol |
|- |
|- |
||
− | |BUS || |
+ | |BUS || display bus symbol |
|- |
|- |
||
− | |PLANE || |
+ | |PLANE || display plane symbol |
|- |
|- |
||
− | |SHIP || |
+ | |SHIP || display ship symbol |
|} |
|} |
||
Revision as of 21:30, 29 August 2011
Vehicles, Stations, Canals, Bridges, Towns, Houses, Industries (Tiles), Cargos, Airports+Tiles, Objects, Railtypes, Roadtypes, Tramtypes, Terrain
No subpages in this chapter.
Introduction
Language files are usually found in the lang
sub-folder of the project, but the place NML looks for the language files can be changed via command line parameter to any directory desired:
nmlc -l path/to/lang-dir path/to/nml-source-file.nml nmlc --lang-dir=path/to/lang-dir path/to/nml-source-file.nml
Language files MUST have the extension .lng
The language files themselves follow a certain structure:
##grflangid <number> <string-name> :<text> <string-name> :<text> ...
where the first line must give the language code for the language this file describes (see below). The following lines each describe a string. The translated string follows immediately the colon. An NML project has exactly one fallback language, by default this is english.lng. You can change this with the command line parameter --default-lang. Example for a valid language file:
##grflangid 0x01 STR_GRF_NAME :{TITLE} 0.1.0 - {VERSION} STR_GRF_DESCRIPTION :{TITLE} contains pimped ground tiles. STR_NAME_MYVEHICLE :General Robotics Anti-Grav UFO Mark X
String codes
Strings may contain a number of special string codes which control how the string is being printed or which values to insert into the string. Custom replacements can be stored in the plain text file custom_tags.txt
(for example a newgrf version which is written by your build script). In the case above the custom_tags.txt
could, for example read
VERSION :alpha-r88 TITLE :Example NewGRF
Additionally to custom-defined tags, NML comes with a number of default tags:
Tag | Meaning | Example |
---|---|---|
NBSP | non-breaking space | |
COPYRIGHT | copyright symbol | |
TINYFONT | switch to small font | |
BIGFONT | switch to big font | |
DWORD_S | display variable (4 bytes): signed double word | |
PARAM | display parameter (4 bytes): unsigned double word | |
WORD_S | display variable (2 bytes): signed word | |
BYTE_S | display variable (1 byte): signed byte | |
WORD_U | display variable (2 bytes): unsigned word | |
CURRENCY | display variable (2 bytes): money in proper currency units | 24,492 € |
STRING | include other string | |
DATE1920_LONG | display variable (2 bytes): days since 1920 as long date | 12 August 1935 |
DATE1920_SHORT | display variable (2 bytes): days since 1920 as short date | 12 Aug 1935 |
VELOCITY | display variable (2 bytes): velocity in proper units | 35 km/h |
POP_WORD | ||
ROTATE | ||
VOLUME | display variable (2 bytes): volume in proper units | 29,000 l |
CURRENCY_QWORD | display variable (8 bytes): money in proper currency units | 4,402,204,201€ |
PUSH_WORD | ||
UNPRINT | ||
BYTE_HEX | display variable (1 byte): hexadecimal presentation | F0 |
WORD_HEX | display variable (2 bytes): hexadecimal presentation | F0 3D |
DWORD_HEX | display variable (4 bytes): hexadecimal presentation | F0 3D D4 33 |
QWORD_HEX | display variable (8 bytes): hexadecimal presentation | 4F 4D 4D 33 49 32 FF A3 |
WORD_S_TONNES | display variable (2 bytes): weight in tons | 42t |
DATE_LONG | display variable (2 bytes): days since 0 as long date | 12 August 1610 |
DATE_SHORT | display variable (2 bytes): days since 0 as short date | 12 Aug 3049 |
POWER | display variable (2 bytes): power in proper units | 2,030 kW |
BLUE | switch to blue text | |
SILVER | switch to silver text | |
GOLD | switch to golden text | |
RED | switch to red text | |
PURPLE | switch to purple text | |
LTBROWN | switch to light brown text | |
ORANGE | switch to orange text | |
GREEN | switch to green text | |
YELLOW | switch to yellow text | |
DKGREEN | switch to dark green text | |
CREAM | switch to cream-coloured text | |
BROWN | switch to brown text | |
WHITE | switch to white text | |
LTBLUE | switch to light blue text | |
GRAY | switch to gray text | |
DKBLUE | switch to dark blue text | |
BLACK | switch to black text | |
TRAIN | display train symbol | |
LORRY | display lorry symbol | |
BUS | display bus symbol | |
PLANE | display plane symbol | |
SHIP | display ship symbol |
LanguageIDs
Valid language IDs are listed in the table below.
ID | language |
---|---|
00 | American |
01 | English |
02 | German |
03 | French |
04 | Spanish |
05 | Esperanto |
06 | Ido |
07 | Russian |
08 | Irish |
09 | Maltese |
0A | Tamil |
0B | Chuvash |
0C | Chinese (Traditional) |
0D | Serbian |
0E | Norwegian (Nynorsk) |
0F | Welsh |
10 | Belarusian |
11 | Marathi |
12 | Faroese |
14 | Arabic (Egypt) |
15 | Czech |
16 | Slovak |
18 | Bulgarian |
1B | Afrikaans |
1E | Greek |
1F | Dutch |
21 | Basque |
22 | Catalan |
23 | Luxembourgish |
24 | Hungarian |
26 | Macedonian |
27 | Italian |
28 | Romanian |
29 | Icelandic |
2A | Latvian |
2B | Lithuanian |
2C | Slovenian |
2D | Danish |
2E | Swedish |
2F | Norwegian (Bokmal) |
30 | Polish |
31 | Galician |
32 | Frisian |
33 | Ukrainian |
34 | Estonian |
35 | Finnish |
36 | Portuguese |
37 | Brazilian Portuguese |
38 | Croatian |
39 | Japanese |
3A | Korean |
3C | Malay |
3E | Turkish |
42 | Thai |
54 | Vietnamese |
56 | Chinese (Simplified) |
5A | Indonesian |
5C | Urdu |
61 | Hebrew |
62 | Persian |
In case a language is not in this list, check the master language list (for GRFv7) in the NewGRF Specs. This master list is always leading. NFO language ID 7F has no meaning in NML (set --default-lang instead) and setting bit 16 will break your language file.