2011-01-16 13:36:47 +00:00
|
|
|
OpenTTD and strgen
|
|
|
|
Last updated: 2009-06-30
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
Table of contents
|
|
|
|
-----------------
|
|
|
|
1.0) strgen usage
|
|
|
|
* 1.1) Examples
|
|
|
|
* 1.2) strgen command switches
|
|
|
|
|
|
|
|
|
|
|
|
1.0) strgen usage
|
|
|
|
---- ------------
|
2006-12-29 00:06:31 +00:00
|
|
|
This guide is only interesting for people who want to alter something
|
2009-06-30 10:26:28 +00:00
|
|
|
themselves without access to translator.openttd.org. Please note that
|
2006-12-29 00:06:31 +00:00
|
|
|
your compiled language file will only be compatible with the OpenTTD version
|
|
|
|
you have downloaded english.txt, the master language file, for. While this is
|
|
|
|
not always true, namely when changes in the code have not touched language
|
|
|
|
files, your safest bet is to assume this 'limitation'.
|
|
|
|
As a first step you need to compile strgen. This is as easy as typing
|
2009-01-05 17:45:40 +00:00
|
|
|
'make strgen'. You can download the precompile strgen from:
|
|
|
|
http://www.openttd.org/download-strgen
|
|
|
|
|
2006-12-29 00:06:31 +00:00
|
|
|
strgen takes as argument a txt file and translates it to a lng file, allowing
|
|
|
|
it to be used inside OpenTTD. strgen needs the master language file
|
|
|
|
english.txt to work. Below are some examples of strgen usage.
|
|
|
|
|
2011-01-16 13:36:47 +00:00
|
|
|
1.1) Examples
|
|
|
|
---- --------
|
2006-12-29 00:06:31 +00:00
|
|
|
Example 1:
|
2019-01-11 12:41:12 +00:00
|
|
|
if you are in the root of your working copy (git repository), you should type
|
2006-12-29 00:06:31 +00:00
|
|
|
strgen/strgen -s lang lang/english.txt
|
|
|
|
to compile englist.txt into english.lng. It will be placed in the lang dir
|
|
|
|
|
|
|
|
Example 2:
|
|
|
|
you only have the strgen executable (no working copy) and you want to compile
|
|
|
|
a txt file in the same directory. You should type
|
|
|
|
./strgen english.txt
|
|
|
|
and you will get and english.lng in the same dir
|
|
|
|
|
|
|
|
Example 3:
|
|
|
|
you have strgen somewhere, english.txt in /usr/openttd/lang and you want the
|
|
|
|
resulting language file to go to /tmp. Use
|
|
|
|
./strgen -s /usr/openttd/lang -d /tmp english.txt
|
|
|
|
|
|
|
|
You can interchange english.txt to whichever language you want to generate a
|
|
|
|
.lng file for.
|
|
|
|
|
2011-01-16 13:36:47 +00:00
|
|
|
1.2) strgen command switches
|
|
|
|
---- -----------------------
|
2006-12-29 00:06:31 +00:00
|
|
|
-v | --version
|
2019-01-11 12:41:12 +00:00
|
|
|
strgen will tell what git revision it was last modified
|
2006-12-29 00:06:31 +00:00
|
|
|
|
|
|
|
-t | --todo
|
|
|
|
strgen will add <TODO> to any untranslated/missing strings and use the english
|
|
|
|
strings while compiling the language file
|
|
|
|
|
|
|
|
-w | --warning
|
|
|
|
strgen will print any missing strings or wrongly translated (bad format)
|
|
|
|
to standard error output(stderr)
|
|
|
|
|
|
|
|
-h | --help | -?
|
|
|
|
Print out a summarized help message explaining these switches
|
|
|
|
|
|
|
|
-s | --source_dir
|
|
|
|
strgen will search for the master file english.txt in the directory specified
|
|
|
|
by this switch instead of the current directory
|
|
|
|
|
|
|
|
-d | --dest_dir
|
|
|
|
strgen will put <language>.lng in the directory specified by this switch; if
|
|
|
|
no dest_dir is given, output is the same as source_dir
|