Creating localized strings for your jump map

Tutorials for Call of Duty 2 mapping

Moderator: Core Staff

Post Reply
User avatar
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Creating localized strings for your jump map

Post by Rezil » December 13th, 2012, 7:49 pm

Creating localized strings for your jump map

Localized files are used because they concentracte all of the game data that's language(or region/country) specific and allow the developers to edit those files accordingly based on the language. In Call of Duty 2, all the localized strings are located at *.iwd/localizedstrings/.

To add a localized string to your map, you need to create a localized string file in the above location. The name has to be unique, otherwise it might overwrite already existing localized files. I would suggest to prefix it with your map name, then add an identifier at the end. The localized string files are simple renamed .txt files. The file extension is .str.

After you've created your blank localized string file(which should be at *.iwd/localizedstrings/<locstrfilename>.str), you should first paste this code into it:

Code: Select all

VERSION             "1"
CONFIG              "C:\trees\cod2\bin\StringEd.cfg"
FILENOTES           "You can add your own notes here"

LANG_ENGLISH        " "
The first three lines are kept for consistency(IW used them in all of their loc string files), the important part is what's after that.

Each localized string is composed of a reference and the various languages it's translated to. We'll be using LANG_ENGLISH because it's (probably) the default and the language most people use with their CoD2. The reference has to be unique to your localized file, which means it's ok to use the same reference name in two different localized string files, but not in the same file if it's already defined. You can add strings to this file using the template for the blank string above:

Code: Select all

LANG_ENGLISH        "Hello world, I am a localized string!"
When all of your localized strings have been added, use

Code: Select all

to tell the compiler that there are no more localized strings left in this file.

All localized strings you're planning on using have to be precached(loaded) before they can be used. To precache a localized string, call:

Code: Select all

Note that the string has to be in all caps. For example, if my localized file name was called mp_test_utils.str and I wanted to precache the above HELLO_WORLD string, I would call precacheString as

Code: Select all

To use your localized string, simply use the same syntax as when precaching. Note the &, this indicates that this is a localized string, and not a string internal to the code. All outputs(iprintlnbold, setText on HUD elements, objectives in SP etc.) are localized. If nothing else, this tutorial shows you how to get rid of the annoying warning in your console output that 'all strings must be localized'! :)

This is part 1 of a bigger tutorial series, stay tuned for some even more interesing stuff in the near future!
Drofder2004: Drofder's rules for reviewing a map
#5 If your name is Rezil, minimum 5/5.
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Creating localized strings for your jump map

Post by Drofder2004 » December 15th, 2012, 5:59 pm

You should add the use of variables inside localised strings (&&1, etc) as they are very useful for dynamic content. (Unless that is part 2?)
Either well, its nicely explained.

(Add =cod for the bottom code boxes?)
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests