docs/HOWTO_compile_lang_files.txt
author convert-repo
Mon, 07 Apr 2008 16:21:55 +0000
changeset 10076 dfd70e42c4ae
parent 5659 a2e852691c10
permissions -rw-r--r--
update tags
5659
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     1
STRGEN USAGE
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     2
------------
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     3
This guide is only interesting for people who want to alter something
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     4
themselves without access to WT2 (translator2.openttd.org). Please note that
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     5
your compiled language file will only be compatible with the OpenTTD version
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     6
you have downloaded english.txt, the master language file, for. While this is
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     7
not always true, namely when changes in the code have not touched language
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     8
files, your safest bet is to assume this 'limitation'.
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
     9
As a first step you need to compile strgen. This is as easy as typing
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    10
'make strgen'. You can also download a precompiled binary from a release,
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    11
nightly, etc.
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    12
strgen takes as argument a txt file and translates it to a lng file, allowing
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    13
it to be used inside OpenTTD. strgen needs the master language file
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
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
5659
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    16
EXAMPLES
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
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
5659
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    20
strgen/strgen -s lang lang/english.txt
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
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:
5659
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    24
you only have the strgen executable (no working copy) and you want to compile
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
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
5659
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
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
5659
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    29
Example 3:
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    30
you have strgen somewhere, english.txt in /usr/openttd/lang and you want the
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    31
resulting language file to go to /tmp. Use
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
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
5659
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    34
You can interchange english.txt to whichever language you want to generate a
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    35
.lng file for.
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
5659
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    37
STRGEN COMMAND SWITCHES
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    38
-----------------------
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    39
-v | --version
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    40
strgen will tell what svn revision it was last modified
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    41
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    42
-t | --todo
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    43
strgen will add <TODO> to any untranslated/missing strings and use the english
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    44
strings while compiling the language file
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    45
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    46
-w | --warning
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    47
strgen will print any missing strings or wrongly translated (bad format)
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    48
to standard error output(stderr)
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    49
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    50
-h | --help | -?
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    51
Print out a summarized help message explaining these switches
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    52
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    53
-s | --source_dir
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    54
strgen will search for the master file english.txt in the directory specified
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    55
by this switch instead of the current directory
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    56
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    57
-d | --dest_dir
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    58
strgen will put <language>.lng in the directory specified by this switch; if
a2e852691c10 (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5655
diff changeset
    59
no dest_dir is given, output is the same as source_dir