Hebrew Translation - How?

Problems with other language translations

Moderators: bert_the_turtle, jelco

Hebrew translation - good idea?

Yeah
1
33%
Nope
0
No votes
Not for me, but it's a good idea
2
67%
 
Total votes: 3
User avatar
NeatNit
level5
level5
Posts: 2929
Joined: Mon Jan 28, 2008 2:41 pm
Location: Israel
Contact:

Hebrew Translation - How?

Postby NeatNit » Fri Feb 15, 2008 1:54 pm

I want to translate Darwinia to Hebrew, but there are two problems:
1) Hebrew is from right to left.
2) Hebrew letters are not supported.

If you're going to tell me to write it backwards then just tell me how many letters can I fit in 1 line?
User avatar
xander
level5
level5
Posts: 16866
Joined: Thu Oct 21, 2004 11:41 pm
Location: Riverside, CA, USA
Contact:

Postby xander » Fri Feb 15, 2008 5:19 pm

Honestly, translating to Hebrew would be a fairly epic task. First, you would have to create a font map for the Hebrew characters, then you would have to figure out the translation from an English letter to a Hebrew letter on that font map. Finally, you would have to translate the text into that coded English text so that the game can display it. Finally, you would have to figure out how many characters you can fit on a line. I think it is about 80. However, for multiline messages in the game, you might not have a way of breaking the lines of text apart without breaking Darwinia, and they will sill be put onto the display from left to right. On top of that, there probably aren't that many people that would actually download the final product.

I don't mean to discourage you, but translating Darwinia into a language that uses a char set other than Latin is a bit of a pain in the ass, and making it write from right to left is simply not possible without having access to the game's source code. If, having read all of this, you are still interested in a creating a translation, I am happy to help address questions that you have, but do realize that what you want to do is non-trivial.

xander
User avatar
briceman2
level2
level2
Posts: 123
Joined: Wed Dec 12, 2007 4:30 am

Postby briceman2 » Mon Feb 18, 2008 6:13 am

There may be a fairly easy way without getting Chris to hack the engine code. It's still a bunch of work, though.

This idea would require you to release a handfull of files as a mod. They would replace the normal language, font, and script files. There are several ways of getting your Hebrew files to override the original game files. But players will have to be comfortable creating directories and copying a few files around. I (or Xander, or maybe TGF) can help you with this info if you get that far.

The display is always written left to right. But the speed is controlled by the TextSpeed line in the preferences.txt file. The TextSpeed variable is usually 15, but at 255 a line of text gets displayed almost instantly. So if you did your backwards Hebrew, the lines would not look like they're getting displayed left to right.

Unfortunately TextSpeed also controls the delay between lines of text. So with TextSpeed=255 you don't have time to read things. The only way to pause the text is to insert a "Wait" command into the scripts that "Say" the text lines. This means you will have to make a separate copy of all the game scripts (a dozen or so) and edit them so there is a pause after each text line and each paragraph as needed. It may take some trial and error to get the dramatic timings similar to the original.

You also need to create a font bitmap. This should be fairly easy in any photoshop-like program. Because of the sneaky way you have to set up everything, the game won't know you are displaying Hebrew. (EDIT: see below...) It will think English is being used. So there will be a mapping between the ASCII and the Hebrew alphabets. This can be arbitrary.

Everything will be much easier if you know how to write simple scripts in perl or python or VB, etc. You can then write your translations in a text file in a way that is easy to read. Then you run it through your script to reverse the lines and map the characters. If that doesn't make sense, then this idea of mine is probably not for you.

To get a feel for the files involved, you can unpack the game.dat file by making a copy and renaming the copy to game.rar -- the .dat file is a .rar file in disguise. Then you can unpack the .rar file and look at all the game files. You can also make a new mod directory and copy the entire contents of the .rar into the mod directory. Then you can play the original game as if it were a mod. You can tinker with the mod files and see what they do without messing up the main game data. (None of this unpacking is neccessary for your end-users if they want to play your Hebrew version.)

The files you should look at are:

1) any/all of the scripts under the /scripts directory,
2) the font map file /textures/speccy_font_normal.bmp,
3) the main dialog file /language/english.txt.

If I were you, I would first verify that you can use TextSpeed=255 and Wait commands to make the English text readable. Start with the /scripts/garden_intro.txt script and insert "Wait n" lines after each "Say" command, where n is the number of seconds to wait. It can be an integer or any number >= 0.00. Then edit your preferences.txt file to set the TextSpeed=255 (or maybe higher or lower?) and see if the text is still readable. (Remember to reset the level each time so the scripts run again.) If you can't make the English readable this way, then there is no point in doing any of the Hebrew work.

Lastly, if you are NOT running under Windows, you MUST remember to change ALL of your line endings to the standard Windows terminations. A good text editor can do this automatically, or you can write a quick script of your own. The Linux and Mac versions of Darwinia will tolerate Windows text files, but Windows tolerates nothing!

Good Luck!

EDIT: you can actually add a "hebrew" option to the Language Options menu. It's simple! Just create two files in your mod: (I just copied the english / normal ones and renamed them.)

1) /textures/speccy_font_hebrew.bmp
2) /language/hebrew.txt

That's it! If you look at the Russian and German language files (packed in the language.dat file, which is also a .rar in disguise), you will see that the "tags" for each line of text must remain in english, just like in the original. The "Say" script commands refer to these tags.
User avatar
xander
level5
level5
Posts: 16866
Joined: Thu Oct 21, 2004 11:41 pm
Location: Riverside, CA, USA
Contact:

Postby xander » Mon Feb 18, 2008 5:23 pm

^^ As I said, it is non-trivial. ;)

In terms of getting the files to load, I would just create a mod. When Darwinia looks for files, it looks first to the active mod, then to main.dat. Thus, if there is something in the active mod that replaces something from main.dat, the thing from the mod is used. So, you can create Hebrew language files in your mod, and have replacement scripts in your mod, and those will take precedence. That is actually the easy part. The hard part is getting the Hebrew translation to work in the first place. As you say, you will need to create the font file, and get translation from ASCII to Hebrew figured out. Those are the hard parts. ;)

briceman2 wrote:Lastly, if you are NOT running under Windows, you MUST remember to change ALL of your line endings to the standard Windows terminations. A good text editor can do this automatically, or you can write a quick script of your own. The Linux and Mac versions of Darwinia will tolerate Windows text files, but Windows tolerates nothing!

Really? I use the Unix line termination char in Insurrection, and I don't think it has caused any harm. It just makes the files hard to read to someone opening them up in Windows.

xander
User avatar
briceman2
level2
level2
Posts: 123
Joined: Wed Dec 12, 2007 4:30 am

Postby briceman2 » Mon Feb 18, 2008 10:42 pm

xander wrote:
briceman2 wrote:Lastly, if you are NOT running under Windows, you MUST remember to change ALL of your line endings to the standard Windows terminations. A good text editor can do this automatically, or you can write a quick script of your own. The Linux and Mac versions of Darwinia will tolerate Windows text files, but Windows tolerates nothing!

Really? I use the Unix line termination char in Insurrection, and I don't think it has caused any harm. It just makes the files hard to read to someone opening them up in Windows.


Well I know it makes a diference in some files, but I can't remember if I traced it to find out which ones care. I made a test mod with the linux version, and then I transfered it to my windows partition on the same machine. Nothing worked until I scanned all the text files with a perl script that replaced the line terminators. Then everything was fine.

It may be the shape files that care. But it seems like good practice to avoid invisible bugs. Just like it's good practice to use only lowercase filenames since linux (and OSX I'd guess) cares about case while windows doesn't. A lot of smaller mods won't run under linux (without extensive editing) because of sloppy filenaming.

EDIT: I may have had mixed terminations in the shape files I'd edited. Don't know why that would make a difference if the parser is terminator-agnostic...

...but there is one section of the shape file that *cannot* contain blank lines. I think it's the triangle list. So if mixed (or wrong) terminators somehow got interpreted as extra blank lines in that context, then darwinia will crash out hard every time, which is what was happening.
User avatar
xander
level5
level5
Posts: 16866
Joined: Thu Oct 21, 2004 11:41 pm
Location: Riverside, CA, USA
Contact:

Postby xander » Tue Feb 19, 2008 12:09 am

briceman2 wrote:...but there is one section of the shape file that *cannot* contain blank lines. I think it's the triangle list. So if mixed (or wrong) terminators somehow got interpreted as extra blank lines in that context, then darwinia will crash out hard every time, which is what was happening.

That might be the issue. If it is expecting a \n and gets \r\n, it might bork. However, as I said, I haven't gotten any complaints about Insurrection, and I have files of almost every type in there, all with Mac/Unix line terminators.

xander
User avatar
NeatNit
level5
level5
Posts: 2929
Joined: Mon Jan 28, 2008 2:41 pm
Location: Israel
Contact:

big confusion

Postby NeatNit » Tue Feb 19, 2008 4:44 pm

Well... :? there was a big confusion for me... Thanks! I think... I think the edit in the 3rd post here is all I need to do if I don't care about it writing backwards or going left instead of right... right?
User avatar
briceman2
level2
level2
Posts: 123
Joined: Wed Dec 12, 2007 4:30 am

Postby briceman2 » Tue Feb 19, 2008 7:02 pm

Well, there are still a few things you have to do.

1) you need to copy the english.txt file and rename it hebrew.txt -- this is the one you edit.

2) darwinia has limited character support -- look at the speccy_font_normal.bmp to see what it can display. No hebrew characters there. So either you transliterate into the latin/english font, or you have to make your own font bitmap. Do a few tests before you translate everything.

3) if you find you need additional (or fewer) lines than the english, then you can add more (or remove) tags in the language file. Tags are grouped by their base name, so just change the numbers at the end and that should be all you have to do.

4) you will need to package your hebrew.txt (and possibly you speccy_font_hebrew.bmp) file as a mod, or instruct people where to place the files in the main darwinia directory so they get found. Since it's just as easy to add the needed directory(ies) to the main installation, that is probably the best way to go. Then people don't have to have completed the game to access your translation.

To accomplish 4) all you have to do is find the directory where game.dat is located. Then create the following directories. The /lib directory probably already exists.

Code: Select all

    game.txt
    /lib
        /data
            /language
                hebrew.txt
            /textures
                speccy_font_hebrew.bmp


But first you should edit a few lines in the Garden section to see if the results are acceptable.

Good Luck!

Return to “Translation Issues”

Who is online

Users browsing this forum: No registered users and 4 guests