docs/HOWTO_compile_lang_files.txt
author rubidium
Mon, 03 Nov 2008 23:42:07 +0000
changeset 10318 d436fee569bf
parent 5408 8cbe4c5e4a8b
permissions -rw-r--r--
(svn r14563) -Fix [FS#2395]: in the case that an industry NewGRF, a shared TTDPatch and
OpenTTD feature with it's origin in TTDPatch to replace/add/change vehicles
(including e.g. maximum speed, graphics and introduction year), stations,
bridges, industries, town houses or any other graphics used by either
TTDPatch or OpenTTD, would tell that building an industry is okay, which
is queried using a so-called callback that allows the NewGRF author to
test all kinds of information about the neighbourhood where the industry
might get build, it would corrupt, i.e. overwrite with invalid data, the
structure that is used to build up an error message. This then might result
in trying to resolve an invalid StringID, an internal numeric representation
of all translateable strings, which would in it's turn trigger a safety
check that is added to ensure invalid StringIDs are never resolved.
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     1
STRGEN USAGE
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     2
------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     3
This guide is only interesting for people who want to alter something
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     4
themselves without access to WT2 (translator2.openttd.org). Please note that
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     5
your compiled language file will only be compatible with the OpenTTD version
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     6
you have downloaded english.txt, the master language file, for. While this is
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     7
not always true, namely when changes in the code have not touched language
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     8
files, your safest bet is to assume this 'limitation'.
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
     9
As a first step you need to compile strgen. This is as easy as typing
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    10
'make strgen'. You can also download a precompiled binary from a release,
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    11
nightly, etc.
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    12
strgen takes as argument a txt file and translates it to a lng file, allowing
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    13
it to be used inside OpenTTD. strgen needs the master language file
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    14
english.txt to work. Below are some examples of strgen usage.
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    16
EXAMPLES
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    17
--------
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
Example 1:
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
if you are in the root of your working copy (svn code), you should type
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    20
strgen/strgen -s lang lang/english.txt
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    21
to compile englist.txt into english.lng. It will be placed in the lang dir
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
Example 2:
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    24
you only have the strgen executable (no working copy) and you want to compile
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    25
a txt file in the same directory. You should type
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    26
./strgen english.txt
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    27
and you will get and english.lng in the same dir
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    29
Example 3:
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    30
you have strgen somewhere, english.txt in /usr/openttd/lang and you want the
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    31
resulting language file to go to /tmp. Use
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    32
./strgen -s /usr/openttd/lang -d /tmp english.txt
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    34
You can interchange english.txt to whichever language you want to generate a
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    35
.lng file for.
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    37
STRGEN COMMAND SWITCHES
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    38
-----------------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    39
-v | --version
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    40
strgen will tell what svn revision it was last modified
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    41
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    42
-t | --todo
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    43
strgen will add <TODO> to any untranslated/missing strings and use the english
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    44
strings while compiling the language file
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    45
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    46
-w | --warning
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    47
strgen will print any missing strings or wrongly translated (bad format)
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    48
to standard error output(stderr)
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    49
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    50
-h | --help | -?
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    51
Print out a summarized help message explaining these switches
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    52
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    53
-s | --source_dir
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    54
strgen will search for the master file english.txt in the directory specified
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    55
by this switch instead of the current directory
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    56
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    57
-d | --dest_dir
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    58
strgen will put <language>.lng in the directory specified by this switch; if
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5404
diff changeset
    59
no dest_dir is given, output is the same as source_dir