New language addition

naif

Chieftain
Joined
Nov 12, 2005
Messages
2
What`s the proper way to add a new language? I tried to append new tags after existing ones for other languages
Code:
<English>Go Back</English>
<French>Retour</French>
<German>Zurück</German>
<Italian>Torna indietro</Italian>
<Spanish>Volver</Spanish>
<NewLang>Go Back</NewLang>
and set Language = 5 in CivilizationIV.ini, but after run civ nothing displayed. Is the langs count hardcoded in the civ4 core and the only way to replace one of the existing language?
 
Dunno, but if the count is hardcoded, just change one of the existing languages...you don't really need German, do you?
 
I just looked for "proper" way to add a completly new language in the game for the fun of it. 8)
Maybe SDK will help me...

Fox Mccloud, can you say me a phone or email of any Aztec or better Nahuatl? 8)
 
naif said:
I just looked for "proper" way to add a completly new language in the game for the fun of it. 8)
Maybe SDK will help me...

Fox Mccloud, can you say me a phone or email of any Aztec or better Nahuatl? 8)

Why do you want a new language though? (which language do you want to add?)
 
Dom Pedro II said:
I think he wanted to add something that people (probably himself) speak :lol:

Well, there are a couple million people in Mexico who know some Nahuatl.

It's going through a revival there too. (I hope) ;)

naif said:
Fox Mccloud, can you say me a phone or email of any Aztec or better Nahuatl? 8)

Sorry, I don't know any Nahuatl. What I said was a joke, but I probably would add Nahuatl if I knew it......

Edit: Well, I do know a few Nahuatl words.....
 
Hi everyone.
I made some advance in this field.
I added a new language to the dropdown menu as you can see in the picture.



The way civ4 works, it seems quite probable that we can add new languages.
However, I'm stuck with the same problem naif had.
I can't find the place to add the new language.
I have no idea on how to say to the game there's a new language and a new tag for it to look for.

Does anybody know if languages are hard coded?
Does anbody know where we should be looking for it?
 
I've done some tests too, wanting to add Swedish as a language in Civ IV.
Like Pggar I managed to add a sixth language option to the dropdown menu (rather easy, it's done by adding another menuitem in CvOptionsScreen.py, and a sixth language key in CIV4GameText_New.xml). Then I started adding a few translations to the files in Assets/XML/Text/ just to see if something happened if I switched to my new language.

This should have been simple, I thought. Regardless of whether the program somehow realizes the language is using the tag "Swedish" (no matter how I've looked, I haven't found a place to tell it what tags I want it to use), or if it's just using the sixth translation it can find, I should have got some results. But when I switch over, everything is blank, even the phrases I know I have translated.

So I started experimenting, and got some disappointing results. It seems Civ IV doesn't actually look for the tags matching your language's name. Instead it extracts the language's position in the dropdown menu (1 for English, 2 for French, 3 for German, etc.) and uses that number to pick which phrases to use.
I tested this by renaming the tags to some translations to try to prevent Civ from finding the correct phrase, and by changing the order of some translations (putting the Spanish phrase before the English one), and Civ continued to pick them according to the position in the dropdown menu.

Okay, so Civ isn't so smart as I had hoped, but at least this should mean that if you just add a sixth translation to all phrases, and add a sixth option to the dropdown menu, everything should work automatically. And yet it doesn't.
I tracked the extraction of the selected language from the dropdown menu to a function called "handleLanguagesDropdownBoxInput" in CvOptionsScreenCallBackInterface.py. And yes, it seems it tries to set the language based on the position of the menu item, with the command "CyGame().setCurrentLanguage(iValue)". Now I don't know anything about Python, but as it looks to me it should work. But I suspect the function "setCurrentLanguage" is unprepared for the possibility that there are more than five languages, and somehow "neuters" the whole thing when iValue is higher than expected. And this function belongs to a dll file, Assets/CvGameCoreDLL.dll, which you can't change (at least not easily).:(

I'm still adding Swedish to my copy of Civ (mainly as an exercise), but now I'm adding it by inserting Swedish tags before the Spanish tags, and adding Swedish as a menu item instead of Spanish.
 
Thanks for the response ground.

I'm pretty dissapointed.
All my tests pointed to the fact that we could not add another language.
And what you're saying is even worst.
The language tags exist for nothing since the position is what matter.

Too bad we'll have to take a language of the game.
Once again, thanks for posting your test results.
It was really helpful. :D
 
Hi, I'm happy to finally managed to find a good search word to find this topic.

Unfortunately my experiences are the same as yours. First of all I have changed the CivilizationIV.ini language section, adding my new language (in my case it's Hungarian) set its number to (5) and equaled the Language to 5.
Everything is missing from the screen.
Than I tried to copy the whole content of the XML/Text folder to the CustomAssets/XML/Text and made the modification there. The result is the same.
But in grundsplitter latest post there is an option to examine. Maybe there is somewhere a variable named CurrentLanguage which has a predefined max. value, now set to 4 (together with the default 0 it is five languages). If this exists first this should be raised to any higher number and from that point on maybe the program can understand the Language = X setting in the ini file.

Second problem could be, that there are no 6. row in the text xml files, it leaves the places empty.

BTW. what program are you using to edit the XML and PY files? I use Notepad++ and I can suggest it to anyone! Can automaticly check the syntax errors, able to open multiple files at the same time, there is a macro feature with wich you can add the extra language tag rows in a breeze and there is a plugin which automaticly put the closing tags too. And its small and free and even can replace the original Windows Notepad if you want.

Special characters: it is tricky, because I could not see anything on the screen till now, so I do not now my results. It is clear that you should use the &#ANSI_decimal_value; for each one. The problem is, that the CharacterMap of the WinXP shows the Unicode values of the glyphs and not the ANSI anymore. In Notepad++ there is a plugin which shows the whole ANSI chart, so I did it a way that made all the new text lines typing the readable text, saved all the files, opened them all and in the Change option I copied the ANSI value from the chart into the "to" field. There is an option to do the changes in all opened file, so it took some 5 sec per character.
 
I have played a little with the sylfaen.ttf font what seems to be a game system font. The results are interesting. This font is coded in the ISO-8859-1 range, aka Latin-1, buta slo contains the cyrillic, greek, armenian and georgian characters and the Latin Extended-A characters. It is a good news for those ones who want to put text in this language.

The bad news is, that because of the ANSI references instead of the Unicode ones the rendering of the spec. characters usage is at least a bit hectic.
Those ones which are out of the 259 Standard ANSI set are replacing some of those characters, according the system language and the keyboard layout of the given user, that' how e.g. a russian can type text in his/her keyboard. The Unicode value of a character (glyph) is consistent and unique, no matter where on earth it is referred. The decimal referral depends on the code charts what the fonts includes, the language of the operating system and the keyboard layout.

I have changed the name "Washington", the first american city in the XML's English row. When I have tried to use the correct decimal values for some hungarian characters, the result was ? or a rectangle, showing that there are no known character there. If I used the the ANSI code where they are placed to, the text was correct on the headline of the city screen, correct when the settlers founded the city and was offered to change it, but showed the wrong (origonal ANSI) characters on the game screen.
 
Try setting the your default locale / language setting in Windows to Hungarian to get the correct font. Some guy was trying to do Greek and said there is a xml tag set to ISO-8859-1, you might need to change that too.
 
groundsplitter said:
I've done some tests too, wanting to add Swedish as a language in Civ IV.
Like Pggar I managed to add a sixth language option to the dropdown menu (rather easy, it's done by adding another menuitem in CvOptionsScreen.py, and a sixth language key in CIV4GameText_New.xml). Then I started adding a few translations to the files in Assets/XML/Text/ just to see if something happened if I switched to my new language.

This should have been simple, I thought. Regardless of whether the program somehow realizes the language is using the tag "Swedish" (no matter how I've looked, I haven't found a place to tell it what tags I want it to use), or if it's just using the sixth translation it can find, I should have got some results. But when I switch over, everything is blank, even the phrases I know I have translated.

So I started experimenting, and got some disappointing results. It seems Civ IV doesn't actually look for the tags matching your language's name. Instead it extracts the language's position in the dropdown menu (1 for English, 2 for French, 3 for German, etc.) and uses that number to pick which phrases to use.
I tested this by renaming the tags to some translations to try to prevent Civ from finding the correct phrase, and by changing the order of some translations (putting the Spanish phrase before the English one), and Civ continued to pick them according to the position in the dropdown menu.

Okay, so Civ isn't so smart as I had hoped, but at least this should mean that if you just add a sixth translation to all phrases, and add a sixth option to the dropdown menu, everything should work automatically. And yet it doesn't.
I tracked the extraction of the selected language from the dropdown menu to a function called "handleLanguagesDropdownBoxInput" in CvOptionsScreenCallBackInterface.py. And yes, it seems it tries to set the language based on the position of the menu item, with the command "CyGame().setCurrentLanguage(iValue)". Now I don't know anything about Python, but as it looks to me it should work. But I suspect the function "setCurrentLanguage" is unprepared for the possibility that there are more than five languages, and somehow "neuters" the whole thing when iValue is higher than expected. And this function belongs to a dll file, Assets/CvGameCoreDLL.dll, which you can't change (at least not easily).:(

I'm still adding Swedish to my copy of Civ (mainly as an exercise), but now I'm adding it by inserting Swedish tags before the Spanish tags, and adding Swedish as a menu item instead of Spanish.
With 1.52 patch it's possible to add new languages to the game. When I saw this post I started to try adding a new language file and I got it :). All procedure above is necessary, plus a small change in the code in GlobalDefines.xml, changing from 8 to 9.

Notice: 3 new languages where added to text files (russian, japanese and chinese), but they didn't appear in the game, because they aren't translated yet :mischief:.
 
Also, since it is very tedious to translate/add a language manually, has someone thought to do it with some tool that would automatically position and insert the < language > < / language > tags? It would save a lot of time.
 
Back
Top Bottom