How to translate missions/scripts?

3 replies [Last post]
Wuzzy
Wuzzy's picture
User offline. Last seen 3 weeks 3 days ago. Offline
Joined: 2012-06-20
Posts: 1301

How do I translate missions and scripts?

Hi, I am a Hedgewars developer. Smile

sphrix
sphrix's picture
User offline. Last seen 3 days 19 hours ago. Offline
Joined: 2011-04-07
Posts: 207

hum, i guess there are multiple answer but i give you the one i know
find this C:\Program Files (x86)\Hedgewars 0.9.18\share\hedgewars\Data\Locale
(in fonction of your os of course Wink Smiley )
then the file fr.lua or pl.lua (select the one of your langage)
edit it like this
["hello"] = "", <-- original file line
["hello"] = "bonjour", <-- how you have to fill, between the "" write the translation, and put the , after it.

this is if you want to translate one existing mission (find the line that is from the mission and translate it)

if you added a mission or created one, its almost same but in the file locale.lua you won't find the line of the mission, so copy them...

i hope i have been clear enough

if i havent, just open the file in locale.lua, and try to understand how the file work Wink Smiley

the beachs hogs surfin hedgewars

Wuzzy
Wuzzy's picture
User offline. Last seen 3 weeks 3 days ago. Offline
Joined: 2012-06-20
Posts: 1301

But isn’t such a file hard to share?
I mean: Putting the translations of all missions (even the custom downloaded user missions) in one single system-wide file (each language) for all missions seems totally unpractical to me. And as soon as you update Hedgewars, this file will get overridden.
Also it seems impossible to distribute myself a new mission this way with multiple translations without forcing the recipents of my mission to override their lg.lua (lg=language code). Think of this abstract example:
Gamer G wants to download a mission M and another mission N. Both missions M and N are localized in the language L which is not English. A and B both use the method you descripte to translate the strings (using lg.lua). Now if G installs M first, then N, then first the native lg.lua will get overriden by mission M and contains the new translated strings. But mission N will override lg.lua again. The result will be that G sees the localized strings of N, but not of M. In reverse it is the same problem: If G installs N first, then M, G sees only the localized strings of M, but not of N.
This is a problem. It may be circumvented if G merges both lg.lua files manually. But this is a bad hack. Now imagine that G doesn’t download only two missions, but ten! The manual merging trick becomes totally annoying and unpractical. In general, you can say that the gamer G will only see the localized strings of the mission he/she last installed (ignoring the pre-installed missions, of course).

Your solution is therefore unfortunately totally unpractical.

Is there a solution to translate a mission (or script) without invoking system-wide files?

Oh, by the way, I do not have a Windows machine, I use GNU/Linux but I have located this file anyways. On my machine, the file is in /usr/share/hedgewars/Data/Locale.

Hi, I am a Hedgewars developer. Smile

sphrix
sphrix's picture
User offline. Last seen 3 days 19 hours ago. Offline
Joined: 2011-04-07
Posts: 207

yes i agree its not easy to share as file
but if i understand your example, i can clean one of your argument Wink Smiley
the number of the line doesnt matter, the line mission of mission M or N can be located event like this Mline1 Nline3 Mline4 .... the programm don't think in term of line number but in what is written in : ex it read "hello" in the mission file you're playing, then it find the match in locale lg.lua
so when you create a mission, you could (if you want) also give the lines of mission that you want to translate (line like dialog or instruction Wink Smiley not the code Wink Smiley ) and the translation, and ask to player to copy it in locale lg.lua file

i think there is an other solution, its to write in the mission file but i don't remember how, i 'll watch in some file there :http://code.google.com/p/hedgewars/w/list?can=2&q=lua

you can also ask to some dev in irc Wink Smiley

the beachs hogs surfin hedgewars

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]