From Valve Developer Community
Jump to: navigation, search

In order to support multiple languages, most Panorama UIs are built with references to "localization tokens" instead of literal user-facing strings. These tokens are then dynamically replaced with the correct localized string depending on the user's language selection.

In your XML localization tokens are prefixed with a '#' symbol and can be used as regular text:

<Label text="#hello_message" />

When this UI is loaded, the token will be automatically replaced with a string from the corresponding localization file:

"hello_message" "Hello, world!"

Note: Unlike most content for Panorama, the localization files live in the game/ tree instead of content.

For Dota addons, localization files live here:


Dynamic data

In many cases you may have dynamic data that you need to inject into a localization string. This is achieved using "dialog variables" set on the panel that can be referenced by the localization file:


<Label id="msg" text="#MessageText" />


$("#msg").SetDialogVariable( "adjective", "favorite" );
$("#msg").SetDialogVariableInt( "number", 2 );

Localization file:

"MessageText" "My {s:adjective} number is {d:number}."
Note:If you dynamically set the text of a label from Javascript, it will NOT automatically localize the string. If you need to dynamically assign a localization token to a label, you need to localize the string in Javascript. (This technique has limited support for dialog variables.)
$( "#PanelID" ).text = $.Localize( "#LocalizationToken" );