Strgen: the Very basics
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Strgen: the Very basics
Hi Everyone
Last year in August, I posted a thread about editing language packs, and was informed that strgen was the way to go. Problem is, even with the word wrap on I battled to read the How to file.
I searched for strgen here in the forums and saw a link to translation guidelines that was hosted on the old openttd.com, but hasn't been moved to the .org domain (I'm getting a 404 error)
Does anyone know where these guidelines are?
Thanks for the help..... Again....
EDIT: Also from what I read, the general suggestion was to use a file called english.txt from somewhere in the OPENTTD installation, but a search brings up nothing (and that was written some time ago) Is this file embedded within OPENTTD itself?
Last year in August, I posted a thread about editing language packs, and was informed that strgen was the way to go. Problem is, even with the word wrap on I battled to read the How to file.
I searched for strgen here in the forums and saw a link to translation guidelines that was hosted on the old openttd.com, but hasn't been moved to the .org domain (I'm getting a 404 error)
Does anyone know where these guidelines are?
Thanks for the help..... Again....
EDIT: Also from what I read, the general suggestion was to use a file called english.txt from somewhere in the OPENTTD installation, but a search brings up nothing (and that was written some time ago) Is this file embedded within OPENTTD itself?
Re: Strgen: the Very basics
The source language files for the game itself are in the git repository: https://github.com/OpenTTD/OpenTTD/tree/master/src/lang
(You can use the Branch button in the upper left corner to switch to a branch or tag for a specific release version of OTTD.)
(You can use the Branch button in the upper left corner to switch to a branch or tag for a specific release version of OTTD.)
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
Thanks JFS
Ok, I have seperated the text in the how to file, And I just want to see if I have this right:
To compile a .txt into a .lng, the command line is: strgen/strgen -s lang lang/english.txt
And to get a .txt file, you use: strgen -s /usr/openttd/lang -d /tmp english.txt
Is this correct?
Ok, I have seperated the text in the how to file, And I just want to see if I have this right:
To compile a .txt into a .lng, the command line is: strgen/strgen -s lang lang/english.txt
And to get a .txt file, you use: strgen -s /usr/openttd/lang -d /tmp english.txt
Is this correct?
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
Ok, after a hiatus, I am taking a second swing at this, problem is, I lost everything to a virus, and can't find strgen.exe, all I'm finding are references, and the one that points to strgen (http://openttd.org/download-strgen) just goes to the homepage with no mention of strgen, and Google is only sending me in circles, whereabouts is it?
Re: Strgen: the Very basics
strgen is no longer offered as a separate binary download. you can only obtain it by downloading the source code (preferably from github) and compiling yourself
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
Thanks Eddi,
But this is driving me mad, all I want to do is make a language, is there no simple way of doing it (I have ZERO coding experience, and everything seems to center around that).
Alternatively, can I attach the .txt file here and someone convert it for me?
But this is driving me mad, all I want to do is make a language, is there no simple way of doing it (I have ZERO coding experience, and everything seems to center around that).
Alternatively, can I attach the .txt file here and someone convert it for me?
Re: Strgen: the Very basics
you don't need to do any coding. all you need to do is follow the compiling instructions.
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
Hey Eddi, thanks for your patience and helpfulness,
I have been to Github, and downloaded FOUR different strgens, (Clojure, Python, PHP and Javascript) none of which came with any clear compiling instructions.
So I tried, "Make strgen.exe" in the Clojure verison, and keep getting an error, something about an environment named sphinx. Now my question is, do ALL the strgen files have to be in the same folder (rightnow the files are in the main folder and 4 subfolders)?
I have been to Github, and downloaded FOUR different strgens, (Clojure, Python, PHP and Javascript) none of which came with any clear compiling instructions.
So I tried, "Make strgen.exe" in the Clojure verison, and keep getting an error, something about an environment named sphinx. Now my question is, do ALL the strgen files have to be in the same folder (rightnow the files are in the main folder and 4 subfolders)?
Re: Strgen: the Very basics
I think you've found a completely different thing also called "strgen". It's not interchangeable, you need specifically the strgen from OpenTTD. It's part of the OpenTTD project itself, and is written in C++.
https://github.com/OpenTTD/OpenTTD/
https://github.com/OpenTTD/OpenTTD/
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
This is driving me insane. Is there any way I can get strgen.exe without downloading a whole bunch of programs and environments etc. All I'm after is one file.
OR if I can email the language.txt to someone and get it compiled? Or if someone can email me the strgen.exe file?
BTW, I'm running Windows 7 (Yes, OpenTTD works on it)
OR if I can email the language.txt to someone and get it compiled? Or if someone can email me the strgen.exe file?
BTW, I'm running Windows 7 (Yes, OpenTTD works on it)
Re: Strgen: the Very basics
By the way, there is an intuitive site that offers automatic compilations ?
You can send the code with one click of the locker lock,
And after pressing the button processes
- Displays a message for the wrong file to change.
If finish, it sends ready after an indication on the joystick
You can send the code with one click of the locker lock,
And after pressing the button processes
- Displays a message for the wrong file to change.
If finish, it sends ready after an indication on the joystick
Re: Strgen: the Very basics
Can I ask what you are trying to do? Well, getting strgen working, I get that, but what do you want to do with your own language pack? Strgen is a bit of an unusual request to us, and I don't see anyone else asking what your goal is
Mainly the reason I ask, is because creating your own "lng" file is complicated; but also more often than not, not even needed.
For OpenTTD, we have our own translation tool (https://translator.openttd.org), that helps people translate the game. There they do not have to worry how it will look ingame, as that is our job, to make sure everything render fine for every language. This removes a lot of hurdles for the many translators we have. In fact, we no longer accept translations in any other form, as history has shown other methods are just a bad idea
If you really do want to create your own "lng" files, there are a few things you have to take care of yourself. To generate any successful "lng" file, you need the following:
- Know the exact OpenTTD version you want to create the "lng" file for. It is not possible to use it on any other version. So 1.10.3 files will not work on 1.11.0, etc.
- Get a strgen.exe that is compatible with that version. Give we haven't changed it in years, this isn't that difficult; I will wrap back to this in a bit.
- Get the exact "english.txt" file used for the OpenTTD version you are creating the "lng" file for. This can be found on our GitHub; it is not distributed with the binary. So if you want a "lng" for 1.10.3, you need that exact english.txt as it was used to build 1.10.3. In this example, https://github.com/OpenTTD/OpenTTD/blob ... nglish.txt
If you have all these 3 pieces together, you can create your own "lng" file. Did I mention already it is complicated? This is why we automated the process for all our languages and created the translator tool.
So how to get a strgen.exe? Well, easiest is to build this yourself; but I can understand that is not for everyone. We can supply one, and I can help you with that, if after all this you are still like: yeah, I have a good use-case to do it this way. It is all the same to me, but it takes me a bit of time to create it, so I rather not if it is not needed
We stopped distributing strgen as a binary a few years ago, as the complicated flow to do this yourself is often overwhelming (resulting in a lot of questions), and also often unneeded (as mentioned earlier). So after someone battles strgen to build a working "lng" file, they found out that is not the way to translate, and all the effort was in vein
So possibly this is still not helping you, and I do apologize if that is the case; but if you can enlighten me a bit on what you are up to, I am sure I can help you out getting it done!
Mainly the reason I ask, is because creating your own "lng" file is complicated; but also more often than not, not even needed.
For OpenTTD, we have our own translation tool (https://translator.openttd.org), that helps people translate the game. There they do not have to worry how it will look ingame, as that is our job, to make sure everything render fine for every language. This removes a lot of hurdles for the many translators we have. In fact, we no longer accept translations in any other form, as history has shown other methods are just a bad idea
If you really do want to create your own "lng" files, there are a few things you have to take care of yourself. To generate any successful "lng" file, you need the following:
- Know the exact OpenTTD version you want to create the "lng" file for. It is not possible to use it on any other version. So 1.10.3 files will not work on 1.11.0, etc.
- Get a strgen.exe that is compatible with that version. Give we haven't changed it in years, this isn't that difficult; I will wrap back to this in a bit.
- Get the exact "english.txt" file used for the OpenTTD version you are creating the "lng" file for. This can be found on our GitHub; it is not distributed with the binary. So if you want a "lng" for 1.10.3, you need that exact english.txt as it was used to build 1.10.3. In this example, https://github.com/OpenTTD/OpenTTD/blob ... nglish.txt
If you have all these 3 pieces together, you can create your own "lng" file. Did I mention already it is complicated? This is why we automated the process for all our languages and created the translator tool.
So how to get a strgen.exe? Well, easiest is to build this yourself; but I can understand that is not for everyone. We can supply one, and I can help you with that, if after all this you are still like: yeah, I have a good use-case to do it this way. It is all the same to me, but it takes me a bit of time to create it, so I rather not if it is not needed
We stopped distributing strgen as a binary a few years ago, as the complicated flow to do this yourself is often overwhelming (resulting in a lot of questions), and also often unneeded (as mentioned earlier). So after someone battles strgen to build a working "lng" file, they found out that is not the way to translate, and all the effort was in vein
So possibly this is still not helping you, and I do apologize if that is the case; but if you can enlighten me a bit on what you are up to, I am sure I can help you out getting it done!
The only thing necessary for the triumph of evil is for good men to do nothing.
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
Hi TrueBrain, and thank you for your reply.
Basically what I'm after is creating an English language file using real/actual vehicle names, I've tried the GRF, but found
A) I still wanted the futuristic RVs to use names of companies that exist, and
B) If I used the planeset GRF, the planes were all duplicated.
My first idea was to hex edit the English.lng, but that didn't work, so (after chatting with a few folks here) learned that I have to create a fresh .lng from a .txt file. I HAD strgen, but lost it due to a virus, then found out I could no longer d/l it. I will set up an account at the Web Translator and see how that works.
EDIT: Ok, got the English.txt off that GitHub link, now just a matter of getting it into an .lng file
Again, thank you, appreciated.
Basically what I'm after is creating an English language file using real/actual vehicle names, I've tried the GRF, but found
A) I still wanted the futuristic RVs to use names of companies that exist, and
B) If I used the planeset GRF, the planes were all duplicated.
My first idea was to hex edit the English.lng, but that didn't work, so (after chatting with a few folks here) learned that I have to create a fresh .lng from a .txt file. I HAD strgen, but lost it due to a virus, then found out I could no longer d/l it. I will set up an account at the Web Translator and see how that works.
EDIT: Ok, got the English.txt off that GitHub link, now just a matter of getting it into an .lng file
Again, thank you, appreciated.
Re: Strgen: the Very basics
Thank you for explaining your use-case. It is one hell of a niche problem to solve, but who are we to stop you
Attached a strgen.exe which should be compatible with 1.11. Most likely also with 1.10, but you will find that out sooner or later
And just to put the steps down again:
- Download strgen.exe
- Download the english.txt that belongs the the openttd.exe version you have
- Run strgen as explained earlier
Enjoy
Attached a strgen.exe which should be compatible with 1.11. Most likely also with 1.10, but you will find that out sooner or later
And just to put the steps down again:
- Download strgen.exe
- Download the english.txt that belongs the the openttd.exe version you have
- Run strgen as explained earlier
Enjoy
- Attachments
-
- strgen.zip
- (113.06 KiB) Downloaded 139 times
The only thing necessary for the triumph of evil is for good men to do nothing.
Re: Strgen: the Very basics
Check out the "original vehicle names" and "better vehicle names" NewGRF.Quarter Mile wrote: ↑23 Mar 2021 19:29 Basically what I'm after is creating an English language file using real/actual vehicle names, I've tried the GRF, but found
A) I still wanted the futuristic RVs to use names of companies that exist, and
B) If I used the planeset GRF, the planes were all duplicated.
They are intended to loaded as "static NewGRF". That means:
* They will rename the original vehicles.
* They will not affect NewGRF defined vehicles.
* They will not duplicate/readd the original vehicles.
To add a NewGRF as "static NewGRF" you have to edit openttd.cfg. There is no GUI method for it.
See also:
* https://github.com/frosch123/quaking/bl ... rigveh.nfo
* viewtopic.php?t=43178
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
Hi TrueBrain, thanks for linking the strgen file, (I've made sure to back it up in numerous locations now!)
Trying to extract english.txt from engligh.lng to make sure I have the proper .txt for my version, but keep getting this
From what I can see, the folders are all correct, have I missed something else?
Trying to extract english.txt from engligh.lng to make sure I have the proper .txt for my version, but keep getting this
From what I can see, the folders are all correct, have I missed something else?
- Attachments
-
- 1.png (6.21 KiB) Viewed 6438 times
Re: Strgen: the Very basics
Hahaha. THIS is the best april fools joke i've read today
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
I wish it was...
I don't know, I've done modding/editing to a fair few games, but for some reason this endeavour is kicking me at every step
I don't know, I've done modding/editing to a fair few games, but for some reason this endeavour is kicking me at every step
Re: Strgen: the Very basics
You need to download the original english.txt from GitHub for the version you have. Don't try to "decompile" it, it won't work properly.
(And as explained, this is one of the reasons why strgen isn't offered as a regular download any longer. It's a very technical tool and requires a lot of prerequisite knowledge to use properly.)
(And as explained, this is one of the reasons why strgen isn't offered as a regular download any longer. It's a very technical tool and requires a lot of prerequisite knowledge to use properly.)
-
- Engineer
- Posts: 17
- Joined: 03 Aug 2019 14:33
Re: Strgen: the Very basics
Ok, got the English.txt off github, edited it, called the edited file Origional.txt
Tried compiling it using the command "strgen Origional.txt"
Getting this:
Param idx #0 'STRING' doesn't match with template command 'STRING1' (warning)
The error for strings not matching appears for each line, even ones I did not edit, I ASSUME that it's not a problem as it did not stop the .lng compile.
However, the Unwanted UTF-8 character U +0009 is causing it stop, the character +0009 (9) doesn't even appear in the string.
What is going wrong now?
Tried compiling it using the command "strgen Origional.txt"
Getting this:
Param idx #0 'STRING' doesn't match with template command 'STRING1' (warning)
The error for strings not matching appears for each line, even ones I did not edit, I ASSUME that it's not a problem as it did not stop the .lng compile.
However, the Unwanted UTF-8 character U +0009 is causing it stop, the character +0009 (9) doesn't even appear in the string.
What is going wrong now?
- Attachments
-
- 1.png (6.46 KiB) Viewed 3734 times
Who is online
Users browsing this forum: No registered users and 36 guests