Strings as print names

From Valve Developer Community
Jump to: navigation, search

All text strings from resource/*_language.txt files can be used as print names in maps for the sake of accurate localization. String names can be used by simply adding a # in front of the name, then the appropriate string. The string will then render from the localization file (tf_english.txt, tf_german.txt, etc.) in-game as that string, in the client's language.

Text strings cannot be custom-added to txt resource files over-the-server regularly.

Example: Dustbowl

cp_dustbowl in Team Fortress 2 and many other maps use strings as names for their capture points. Examples for these can be found in tf_english.txt:

"Dustbowl_cap_1_A"		"First Cap, Stage One"
"Dustbowl_cap_1_B"		"Second Cap, Stage One"
"Dustbowl_cap_2_A"		"First Cap, Stage Two"
"Dustbowl_cap_2_B"		"Second Cap, Stage Two"
"Dustbowl_cap_3_A"		"First Cap, Stage Three"
"Dustbowl_cap_3_B"		"the Rocket, Final Cap"

The map also uses strings for messages, such as:

"Dustbowl_red_setup_goal"		"Defend the Control points against team BLU!"
"Dustbowl_blue_setup_goal"		"Capture both Control Points to win the round and advance!"
"Dustbowl_red_final_goal"		"Defend the final two Control Points or the enemy will win the game!"
"Dustbowl_blue_final_goal"		"Capture the final two Control Points to win the game!"

These strings can be used on any map for any type of HUD entity that uses print names to indicate something. An example of keyvalues for this team_control_point:

Print name #Dustbowl_cap_1_A

This text would then appear in the game, if:

Played in English as First Cap, Stage One
Played in German as Eroberungsp. 1, Stufe 1
Played in Spanish as 2ª captura, etapa 1