j_mie6
Deity
The XML text cleaner! (V3)
The XML text cleaner is a Python built utility that searches through a mods xml files and makes sure that all Descriptions etc have text tags in the Assets/XML/Text directory
for example say I had made a new civilization like this:
Code:
<CivilizationInfo>
<Type>CIVILIZATION_VENICE</Type>
<Description>The Venetian Empire</Description>
<ShortDescription>Venice</ShortDescription>
<Adjective>Venetian</Adjective>
<Civilopedia>Venice is a city in northern Italy bla bla bla...</Civilopedia>
while running the cleaner would convert it to this:
Code:
<CivilizationInfo>
<Type>CIVILIZATION_VENICE</Type>
<Description>TXT_KEY_VENICE_DESC</Description>
<ShortDescription>TXT_KEY_VENICE_SHORT_DESC</ShortDescription>
<Adjective>TXT_KEY_VENICE_ADJECTIVE</Adjective>
<Civilopedia>TXT_KEY_VENICE_PEDIA</Civilopedia>
with some text tags of
Code:
<TEXT>
<Tag>TXT_KEY_VENICE_DESC</Tag>
<English>The Venetian Empire</English>
<French>The Venetian Empire</French>
<German>The Venetian Empire</German>
<Italian>The Venetian Empire</Italian>
<Spanish>The Venetian Empire</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_KEY_VENICE_SHORT_DESC</Tag>
<English>Venice</English>
<French>Venice</French>
<German>Venice</German>
<Italian>Venice</Italian>
<Spanish>Venice</Spanish>
</TEXT>
etc...
Installation and intructions for use!
usage is very easy, first install python 2.7 from www.python.org (this is required for either version).
open the module with IDLE, then edit the options to fit your mod's xml path/documents (see below) and press F5 to run. (this is is using V1 or if the variable bGraphics is set to False in V2+)
if using V2/V3 simply doubleclick the XML text cleaner.py file and it will open (like image 2 below) then press the options button to enter mod path etc and then press run Cleaner! In GraphicalInterface.py there are some options that allow you to change the colour, font type, font colour and font size of the main box!
there are many options that the user can use.
Code:
##Options##
#Enter mod xml location (Files are automatically backed up to the path specified in backupPath
xmlPath = "C:/Program Files/2K Games/Firaxis Games/Sid Meier's Civilization 4 Complete/Beyond the Sword/Mods/[your mod name]/Assets/XML"
#Backed up files will be places in this path in a folder called XMLBackup, MAKE SURE THIS POINTS TO A VALID FILE PATH!
backupPath = "C:/Users/User/Documents"
#Here add files that should ignore the checks (for example EffectInfos has many wrong references, but it is on purpose!)
lIgnores = ["CIV4EffectInfos.xml", ]
#The name of the new text xml (if one doesn't exist this will be the name of the new one!)
textFilename = "CIV4CustomText.xml"
#Language Options (set to True to create language node in xml!)
bFrench = True
bGerman = True
bItalian = True
bSpanish = True
#Search Options (set to True to enable searching for this node!)
bDescription = True
bPedia = True
bStrategy = True
bHelp = True
bShortDescription = True
bAdjective = True
bCityNames = True
bQuotes = True
if I was to set all the Language options to False any text tags created would be in the form of:
Code:
<TEXT>
<Tag>TXT_KEY_SOME_TEXT</Tag>
<English>some text</English>
</TEXT>
and turning search options to false ignores that type of node (e.g setting bPedia to False would mean that the program wouldn't bother to check the Civilopedia tags for incompete text.)
When entering paths make sure you use either / or \\ eg
C:/Users/User/Documents or C:\\Users\\User\\Documents
When the program starts it will backup the mods files in the path specified in options. When the program runs again it will delete the previous backup and create new ones. Make sure that when you are finished you check that there are no xml errors before running the program again!
Future features include an xml file for options instead of in the .py file (for non graphical setup) and italian and spanish translation fix, also more intelligent text tag management will be implemented to speed up translation time.
Post any bugs, questions or requests here!
Enjoy!
![Big Grin :D :D](/data/assets/smilies/biggrin.gif)