Translations:Development/73/en: Difference between revisions

From DDraceNetwork
FuzzyBot (talk | contribs)
Importing a new version from external source
 
FuzzyBot (talk | contribs)
Importing a new version from external source
 
Line 1: Line 1:
=== Translating text in the client ===
===Translating text in the client===
<code>Localize</code> can be used in the game client to get the translation for a specific string from the language file selected by the user.<syntaxhighlight lang="cpp">
<code>Localize</code> can be used in the game client to get the translation for a specific string from the language file selected by the user.<syntaxhighlight lang="cpp">
DoButton(..., Localize("Connect"), ...);
DoButton(..., Localize("Connect"), ...);

Latest revision as of 17:29, 4 May 2024

Information about message (contribute)
This message has no documentation. If you know where or how this message is used, you can help other translators by adding documentation to this message.
Message definition (Development)
===Translating text in the client===
<code>Localize</code> can be used in the game client to get the translation for a specific string from the language file selected by the user.<syntaxhighlight lang="cpp">
DoButton(..., Localize("Connect"), ...);
</syntaxhighlight>The string can also contain format specifiers. The translated string must contain the same format specifiers.<syntaxhighlight lang="cpp">
char aBuf[128];
str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers"), NumServers, TotalServers);
</syntaxhighlight>A script is used to scan the code for calls to <code>Localize</code> and collect the strings to update the translation files. For this reason, the call to <code>Localize</code> must not contain any other code, or the script cannot determine the text correctly.<syntaxhighlight lang="cpp">
// Do NOT do this:
const char *pStr = Localize(Team == TEAM_RED ? "Red team" : "Blue team");

Translating text in the client

Localize can be used in the game client to get the translation for a specific string from the language file selected by the user.

DoButton(..., Localize("Connect"), ...);

The string can also contain format specifiers. The translated string must contain the same format specifiers.

char aBuf[128];
str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers"), NumServers, TotalServers);

A script is used to scan the code for calls to Localize and collect the strings to update the translation files. For this reason, the call to Localize must not contain any other code, or the script cannot determine the text correctly.<syntaxhighlight lang="cpp">

// Do NOT do this: const char *pStr = Localize(Team == TEAM_RED ? "Red team" : "Blue team");