Translate your scripts easily!
- Get amx_assembly and strlib.
#include <translate>
- Create the translation file in the
scriptfiles
directory. - Load the language:
g_LangSwedish = LoadLanguage("swedish.lang.inc");
- Set a player's language:
SetPlayerLanguage(playerid, g_LangSwedish);
- Send translated messages to the player:
SendClientMessage(playerid, color, __("hello!", playerid));
- Run the server to automatically fill the translation file after you used
__
.
The translation files look like this:
"original text 1" = "translated text 1"
"original text 2" = "translated text 2"
"original text 3" = "translated text 3"
- Make a
_("string")
macro that doesn't require aplayerid
every time. Automatically figure out the current player by setting it in hooked callbacks,SendClientMessage
, etc. - Your suggestion!