Translations:Development/73/zh

From DDraceNetwork
Revision as of 05:50, 30 July 2023 by Darkh (talk | contribs) (Created page with "=== 在客户端翻译文本 === <code>Localize</code> 用于在游戏客户端从用户选定的语言文件中获取特定字串的翻译。<syntaxhighlight lang="cpp"> DoButton(..., Localize("Connect"), ...); </syntaxhighlight>字符串可以包含格式说明符,翻译文本必须包含同样的格式说明符(这可能产生某些排序不一致的问题)。<syntaxhighlight lang="cpp"> char aBuf[128]; str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers")...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

在客戶端翻譯文本

Localize 用於在遊戲客戶端從用戶選定的語言文件中獲取特定字串的翻譯。

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

字符串可以包含格式說明符,翻譯文本必須包含同樣的格式說明符(這可能產生某些排序不一致的問題)。

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

在調用Localize時依靠一個腳本來掃描識別調用代碼,然後收集字符串上傳翻譯文件。由於此原因,調用Localize 不能包含任何其他代碼,否則腳本無法正確識別文本。<syntaxhighlight lang="cpp">

// 請勿這樣做: const char *pStr = Localize(Team == TEAM_RED ? "Red team" : "Blue team");