Strgen: the Very basics

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

User avatar
jfs
Tycoon
Tycoon
Posts: 1757
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Strgen: the Very basics

Post by jfs »

U+0009 is a horizontal tab.

Translations are not allowed to use the {STRING0}, {STRING1}, {STRING2}, etc. codes for placeholders, only the non-translated english.txt is allowed to use those. Translations must use {STRING} without any number on it instead.

If you want to make a "translation" that only changes a few strings, I would recommend starting off the english_us.txt file, but delete all the translated lines, then add only the lines you are interested in changing. You should also have an unmodified english.txt file that you can compile into english.lng (and make sure it's identical to the english.lng that ships with the game version you are working for. Strgen has some special logic regarding english.txt and english.lng and those files should be present when you run it for any other language.
Quarter Mile
Engineer
Engineer
Posts: 17
Joined: 03 Aug 2019 14:33

Re: Strgen: the Very basics

Post by Quarter Mile »

Ok, done that, Strgen isn't happy with it,

I've checked the .txt file, those lines are there at the top, and I've got the unedited English.txt in the same folder (for 1.11.0). The ##name and ##ownname wouldn't work with either English_US or English (Original Vehicle names)

I've attached the edited text file as well, as always, thanks for the help.
Attachments
1.png
1.png (4.17 KiB) Viewed 3287 times
Original.txt
(20.23 KiB) Downloaded 103 times
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Strgen: the Very basics

Post by Eddi »

check that your .txt file has the correct encoding, line endings, etc.
Quarter Mile
Engineer
Engineer
Posts: 17
Joined: 03 Aug 2019 14:33

Re: Strgen: the Very basics

Post by Quarter Mile »

SUCCESS!!! (Of sorts)

Following jfs' advice, I repaced the vehicle names in the english_US file with the actual manufacturer names, (but left the rest of the file intact) and it works! :)

So big thanks to jfs, Eddi, and Truebrain for their patience and advice, and again to Truebrain for posting the strgen binary. You all rock :D :D :D

Time to get gaming :mrgreen:
Quarter Mile
Engineer
Engineer
Posts: 17
Joined: 03 Aug 2019 14:33

Re: Strgen: the Very basics

Post by Quarter Mile »

Great. Here we go again for v12....

I'm at my wits end, and posting here was my last resort.

Using the strgen.exe that Trubrain provided earlier is no longer working (keeps saying that it can't open english.txt even though the .txt is right there in the folder) (see screenshot 1). The english_on.txt (on = origional names) is the file I am trying to compile. I assume the strgen I am trying to use is not compatible with v12's english.txt.

To make make matters worse, the English_US I compiled last time will no longer work with V12 or the Versions of V11 I got from Uptodown.com

So, went to github to try d/l the latest strgen, and in the strgen folder is:

CMakeLists.txt
strgen.cpp
strgen.h
strgen_base.cpp

with their latest changelog comments. I tried to save the RAW data for strgen.cpp and compile it using "make strgen" but just get the 'make is not recognized....' message.

So, do I need one of those files? All of them?

Again, apologies, and thanks for your patience.
Attachments
1.png
1.png (16.11 KiB) Viewed 2894 times
Quarter Mile
Engineer
Engineer
Posts: 17
Joined: 03 Aug 2019 14:33

Re: Strgen: the Very basics

Post by Quarter Mile »

Ok, could someone PLEASE just tell me how step by step how to get strgen of Github (I don't use github for anything, and have no coding knowledge) or go back to having the.exe downloadable,

All I am getting is this, and nothing useful seems to be coming of it.
Attachments
1.png
(38.64 KiB) Not downloaded yet
User avatar
jfs
Tycoon
Tycoon
Posts: 1757
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Strgen: the Very basics

Post by jfs »

1. Install a supported C++ compiler suite
2. Get the OpenTTD source code, either via a git clone or as a source tarball
3. Build OpenTTD to verify it works
4. Add your new language file to the source tree and include it for the build
Quarter Mile
Engineer
Engineer
Posts: 17
Joined: 03 Aug 2019 14:33

Re: Strgen: the Very basics

Post by Quarter Mile »

Thanks. STILL no luck :(

Could someone please compile strgen and link it here or show me where to get a compiled version?

Sorry, but for some reason this is just kicking my behind.

Thanks
Vicente_Estate
Engineer
Engineer
Posts: 2
Joined: 21 Feb 2023 22:13

Re: Strgen: the Very basics

Post by Vicente_Estate »

Hice una guía sobre como compilar strgen, espero que pueda ayudar (I made a guide about how to compile strgen, i hope that can help)
Forma 1 (Form 1)
  1. Descargar Visual Studio de https://visualstudio.microsoft.com y C-Make de https://cmake.org/download (Download Visual Studio and C-Make)
  2. Descargar la carga de trabajo "Desarrollo para el escritorio en C++" (Download the "Desktop development in C++" workload)
  3. Abrir C-Make y seleccionar la carpeta del código fuente en "Dónde está el código fuente" y la carpeta de compilación en "Dónde construir los binarios". Apretar "Configurar"
    (Open C-Make and select the source code folder in "Where is the source code" and the compilation folder in "Where to build the binaries". Push "Configure")
  4. Seleccionar Visual Studio como compilador, y luego darle a "Finalizar" (Select Visual Studio as compilator and then hit to "Finish")
  5. Aparecerán las opciones en rojo. Marcar la casilla "OPCIÓN_SOLO_HERRAMIENTAS" y volver a apretar "Configurar" (The options will be in red. Tick the "OPTION_TOOLS_ONLY" box and push "Configure" again)
  6. Ahora las opciones estarán en blanco. Apretar "Generar" (para hacer los archivos de compilación), luego cerrar C-Make y abrir "strgen.sln" con Visual Studio
    (Now the options will be in white. Push "Generate" (to make the compilation files), then close C-Make and open "strgen.sln" with Visual Studio)
  7. En Visual Studio apretar "Compilar solución" y esperar a que compile (Press "Compile solution" and wait the compilation)
  8. El strgen.exe estará en <carpeta de la solución>/Debug (The strgen.exe will be on <solution folder>/Debug)
Forma 2 (Form 2)
  1. Descargar Visual Studio de https://visualstudio.microsoft.com (Download Visual Studio)
  2. Descargar la carga de trabajo "Desarrollo para el escritorio en C++" (Download the "Desktop development in C++" workload)
  3. Abrir Visual Studio, presionar "Abrir una carpeta local", y seleccionar la carpeta del código fuente (Open Visual Studio, push "Open a local folder", and select the source code folder)
  4. Visual Studio configura C-Make automáticamente, pero se puede configurar manualmente presionando "Configurar caché" en la barra de herramientas
    (Visual Studio configure C-Make automatically, but is possible configure manually pressing "Configure cache" in the toolbar)
  5. Seleccionar "Compilar todo", esperar varios minutos a que se compile. (Select "Compile all", wait several minutes to compiling)
  6. El strgen.exe estará en <carpeta del código fuente>/out/build/x64-Debug/src/strgen (The strgen.exe will be in <source code folder>/out/build/x64-Debug/src/strgen)
Para usar el strgen lo mejor es arrastar el archivo .txt directamente de la carpeta lang (o de una copia) hacia el strgen.exe
(To use the strgen the best is drag the .txt archive directly from the lang folder (or from a copy) to the strgen.exe)
Jugador de OpenTTD desde hace mucho tiempo
OpenTTD player long time ago
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 18 guests