SA-MP Forums Archive
[Include] translate.inc - Translating has never been easier! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] translate.inc - Translating has never been easier! (/showthread.php?tid=468821)

Pages: 1 2


Re: translate.inc - Translating has never been easier! - Jay_ - 15.10.2013

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.


Re: translate.inc - Translating has never been easier! - TheArcher - 15.10.2013

Is this a part of PAWN-Boilerplate? :P


Re: translate.inc - Translating has never been easier! - Slice - 15.10.2013

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.


Re: translate.inc - Translating has never been easier! - TheArcher - 15.10.2013

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.


Re: translate.inc - Translating has never been easier! - AnonScripter - 12.01.2014

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


Re: translate.inc - Translating has never been easier! - TheArcher - 12.01.2014

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.


Re: translate.inc - Translating has never been easier! - AnonScripter - 14.01.2014

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


Re: translate.inc - Translating has never been easier! - iZN - 15.01.2014

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


Re: translate.inc - Translating has never been easier! - LMagnifico - 15.01.2014

very nice inc


Re: translate.inc - Translating has never been easier! - Djole1337 - 14.06.2014

Great work.

I'm looking forward seeing more updates!


Re: translate.inc - Translating has never been easier! - Chilli9434 - 14.06.2014

Nice! Great work


Re: translate.inc - Translating has never been easier! - Segura - 21.07.2014

Awesome!!! but how to set the language?


Re: translate.inc - Translating has never been easier! - CONTROLA - 04.04.2019

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)


Re: AW: translate.inc - Translating has never been easier! - Sasino97 - 04.04.2019

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?


Re: translate.inc - Translating has never been easier! - Variable™ - 04.04.2019

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".