Page 1 of 1

How to translate NewGRF files?

Posted: 20 Oct 2010 23:37
by raymanlololo
Hi,

I'm interested to translating a NewGRF file that I've download through the game. Concretly this: "Better Vehicle names". It's all in english and I think that would better to me if it was in my language (spanish).

Also I would like to make a "city name generator" that includes spaniards cities, or modify someone else of any other country.

I have to say, that I have no idea about progamming, and I don't know if this project could be too ambicious to me, but I think that if it's just open the file with some program and edit some values, I'll be capable.


Obviosuly, if I have succes in my try, I'll share it with all TTD players. ;) ;)


Thanks a lot!!!


PD: Hope not to be wrong to write this post here...

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 00:41
by Eddi
there's a separate graphics forum, may have better luck there.

but the general approach would be: decode the grf using grfcodec, and then add your language using Action 4

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 06:29
by Terkhen
Welcome to the forums!

There is already a spanish town names GRF, which you can find here. Since important spanish cities seem to be missing from it, personally I would welcome a new spanish town names GRF that uses these names too. There is already many town names NewGRFs written in NML, which make them easier to code. I'm also attaching a xls file that should help you with this project.

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 07:39
by michael blunck
raymanlololo wrote: I'm interested to translating a NewGRF file [...]
Try GRFtrans.

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 07:57
by planetmaker
michael blunck wrote:
raymanlololo wrote: I'm interested to translating a NewGRF file [...]
Try GRFtrans.
Assuming that it is writing Action13: Those grfs have one big backdraw: They translate unconditionally and thus are totally unsuitable for multiplayer environment as it does not respect the language settings of the players.

While that method works locally it's not a method which can be recommended for sharing translations due to the design flaw of the action13 involved: not respecting client settings as action4 does.

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 08:20
by michael blunck
planetmaker wrote:
mb wrote:
raymanlololo wrote: I'm interested to translating a NewGRF file that I've download through the game. Concretly this: "Better Vehicle names". It's all in english and I think that would better to me if it was in my language (spanish).
Try GRFtrans.
Assuming that it is writing Action13 [...]
I don´t assume "better vehicle names" "writing Action13".

regards
Michael

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 08:29
by planetmaker
michael blunck wrote: I don´t assume "better vehicle names" "writing Action13".
You probably "know".

But as running GrfTrans on a couple of NewGRF prior to posting didn't yield any results which could be interpreted as usuable (namely display me with a list of strings which I expected, nor produce a grf for me when running on the text file), I can only assume. But due to the assumptions I have to make above, I can't be bothered to investigate it further.

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 08:40
by michael blunck
http://www.ttdpatch.net/tools.html#grftrans wrote: GRFTrans

Similar to mkpttxt above, this program allows you to translate all names in a new graphics set to your language.

Download it: grftrans.zip (6 KB).

How to use it:
Download and unzip it into your newgrf folder
Drag and drop a .grf file onto grftrans.exe, for example dbsetw.grf
This will create dbsetw.txt, a text file with the names
Simply translate the lines in dbsetw.txt that don't start with "//" or "*"
Drag and drop the text file onto grftrans.exe
This will create dbsetw_trans.grf, a new .grf file containing the translated names
Put dbsetw_trans.grf in your newgrf(w).cfg file, after the file it translates, e.g.
...
newgrf/dbsetw.grf
newgrf/dbsetw_trans.grf
...
That's it!
HTH
regards
Michael

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 08:41
by planetmaker
You may have a gues which instructions I followed to the point... It maybe works for some newgrf or some people or setups, but I sure won't try every single one. It also fails for the ECSBasicw.grf.

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 08:45
by michael blunck

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 09:42
by Yexo
So the resulting _trans.grf will only work in OpenTTD if you turn "Enable multiple NewGRF engine sets" off. IMO a better solution is (like Eddi suggested) to decode the original grf, add the translation and encode the result. It'd be even easier if you could find the source for the original somewhere.

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 10:01
by Rubidium
Wouldn't an action0 feature 8 (general variables) property 11 (GRF ID overrides for engines) help?

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 10:36
by Yexo
Yes, but since GRFTrans is from 2003 it doesn't know about that. That means you either need to update GRFTrans or decode/encode the _trains.grf file to add action0 feature8 prop 11, which means you might as well decode/encode the original grf to add the translations.

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 10:38
by planetmaker
Yexo wrote:Yes, but since GRFTrans is from 2003 it doesn't know about that. That means you either need to update GRFTrans or decode/encode the _trains.grf file to add action0 feature8 prop 11, which means you might as well decode/encode the original grf to add the translations.
Except when you want to provide translations for a newgrf where you have no right to modify or re-distribute it as often with old newgrfs ;-)

Re: How to translate NewGRF files?

Posted: 21 Oct 2010 21:42
by raymanlololo
Terkhen wrote:Welcome to the forums!

There is already a spanish town names GRF, which you can find here. Since important spanish cities seem to be missing from it, personally I would welcome a new spanish town names GRF that uses these names too. There is already many town names NewGRFs written in NML, which make them easier to code. I'm also attaching a xls file that should help you with this project.
Thanks for the link, I'll investigate that way.

michael blunck wrote:
raymanlololo wrote: I'm interested to translating a NewGRF file [...]
Try GRFtrans.
I tried to do that, but the gfr file that gfrtrans.exe gives me from the txt it's blank

Re: How to translate NewGRF files?

Posted: 22 Oct 2010 07:37
by michael blunck
raymanlololo wrote: I tried to do that, but the gfr file that gfrtrans.exe gives me from the txt it's blank
Yes. As already mentioned, GRFtrans is from 2003, but the "better vehicle names" grf is much younger, and it contains a couple of specific nfo items, e.g. "GRF ID overrides for engines" (action0/general variables prop11, OpenTTD only) which GRFtrans cannot handle.

regards
Michael

Re: How to translate NewGRF files?

Posted: 22 Oct 2010 11:24
by raymanlololo
Oh, excuse me then. :oops: :oops: I'd read it, but I didn't understand what you was talking about.

So, there's a solution?

Re: How to translate NewGRF files?

Posted: 22 Oct 2010 11:32
by planetmaker
raymanlololo wrote:So, there's a solution?
Yes, as written abov, but it depends a bit and might not be that straight forward as you might hope:

- you can always de-compile the newgrf and add your own translations to the strings included. Get http://www.openttd.org/en/download-grfcodec and see http://wiki.ttdpatch.net/tiki-index.php?page=Action4 for details.
- If the NewGRF is in active development the easiest solution is to contact one of the authors and ask him/her what to do in order to translate that NewGRF. The author names are usually mentioned in the grf description, often also a website, e.g. a number is found on the DevZone
- If you want townnames in your language, you can quite easily adopt one of the existing town name NewGRFs as found on the DevZone, their sources can be obtained there, it could then also be hosted there.

Re: How to translate NewGRF files?

Posted: 22 Oct 2010 11:50
by michael blunck
raymanlololo wrote: So, there's a solution?
Well, the easiest way would be to decode that particular grf, edit those text strings yourself and re-encode it, using grfcodec. This should be quite easy because you´d only exchange the text strings, everything else would remain untouched.

O/c, there are other questions apart from those technical ones: In case you´re planning to release the new grf, there could be copyright isssues as well as the need for a different grf-ID.

regards
Michael