Hebrew translation mod

elementoffear

Warlord
Joined
Jan 11, 2011
Messages
194
Hi all,
I want to write a translation to hebrew for civ 4, so my son can play the game.
Couldn't find one previously done, so any tips on how to start this?
Main issue would be the changing to a right to left language I imagine.

Thanks, EOF

**** EDIT ****
Attaching final result here if anyone is interested
 

Attachments

woowa wooaa....

שיהיה לך בהצלחה.....

לא נראה לי שזה מעשי זה יכול להיות קשה.

עדיף ללמד אותו אנגלית כבר :)
 
woowa wooaa....

שיהיה לך בהצלחה.....

לא נראה לי שזה מעשי זה יכול להיות קשה.

עדיף ללמד אותו אנגלית כבר :)

הא.... סוף סוף עברית

מקסימום אכתוב את הכל הפוך - לא צריך את כל הסויולופדיה, רק את הממשק
 
Moderator Action: Moved to the main forum.
Because the modpacks subforum is only for mods, not for questions or early "work in progress" threads ;).
And: Please provide a translation in English if you're talking about another language.


@topic: I don't think that right to left will be a problem. The text is just put as it is in the text files, there's no need to shift the order anywhere. If you put it with the other direction in the files, it should for most cases appear as it is.
 
Moderator Action: Moved to the main forum.
Because the modpacks subforum is only for mods, not for questions or early "work in progress" threads ;).
And: Please provide a translation in English if you're talking about another language.


@topic: I don't think that right to left will be a problem. The text is just put as it is in the text files, there's no need to shift the order anywhere. If you put it with the other direction in the files, it should for most cases appear as it is.

wait a minute... we didn't give a translation... so how did you know I said I would just reverse the letter order :)
 
You can use characters from other character sets by using their HTML versions in the text files :).
(-> you might need a converter for that, because doing that by hand will be way too much work; I think the one program which j_mie has for text file conversions is able to handle that)
 
You can use characters from other character sets by using their HTML versions in the text files :).
(-> you might need a converter for that, because doing that by hand will be way too much work; I think the one program which j_mie has for text file conversions is able to handle that)

I will check the html encoding , I can program so its not a big problem (I will probably use google translate at first to do the actual translation, then write something to reverse and encode). But are there hebrew characters/ graphics at all to use? its a graphical interface so its not using windows fonts, if someone in the development process didn't bother putting in hebrew somewhere it will not really work. Have you ever seen a single hebrew character in the game?
 
ugh...that's a good question.
The gamefonts don't show any hebrew signs.

But Civ4 is also available in russian, and there are no cyrilic signs in the gamefonts either :hmm:. -> you might maybe want to ask some of the russian guys around (e.g. Walter Hawkwood) how their gamefonts look. If they have cyrilic signs in them too, then you have a problem. If not, then Civ has to use another system (:dunno:).
 
Most of the text in the game is displayed using a TrueType font file, normally sylfaen.ttf. It is found in the vanilla civ's Resource/Fonts folder (there is also a copy in Assets/res/Fonts next to the gamefonx*.tga files, but I think it uses the other one). Mods that use a different font (like Final Frontier) provide a different font file and change the theme files to use the different font. Based on the font properties extension (from MS's PowerTools) sylfaen.ttf does not have Hebrew characters (Greek, Cyrillic, and a couple of others, but no Hebrew). So if that is correct, you'll have to use a different font file and change the places in the theme files that mention it (I think the only references are the definitions in Civ4Theme_Common.thm). Civ4 also comes with arial.ttf in the same folder and that one does include the Hebrew character set, if you want to use a font that ships with the game.

On the other hand, the GameFont*.tga files are, I think, used for the city billboards. The thing that hovers in front of every city and tells you the name, population, what it is producing and such. I have no idea what you'd do about that. I expect the Finnish translation people would know since it must have come up for them too. (The Russian translation is essentially dead since some company produced an official licensed version in Russian. There might be someone from the Russian translation project still around, or there might not.) Possibly change it to use the characters in the "1255 Hebrew" codepage, or the "862 Hebrew" codepage. That would require much messing around with the evil GameFont*.tga files once you figure out what needs to be mapped to which character (I have no idea how the 2 different Hebrew codepages are arranged). But that would probably be difficult since the current symbols in there are mostly the ISO-Latin-1 or Windows-1252 character set, but have some differences, and all control characters are skipped and it starts at character 33 (not 32, which is the space character). Since it is not a direct mapping but a modified version (for example: there is normally a backslash, "\" between the square brackets, "[" and "]", but the GameFont files have the multiplication symbol, "×" instead and later where the multiplication symbol is supposed to be it is skipped - there is no empty space or different character, it is just completely skipped) I have no idea how you'd substitute a different character set. I'm thinking the mapping is probably hardcoded into the .exe, although strings with the mapped characters in order do
appear in the createTestFontString function in CvGameTextMgr.cpp that doe snot sound like it is defining the mapping.

Hm. Searching files for font related stuff, I came across an interesting note in CIV4ArtDefines_Misc.xml:
<MiscArtInfo>
<Type>CITY_BILLBOARDS</Type>
<Path>None</Path>
<!-- positive scale: city billboards use fonts from GameFont.tga -->
<!-- negative scale: GFC billboards (uses the interface font) -->
<fScale>1.0</fScale>
<NIF>None</NIF>
<KFM>None</KFM>
</MiscArtInfo>
So it may be possible to change this to using the same TrueType font everything else uses by changing fSCale from 1.0 to -1.0 (and then adjusting the value to get a good size). In that case, all that stuff about the weird mapping of the text in the GameFonts files is irrelevant.
 
Most of the text in the game is displayed using a TrueType font file, normally sylfaen.ttf. It is found in the vanilla civ's Resource/Fonts folder (there is also a copy in Assets/res/Fonts next to the gamefonx*.tga files, but I think it uses the other one). Mods that use a different font (like Final Frontier) provide a different font file and change the theme files to use the different font. Based on the font properties extension (from MS's PowerTools) sylfaen.ttf does not have Hebrew characters (Greek, Cyrillic, and a couple of others, but no Hebrew). So if that is correct, you'll have to use a different font file and change the places in the theme files that mention it (I think the only references are the definitions in Civ4Theme_Common.thm). Civ4 also comes with arial.ttf in the same folder and that one does include the Hebrew character set, if you want to use a font that ships with the game.

On the other hand, the GameFont*.tga files are, I think, used for the city billboards. The thing that hovers in front of every city and tells you the name, population, what it is producing and such. I have no idea what you'd do about that. I expect the Finnish translation people would know since it must have come up for them too. (The Russian translation is essentially dead since some company produced an official licensed version in Russian. There might be someone from the Russian translation project still around, or there might not.) Possibly change it to use the characters in the "1255 Hebrew" codepage, or the "862 Hebrew" codepage. That would require much messing around with the evil GameFont*.tga files once you figure out what needs to be mapped to which character (I have no idea how the 2 different Hebrew codepages are arranged). But that would probably be difficult since the current symbols in there are mostly the ISO-Latin-1 or Windows-1252 character set, but have some differences, and all control characters are skipped and it starts at character 33 (not 32, which is the space character). Since it is not a direct mapping but a modified version (for example: there is normally a backslash, "\" between the square brackets, "[" and "]", but the GameFont files have the multiplication symbol, "×" instead and later where the multiplication symbol is supposed to be it is skipped - there is no empty space or different character, it is just completely skipped) I have no idea how you'd substitute a different character set. I'm thinking the mapping is probably hardcoded into the .exe, although strings with the mapped characters in order do
appear in the createTestFontString function in CvGameTextMgr.cpp that doe snot sound like it is defining the mapping.

Hm. Searching files for font related stuff, I came across an interesting note in CIV4ArtDefines_Misc.xml:

So it may be possible to change this to using the same TrueType font everything else uses by changing fSCale from 1.0 to -1.0 (and then adjusting the value to get a good size). In that case, all that stuff about the weird mapping of the text in the GameFonts files is irrelevant.

Wow... long answer, thank you for the details.

I wasn't looking to start compiling the dll's and such but more of a quick hack.

Now, if I understand you correctly, I can :

1 - Change some TGA files to have Hebrew characters instead of Latin, say the letter "A" is replaced with "&#1488;"
2 - Change some xml files so that the text itself will be in english but actually be Hebrew? (I'll put an "A" whenever I need an "&#1488;")...? The texts will mean nothing readable for humans, but will be a double translation (first translate the actual meaning, then change the letter mapping)

Doable?
 
well its a hard project.

not sure its worth the time, it will be easier to teach ur son english by the time ull finish :)

goodluck / &#1489;&#1492;&#1510;&#1500;&#1495;&#1492; &#1488;&#1497;&#1513;.

I'll find a quick hack... my son is 8 and he asks me to play it with him all the time. Which is nice, but I just take over his games and he doesn't like that :)
 
2 - Change some xml files so that the text itself will be in english but actually be Hebrew? (I'll put an "A" whenever I need an "&#1488;")...? The texts will mean nothing readable for humans, but will be a double translation (first translate the actual meaning, then change the letter mapping)

I would think that making the city billboards use a regular font would allow you to do everything in actual Hebrew, no extra character mapping necessary. Well, you may need to encode all of the text in the XML via the HTML codes, but that is another issue (there are probably utilities that can do this for you, possibly include web page design software if you happen to have any laying around). There is some slim chance that you might not need to do the HTML encoding, but some parts of Civ4 apparently don't like anything but 7-bit ASCII characters in the XML data fields, acting like the XML is using ASCII encoding even though they (mostly) specify that they are using the UTF-8 encoding. On the other hand, some people seem to have no difficulty using characters with accents which require an 8-bit character set (Latin-1 or the Windows codepage version taht is almost the same). I'm not sure where the problem might be, but the XML that ships with the game encodes everything that isn't a 7-bit ASCII character even though after it loads it and decodes it the text apparently all ends up as 16-bit Unicode. (All the various non-letter symbols in the GameFonts files are actually loaded as 16-bit Unicode characters up well past character 4000 somewhere, starting in or near a region used by various arrow symbols and such in the Unicode character set. They override the glyphs from whatever font is in use so they can be added to the text strings that are displayed.)
 
I would think that making the city billboards use a regular font would allow you to do everything in actual Hebrew, no extra character mapping necessary. Well, you may need to encode all of the text in the XML via the HTML codes, but that is another issue (there are probably utilities that can do this for you, possibly include web page design software if you happen to have any laying around). There is some slim chance that you might not need to do the HTML encoding, but some parts of Civ4 apparently don't like anything but 7-bit ASCII characters in the XML data fields, acting like the XML is using ASCII encoding even though they (mostly) specify that they are using the UTF-8 encoding. On the other hand, some people seem to have no difficulty using characters with accents which require an 8-bit character set (Latin-1 or the Windows codepage version taht is almost the same). I'm not sure where the problem might be, but the XML that ships with the game encodes everything that isn't a 7-bit ASCII character even though after it loads it and decodes it the text apparently all ends up as 16-bit Unicode. (All the various non-letter symbols in the GameFonts files are actually loaded as 16-bit Unicode characters up well past character 4000 somewhere, starting in or near a region used by various arrow symbols and such in the Unicode character set. They override the glyphs from whatever font is in use so they can be added to the text strings that are displayed.)

OK, but besides the billboards, I would still need a solution for the menus and other UI, so that is not a full solution.. ?
 
All the other text already uses a regular font file. You just need to set it to a font that has the Hebrew character set in it, like the aria.ttf file that comes with the game, via the theme file I already mentioned. Then it's pretty much just the HTML encoding issue to deal with.

I'm not sure how one goes about adding a language to the language list. It might be necessary to change an existing one instead of adding one. Check the Finnish translation, they must know. The Finnish translation mod thread also has links to the Russian translation, as well as 3 more I wasn't aware of until now: Catalan, Hungarian, and Dutch. Of course, none of these use a completely different character set that goes in the opposite direction of the existing languages.
 
All the other text already uses a regular font file. You just need to set it to a font that has the Hebrew character set in it, like the aria.ttf file that comes with the game, via the theme file I already mentioned. Then it's pretty much just the HTML encoding issue to deal with.

I'm not sure how one goes about adding a language to the language list. It might be necessary to change an existing one instead of adding one. Check the Finnish translation, they must know. The Finnish translation mod thread also has links to the Russian translation, as well as 3 more I wasn't aware of until now: Catalan, Hungarian, and Dutch. Of course, none of these use a completely different character set that goes in the opposite direction of the existing languages.

Hmmm.... tried but failed....

I tried all the combinations of these:


1 - Added the string &#1488;&#1489;&#1490;&#1491;&#1492;&#1493;&#1494;&#1495;&#1496;&#1497;&#1499;&#1500;&#1502;&#1504;&#1505;&#1506;&#1508;&#1510;&#1511;&#1512;&#1513;&#1514; to the Civ4GameTextInfos.xml file under the single player menu text
2 - Tried all different encoding options for the xml file ( US-ASCII , Windows-1255 , ISO-8859-1 , ISO-8859-8 , ISO-8859-8-i , ISO-8859-8-1 , 862 (
1 - changed the font in the theme file to arial / MS arial unicode (this font has every language) / david - and added the font file to the resource folders

I saw the fonts change, but all the hebrew characters where blank (empty space not nothing )

Any ideas?
 
Back
Top Bottom