Txt_key

abandag

Warlord
Joined
Jun 24, 2012
Messages
120
When I'm modding something and get to the text part, do I need to do the whole TXT_KEY thing, or can I just write in the text? For example, on the <Description> line for a unit, do I need to do this:

Code:
<Description>TXT_KEY_UNIT_AXEMAN</Description>
and then define my TXT_KEY in <Language_en_US>?

Or could I just do it like this:

Code:
<Description>Axeman</Description>

It seems to me that it would save a lot of time and frustration to do it the second way, especially as I don't really care about translating my stuff into languages other than English (Sorry, non-English speakers).

I'm pretty sure I've done it like this before and it's worked OK, but I want to know if there are any reasons not do it this way. Are there any unforeseen problems doing it this way that I'm not, uh, foreseeing? Does it cause any problems with, say, long lists like city or spy names?

Thanks for any help you can give.
 
Either way is fine but TXT_KEY_UNIT_AXEMAN is highly recommended because it allows for translation to other languages.

If you want to use the TXT_KEY then do it like this:

Code:
<Language_en_US>
<Row Tag="TXT_KEY_UNIT_AXEMAN">
  <Text>Axeman</Text>
</Row>
</Language_en_US>
 
Thanks for replying.

I knew how to do the TXT_KEY thing. It's just so much easier doing it the other way, and I wanted to know if there were any reasons not to do it the easy way.

If translating is the only reason to use TXT_KEY, then I'll just skip that from now on and do it the easy way, because I wouldn't translate anything anyway. But if there are any other reasons besides just translation to do it the TXT_KEY way, then I'll have to rethink.
 
There are many other reasons to use TXT_KEY. Most of them involve using the same tag for multiple rows in the XML.

For example, instead of writing a strategy description for just help and strategy, I would just write the description once in a tag and then have both Help and Strategy refer to the same tag, as many buildings do.

By any stretch of the imagination I cannot see how not using TXT_KEY is the "easy way". It actually strikes me as the "lazy way" and it will lead to more frustrations than you think. Using the TXT_KEY will also clean up your XML.
 
Also, you'll loose other functionality, like the ability to use icons or any kind of dynamic values in your text (these use bracketing in the text.xml files). And I'm guessing that a lot of different characters ("';:/?<>!@#$%^&* and accented letters) will cause you all kinds of problems. Seems like a lot of potential headache for a shortcut that isn't much of a shortcut.
 
There are many other reasons to use TXT_KEY. Most of them involve using the same tag for multiple rows in the XML.

For example, instead of writing a strategy description for just help and strategy, I would just write the description once in a tag and then have both Help and Strategy refer to the same tag, as many buildings do.

By any stretch of the imagination I cannot see how not using TXT_KEY is the "easy way". It actually strikes me as the "lazy way" and it will lead to more frustrations than you think. Using the TXT_KEY will also clean up your XML.

I have done that too, having both Help and Strategy refer to the same tag. But it seems easier to me to just type out the text directly in <Help>, then copy/paste that same text into <Strategy>. Unless there is a specific reason not to do it this way, I can't see how this isn't easier. Type it out once, copy/paste, and boom, I'm done. That's so much easier and less frustrating (not to mention having a smaller margin of error) than messing with all those TXT_KEYs and Row Tag=s. Now if there is a specific reason why just typing it in isn't ideal, that's what I'd like to know. I'm not trying to be rude, but telling me that I'll run into frustrations doesn't help me. Telling me what those frustrations might be does help me because it allows me to determine for myself whether the extra effort is worth it.

Also, I'm not sure what you mean by it "will also clean up your XML."

Also, you'll loose other functionality, like the ability to use icons or any kind of dynamic values in your text (these use bracketing in the text.xml files). And I'm guessing that a lot of different characters ("';:/?<>!@#$%^&* and accented letters) will cause you all kinds of problems. Seems like a lot of potential headache for a shortcut that isn't much of a shortcut.

Here's a good example of a reason to use TXT_KEY instead of just typing it in. I hadn't anticipated not being able to use icons or those special characters. But frankly that doesn't bother me that much. While it would be nice to have my text match up with the game's, I still know that "+1 Gold" means I gain 1 extra gold, even if I don't see that little gold icon in between the 1 and the word Gold. I've never used any of those special characters in any of my text yet, and don't see myself using them anytime soon, so no headaches there. And the shortcut is actually pretty huge, unless I'm missing something. That's entirely possible, as I'm still new at modding.


Let me give an example of why I don't want to use TXT_KEY. I was making my first completely new civilization and got to the city names list. I had a list of something like 32 or 36 city names, based on the number of city names I counted for America. So for each city name I had:

Code:
<CityName>TXT_KEY_CITY_NAME_WHATEVER</CityName>

and then:

Code:
<Row Tag="TXT_KEY_CITY_NAME_WHATEVER"> 
<Text>Whatever</Text>

for each of the 32 or 36 cities I had.

Even with doing as much copying/pasting as I could it was still difficult, drawn-out, frustrating process. So when I made my second new civilization, I decided I would try to make that process a little easier by just doing this for each city:

Code:
<CityName>Whatever</CityName>

That was so much easier and less frustrating and less time-consuming. And when I saw how much easier that was, I decided to apply that to all my text.

What I don't know is if doing text this way is going to cause me problems somewhere down the road. Like when the little pop-up says, Whatever is ready for new production orders (or whatever it actually says). I haven't had a chance to test my mod to see if there are going to be prolems.

Maybe there's an easier way to do it that I'm missing. I've heard SQL makes certain things easier, but I know nothing about SQL and don't feel like learning it right now.

So basically what I'm looking for is (yes, I'm going to underline the word again) specific reasons not to do it in what is clearly (from my point of view) the easier way.

Again, thanks for your help, and please don't read any rudeness into what I've written. I don't intend for it to sound rude, but I'm always afraid it comes off that way.
 
Back
Top Bottom