JTranslator - program for translating civ4 text files

cool3a2

Deity
Joined
Mar 30, 2007
Messages
2,177
The purpose of this program is to ease translating of civ4 and its mods to foreign languages.

What it can do:
- load text xmls
- add new language entries
- show the text that should be translated in two languages within one window - one of them is editable
- it follows kabcsis ideas that he shared with me some time ago
- it's able to work with different encoding standards; unfortunately civ4 doesn't seem to be, instead it supports only ISO-8859-1; therefore some characters need to be replaced and some languages (that use an entirely different alphabet) remain unsupported; replacing unsupported characters needs to be done by hand, but this would solve if civ4 can be forced to use UTF-8 for instance - this encoding standard is already supported by my program, so this issue is actually a problem of civ4 itself; see this page for supported characters: http://en.wikipedia.org/wiki/ISO/IEC_8859-1 (the german version [Deutsch] of that page shows a better overview IMO)
- in theory it should run on Linux and Mac systems, too, as it is written in Java, but this is untested yet; if it does, it might be used as a converter to make text files Mac compatible

changes with v2.0:
- can compare the file with another one and then add / remove missing / additional entries
- can adjust the programs font size
- can add new entries (right click at the root element of the xml, then choose add)
- file filter to choose from xmls only

changes with v2.1:
- will add all known languages to new entries using 'No Text' as text
- when adding a new language, the program will try to get a text from already exisitng languages, normally english

Prerequisites
Instal the Java Runtime Environment (JRE), you can download it from here: http://www.oracle.com/technetwork/java/javase/downloads/index.html. After that, you should be able to use the JTranslator.jar like an exe-file.

Download: http://forums.civfanatics.com/downloads.php?do=file&id=14633
Download bat-Version: http://forums.civfanatics.com/downloads.php?do=file&id=17551

Feel free to report bugs, share your thoughts and ask questions. However, I'm not sure whether I can make further improvements on this program as I don't have too much time now.
 
I will. I suppose I'll reuse the description from here.
 
Could you please upload it to CFC :)?

A file type filter for the loading menu would be nice.
Really a nice program. Thought of doing something like this myself, but i never had the time to.
I guess, it will also be useful for Civ5 :).
 
Thanks, guys.

@The_J: You're right, a filter would have been nice. I thought about that, but forgot it. If there should be anything else to change that makes a new version really necessary, this will be added, too.

@nitram: how do you mean that? If you await a pop-up or something - that is not meant to occur. If you switch to the right tab (that views the selected entry in two languages), there should be a combobox - a box that can be opened and then show a list. That should contain your new language (hungarian), but if I remember correctly the english texts are copied to the hungarian language entry, so the text might not change if english was selected before. I thought it might be a good idea to have it this ways as otherwise there would have been objects with no text at all. This ways, they occur as in their english form at least. So I hope that this is your problem. Otherwise report again please.
 
In both comboboxes? Hmm... I'll check it.
 
For me it works. Still, you should know the following things:
- only latin characters are allowed, thus no á etc; if you used such a letter for the languages name, the program rightfully refuses to add the language
- you will have to select a different or 'reselect' the current entry to update the lists of the comboboxes, so the lists aren't up-to-date - this thing might be something worth an update

Also, there is a status line at the bottom. It should provide information on whether adding a language worked or not. Please report what is written there.
 
So, does the program work now?
 
Glad to hear that. It could be as I said: you added the language, then went to the other tab to view the texts, but didn'T choose another entry on the left. This ways, the comboboxes didn't get updated. Well, I may fix this as well in a new version, but for now I have to concentrate on something that is not only for me but also avain wants it to be finished... Anyways, if you get more problems, feel free to ask for help.
 
I have uploaded a fresh new version of this tool. It's basically a backport from the civ5 JTranslator. Major changes are:
- new entries can be added; be aware that the program will not add the language entries, only an almost TEXT entry conatining the Tag element -> you should use the add language funtion to create all the langtuage elements (reason for this is, that I couldn't find a an xpath 1.0 expression that would deliver all the used languages within a file; filtering in Java could easily lead to iterations over several hundred list entries making it a long procedure)
- the opened file can be compared to another text file showing all the missing and additional entries which then can be added or removed; this should ease version handling
- can adjust the font size of the program (a user reported that the letters appeared to small in the civ5 version, I guess this is because of an incompatiblity between Java and video card if Anti aliasing is activated; I provided this function as a work around)
- there is a file filter as The_J requested

Keep in mind that this program is pretty much untested, so keep backups and report any bugs please.
 
Did it again. All languages ever used in the opened xml file will now be added for new entries, their text will be simply 'No Text'. Besides of this, in case of adding a new language to the file, all the new language entries should get some text which will normally be the english text if english is the first text entry. In the worst case, when no language at all is available, the text will also be 'No Text.'. All in all, there should never be cases where empty language entries will be generated, besides of if the english text is empty, but that's your beer.
 
I have uploaded a fresh version of my tool. I have done a couple of changes according to hints suggested by LaCi85, a user on the hungarian forum. Important changes are the ability to remove entries, the buttons to add portions like [BOLD], [PARAGRAPH:x] etc to format texts, improvements to the UI and a function to search for an entry within the file. Also, if two files are compared with each other, entries for languages not available in the second file, are added with the text of the first language given (should be english usually).

LaCi85, who tested the program, also found a NullPointerException which is a critical bug. I believe I found and fixed it, but in any case, I suggest you save your file before you add a new entry. Make sure the new entry got a name, if it has, everything should be fine. No other problems are known.

I also uploaded a bat version that should work for those who couldn't execute the runnable jar. JRE is still necessary and the jar file needs to be in the same folder as the bat. Also, you should not close the black window in the back as this would close JTranslator, too. If you have a program installed that deals with jars for your mobile phone, this might prevent the usual download from working, the bat-version should fix this.
 
Top Bottom