• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

What's the best way to provide a map with multiple languages?

Status
Not open for further replies.
Level 25
Joined
Feb 2, 2006
Messages
1,686
Hey,
my project needs to be translated into English. As far as I know most of the maps are already English so they do not have this kind of problem.
There is the .wts file which contains trigger strings and object strings etc. but I guess when using vJass code I have to write my own tool which merges selected strings into the wts file like for example gettext would do.


Are there any existing tools which help translating a Warcraft III map?
Another nice feature would be to include Google Translate or something for auto translation which would still be better than no translation at all.
 
Level 25
Joined
Feb 2, 2006
Messages
1,686
No answers so far?

Maybe I could write a tool based on a previous one which could already extract some parts: https://gitorious.org/wc3lib/vjasstrans/

Basically it has to work like xgettext (https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html) and generate a wts file which stores the strings positions in the entry comments.
This is already done by Warcraft III: The Frozen Throne for strings from object data I think.

The external string calls could then be replaced by GetLocalizedString().
The problem is that Warcraft III itself generates new entries for object data and GUI triggers so the IDs should not interfere. They would have to be newly generated each time.

Any suggestions? This really needs to work for my mod otherwise I am not able to translate it into English without losing the German translation.
 
Level 25
Joined
Feb 2, 2006
Messages
1,686
I've started writing a new version of "jasstrans": http://gitweb.wc3lib.org/?p=wc3lib.git;a=blob;f=src/app/jasstrans.cpp;hb=HEAD

At the moment it has the following usage:
Code:
jasstrans -o war3map.wts -O war3map.j currentscript.j
It searches for all GetLocalizedString() calls and creates an WTS file entry if the value is not of the form "TRIGSTRING_xxx".
It then outputs the wts file and a new version of the map script with replaced string values.

It can also use an existing output wts file with existing entries.
I will have to fix the JASS script output and add FDF file support.

The numbering of the new id starts with the maximum id + 1 but I want to add a option where the starting id can be specified.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
You can to a certain degree allow several languages within a map and display text messages uniquely to each player for their own language. This is easier to do from scratch since its much work to do this on a pretty complete map.

You can create a function in wc3 which fetches the language the player uses, and identify the language using this function. (This is from Battle Tanks, credits to bob666 aka N-a-z-g-h-u-l)

JASS:
function GetLanguage takes nothing returns string
	local unit Dummy = CreateUnit(Player(15),'hfoo',0,0,0)
	local string Name = GetUnitName(Dummy)
	local string Language = "Other"

	call RemoveUnit(Dummy)
	set Dummy = null
	if Name=="Soldat" then
		set Language = "German"
	endif
	if Name=="Footman" then
		set Language = "English"
	endif
	return Language
endfunction
You can also add more languages.


This allows the map to mention languages to each individual player depending on their wc3 language version. Not sure if all languages could be fetched with this method.

Standard units has their unique language name for each player. This can allow your map to maybe support your own language with ingame messages and such and also add english language.




Modified game interface messages and abilities would be a great challenge though.... They can be only 1 language (duplicating abilities just for changing description to players native languages would be unnecessary complex headache for the mapper imo.)


I hope this helps a bit.
 
Level 25
Joined
Feb 2, 2006
Messages
1,686
hm I remember this method thanks for sharing it. At the moment I am not quite sure which approach I will use.
The problem with yours is that you have to call stuff at runtime which should not be necessary.

Do you know if the IDs in a wts file stay consistent so if you add a new object or trigger that the new trigger string IDs start where the last ones stopped?

For my approach with the tool I would have to pick a starting ID which is bigger than all used wts entries.

Maybe generating a new FDF file would be better since you can use readable keys instead of a number.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
The problem with yours is that you have to call stuff at runtime which should not be necessary.
Yeah, you're right. I just realized that it creates a unit everytime you run it. Instead it would be better to create a unit at start for all players and putting an array variable would suffice perhaps. Then you only check the variable is set to that to german or english or other language for that player instead of running a function everytime and thus diplaying the message for that player to his own language. The disadvantage would be that you have to send messages to specific players on their own languages.

But your approach sounds interesting as well, but complicated. I'm only talking from a wc3 mappers perspective I'm not into programming at all.
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
if you still doing it
i'd recommend to look at dota's translation
wc3 has all data from .txt stored in memory and can read it via GetObjectName anytime
so you create ability based on evasion and change only it's name
since you didn't touch anything else final archive won't be trashed with useless info except ability's name

those txt files arent sync and can be different for every player

this way is much faster than feeding WTS file, 'cause it reads info directly from memory and game will parse those txt anyway
 
Level 25
Joined
Feb 2, 2006
Messages
1,686
But GetObjectName() reads from a wts file since there all strings from object data are stored.

I am thinking about using Google Translate since my mod has much to translate. Has anyone experience with this? The problem is that I cannot upload a wts file in google translate, so maybe the easiest way would be to translate each string separately. What I have found is this. A little program could parse the wts file and make a REST call per string. What do you think?

edit:
For the code I am using the approach from above and detect the language at runtime in JASS but I would still have to test it with an English version of Warcraft.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
To be honest, why bother supporting two codebases just for a translated game?
Just change your map into full english if you want to spread it and discard support for whatever language you used prior to that.

English is the international language. And as of our globalized world in 2015, there is hardly any reason to use anything else.
 
Status
Not open for further replies.
Top