Translations:Development/73/fr: Difference between revisions

From DDraceNetwork
(Created page with "=====Traduction du texte dans le client=== <code>Localize</code> peut être utilisé dans le client du jeu pour obtenir la traduction d'un texte spécifique à partir du fichier de langue sélectionné par l'utilisateur. <syntaxhighlight lang="cpp"> DoButton(..., Localize("Connect"), ...); </syntaxhighlight> Le texte peut également contenir des spécificateurs de format. La chaîne traduite doit alors contenir les mêmes spécificateurs de format. <syntaxhighlight lang=...")
 
No edit summary
 
Line 1: Line 1:
=====Traduction du texte dans le client===
===Traduction du texte dans le client===
<code>Localize</code> peut être utilisé dans le client du jeu pour obtenir la traduction d'un texte spécifique à partir du fichier de langue sélectionné par l'utilisateur.
<code>Localize</code> peut être utilisé dans le client du jeu pour obtenir la traduction d'un texte spécifique à partir du fichier de langue sélectionné par l'utilisateur.
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">

Latest revision as of 17:02, 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");

Traduction du texte dans le client

Localize peut être utilisé dans le client du jeu pour obtenir la traduction d'un texte spécifique à partir du fichier de langue sélectionné par l'utilisateur.

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

Le texte peut également contenir des spécificateurs de format. La chaîne traduite doit alors contenir les mêmes spécificateurs de format.

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

Un script est utilisé pour chercher dans le code les appels à Localize et collecter les chaînes de caractères pour mettre à jour les fichiers de traduction. Pour cette raison, l'appel à Localize ne doit pas contenir d'autre code, sinon le script ne peut pas déterminer le texte correctement. <syntaxhighlight lang="cpp"> // Ne faites PAS ça : const char *pStr = Localize(Team == TEAM_RED ? "Red team" : "Blue team");