[Include] translate.inc - Translating has never been easier!
#21

This is an excellent release. Implementing a reliable, clean and efficient solution in PAWN for localisation has always been a tricky subject for debate. However, I think this release has just changed all that! I'll most definitely be using it, thanks.
Reply
#22

Is this a part of PAWN-Boilerplate? :P
Reply
#23

Quote:
Originally Posted by TheArcher
View Post
Is this a part of PAWN-Boilerplate? :P
It's more of a backport. PAWN Boilerplate uses a "pre-preprocessor" to do the same thing, but this include uses only Pawn.
Reply
#24

Quote:
Originally Posted by Slice
View Post
It's more of a backport. PAWN Boilerplate uses a "pre-preprocessor" to do the same thing, but this include uses only Pawn.
Ye it's pretty much the same (as far as I know)...But well I'll keep using PBP.
Reply
#25

How would it knows if this players is spanish or somewhere else ? depends on what ?
Reply
#26

Quote:
Originally Posted by AnonScripter
View Post
How would it knows if this players is spanish or somewhere else ? depends on what ?
It's up to you when you want to make the players choosing their language, or just get their IP to retreive their country so the language would automaticaly switch.
Reply
#27

Quote:
Originally Posted by TheArcher
View Post
It's up to you when you want to make the players choosing their language, or just get their IP to retreive their country so the language would automaticaly switch.
impossible man -.-
i think it depends on what language he is using in GTA SAN ANDREAS
Reply
#28

Quote:
Originally Posted by AnonScripter
View Post
impossible man -.-
i think it depends on what language he is using in GTA SAN ANDREAS
It is possible. I think you don't understand this include.

Read this: https://github.com/oscar-broman/samp...samp-translate
Reply
#29

very nice inc
Reply
#30

Great work.

I'm looking forward seeing more updates!
Reply
#31

Nice! Great work
Reply
#32

Awesome!!! but how to set the language?
Reply
#33

Hey, sorry for bumping this topic, but does this still not include SendClientMessageToAll, GameTextForAll, etc? If not, can anybody recommend me a similar include for translating strings? (which would also support SendClientMessageToAll, GameTextForAll, etc)
Reply
#34

Quote:
Originally Posted by Slice
Посмотреть сообщение
It allows you to have your script in multiple languages. Say you have one spanish guy, one russian, and one canadian - this script will allow you to send messages in each respective language to them.

Normal translation scripts usually do something like define variables such as LANG_HELLO then give them values in language files ("hola", "privet", "hello").
That can get rather confusing, because the language string is not in your code - you have to look it up every time. Furthermore, you don't know what format specifiers are in it (%s, %d, etc.).

Other includes:
pawn Код:
[russian]
LANG_HELLO = "privet"
LANG_GIVEN_WEAPON = "vodka vodka %s na zdorovye %s."
[spanish]
LANG_HELLO = "hola"
LANG_GIVEN_WEAPON = "tengo much armas %s y %s."
[english]
LANG_HELLO = "hello"
LANG_GIVEN_WEAPON = "You were given a %s by %s."
pawn Код:
SendClientMessage(playerid, color, GetText(LANG_HELLO, playerid));
SendClientMessage(playerid, color, sprintf(GetText(LANG_GIVEN_WEAPON, playerid), weapon, name));
This include:
pawn Код:
// russian.lang.inc
"hello" = "privet"
"You were given a %s by %s." = "vodka vodka %s na zdorovye %s."
// spanish.lang.inc
"hello" = "hola"
"You were given a %s by %s." = "tengo much armas %s y %s."
pawn Код:
SendClientMessage(playerid, color, __("hello", playerid));
SendClientMessage(playerid, color, sprintf(__("You were given a %s by %s.", playerid), weapon, name));
I don't agree with this method. This means that you must have the exact same string both in the language file and in code. Let's suppose that you add a single character to your message in code, like an exclamation point, then you must remember to edit the language file otherwise the translation won't work.
For this reason, I think that ******'s localization system, which is basically the same system used in many other frameworks (such as Android and WPF), is a much better option.

Quote:

"vodka vodka %s na zdorovye %s."
"tengo much armas %s y %s."

lol?
Reply
#35

Quote:
Originally Posted by CONTROLA
View Post
Hey, sorry for bumping this topic, but does this still not include SendClientMessageToAll, GameTextForAll, etc? If not, can anybody recommend me a similar include for translating strings? (which would also support SendClientMessageToAll, GameTextForAll, etc)
I don't think this is a good idea, global messages should be in English and messages sent to specific players should be in their own preferred language. There would be a need to loop through players which is just useless you'll translate the message * the amount of players in game for a message as simple as "x has joined the server".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)