10.10.2013, 15:09
(
Последний раз редактировалось Slice; 10.10.2013 в 20:25.
)
This gettext-inspired include will make it very easy to translate your your scripts!
Usage
This is what translatable code would look like:
Your translation file will now look like this:
To translate it, simply change the right side:
I don't get it.. explain more?
http://forum.sa-mp.com/showpost.php?...2&postcount=10
Advanced usage
You can go very far with this. You can use the strings pretty much anywhere.
Planned features
No matter how many strings you have, this include will not be any slower. It scans the AMX code on startup and modifies it to look for the translated string in an array.
There's not even a function being called when you use __("string", playerid)!
Compatibility
It works on Windows and Linux with or without the JIT plugin.
Download
More info: https://github.com/oscar-broman/samp...samp-translate
GitHub: https://github.com/oscar-broman/samp-translate
Usage
This is what translatable code would look like:
pawn Код:
// If the player's language is set to spanish, this message will be sent in spanish.
SendClientMessage(playerid, color, __("Hello! How are you?", playerid));
pawn Код:
"Hello! How are you?" = "Hello! How are you?"
pawn Код:
"Hello! How are you?" = "Hola! їCуmo estбs?"
http://forum.sa-mp.com/showpost.php?...2&postcount=10
Advanced usage
You can go very far with this. You can use the strings pretty much anywhere.
pawn Код:
SendClientMessage(playerid, color, sprintf(__("You just bought %d gold for $%d.", playerid), gold, money));
- Make a _ macro that automatically knows which playerid it's sending to.
- SendClientMessageToAll, GameTextForAll, etc.
No matter how many strings you have, this include will not be any slower. It scans the AMX code on startup and modifies it to look for the translated string in an array.
There's not even a function being called when you use __("string", playerid)!
Compatibility
It works on Windows and Linux with or without the JIT plugin.
Download
More info: https://github.com/oscar-broman/samp...samp-translate
GitHub: https://github.com/oscar-broman/samp-translate