How to translate NewGRF files?

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
raymanlololo
Engineer
Engineer
Posts: 3
Joined: 14 Aug 2008 19:53

How to translate NewGRF files?

Post 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...
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: How to translate NewGRF files?

Post 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
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: How to translate NewGRF files?

Post 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.
Attachments
Municipios de España.xls
(990 KiB) Downloaded 162 times
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to translate NewGRF files?

Post by michael blunck »

raymanlololo wrote: I'm interested to translating a NewGRF file [...]
Try GRFtrans.
Image
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: How to translate NewGRF files?

Post 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.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to translate NewGRF files?

Post 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
Image
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: How to translate NewGRF files?

Post 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.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to translate NewGRF files?

Post 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
Image
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: How to translate NewGRF files?

Post 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.
Attachments
ogfx-trains.txt
output
(1.31 KiB) Downloaded 141 times
ogfx-trains.grf
input
(90.23 KiB) Downloaded 124 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: How to translate NewGRF files?

Post 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.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: How to translate NewGRF files?

Post by Rubidium »

Wouldn't an action0 feature 8 (general variables) property 11 (GRF ID overrides for engines) help?
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: How to translate NewGRF files?

Post 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.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: How to translate NewGRF files?

Post 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 ;-)
raymanlololo
Engineer
Engineer
Posts: 3
Joined: 14 Aug 2008 19:53

Re: How to translate NewGRF files?

Post 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
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to translate NewGRF files?

Post 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
Image
raymanlololo
Engineer
Engineer
Posts: 3
Joined: 14 Aug 2008 19:53

Re: How to translate NewGRF files?

Post 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?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: How to translate NewGRF files?

Post 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.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to translate NewGRF files?

Post 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
Image
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests