imessage - fast multilanguage strings -
Bombo - 20.03.2013
imessage plugin
Author: Bombo
Version: 1.1.0
[+] speed up
This plugin allows a quick access to an unlimited number of named strings with translations in various languages.
Functions:
native init_ifile(in_filename[]); //set filename
native close_ifile(); //close file
native imessage(out_string[], in_str_name[], in_language[], size=sizeof out_string); //get string
The file must be UTF8 encoded, so strings keeps extended characters. A size of this file is unlimited (by the plugin).
Pattern:
Код:
#multilanguage message file
#pattern file for imessage v1.0.0 by Bombo
#Supported languages: "en","ru","fr","uk","es","cs","de","it","pl","tr","sr","bg","ro"
#
#Format of the name: "\n[MESSAGE_NAME]\n", where MESSAGE_NAME is latin only
#Format of the language: "\nxx {", xx - language code, contains 2 latin characters only
#Format of the end of string: "};\n", no spaces between caracters
#In the end of file: "\n\n", message lost is possible in other case (!)
#
#Encoding: UTF8
#New line: Unix
#
#File size is unlimited.
#Location: samp-server root
[HELLO_MESSAGE]
en {Set your language, please};
ru {Укажите ваш язык};
[YOUR_LANGUAGE]
en {Your language: };
ru {Ваш язык: };
es {Su idioma: };
[HELPLANG]
en {{00FF00}/lang <xx> {FFCC00}- set your language, xx: {FF0000}en,ru,es};
es {{00FF00}/lang <xx> {FFCC00}- seleccione su idioma, xx: {FF0000}en,ru,es};
ru {{00FF00}/lang <xx> {FFCC00}- укажите ваш язык, xx: {FF0000}en,ru,es};
[HELPSHOW]
en {{00FF00}/show {FFCC00}- show you language of all online players.};
es {{00FF00}/show {FFCC00}- mostrarle país y el idioma los jugadores en línea.};
ru {{00FF00}/show {FFCC00}- язык всех онлайн игроков.};
#fr {...};
[NEWLANG]
en {Your language is: };
es {Ahora su idioma: };
ru {Теперь ваш язык: };
[COMMAND_USAGE]
en {Usage: };
es {Uso: };
ru {Использование команды: };
It is strongly recommend to keep the file format.
Usage:
PHP код:
#include <a_samp>
...
#include <imessage>
...
public OnFilterScriptInit()
{
...
//set filename
init_ifile("pattern.txt");
...
return 1;
}
public OnPlayerConnect(playerid) //or any other function
{
new imes[128];
...
//get string
imessage(imes, "HELLO_MESSAGE", "en");
//set the string in any function
SendClientMessage(playerid, 0xFFCC00AA, imes);
...
return 1
}
Result:
0.3e, 0.3x, 0.3z, 0.3.7 tested
You can see the plugin in work on test servers below.
Re: imessage - fast multilanguage strings -
Gamer_Z - 20.03.2013
Fast.. well, any benchmarks?
Re: imessage - fast multilanguage strings -
Bombo - 20.03.2013
I'll make a benchmark later, but I have nothing to compare with
Re: imessage - fast multilanguage strings -
leong124 - 20.03.2013
Can this be used in non-UTF-8 clients? I use Big5 coding.
I tried Ryder's UTF-8 plugin before and it crashed the server. It's quite good to see this.
Re: imessage - fast multilanguage strings -
Bombo - 20.03.2013
This plugin was specially created for non-UTF-8 clients (because the SAMP is such client). But it needs some update to support Big5 and other codes except for windows cp: 1250, 1251, 1254 and 1252
Re: imessage - fast multilanguage strings -
Gamer_Z - 20.03.2013
Quote:
Originally Posted by Bombo
I'll make a benchmark later, but I have nothing to compare with
|
1)
http://code.******.com/p/gpb/wiki/Dy...guageSpeedTest
2)
http://gpb.******code.com/files/dynamic_lang.zip
3) test against sending normal "new strings" with format?
4) test against sending SendClientMessage(playerid,-1,"abcdef"); to see how much slower it is.
Re: imessage - fast multilanguage strings -
Bombo - 20.03.2013
Quote:
Originally Posted by Gamer_Z
|
It is something like my plugin! This is good. Let's see, but a short while later.
Re: imessage - fast multilanguage strings -
Rock - 20.03.2013
I don't really think it was necessary a plugin for this, it could be done in pawno too.
Re: imessage - fast multilanguage strings -
TheArcher - 20.03.2013
Quote:
Originally Posted by Rockk
I don't really think it was necessary a plugin for this, it could be done in pawno too.
|
Do you know that PAWN is a scripting language and PAWNO is just a compiler?
Re: imessage - fast multilanguage strings -
Bombo - 20.03.2013
Quote:
Originally Posted by Rockk
I don't really think it was necessary a plugin for this, it could be done in pawno too.
|
I don't really think you saw a code of my plugin before saying this.
Re: imessage - fast multilanguage strings -
freddy smyth - 21.03.2013
Funny thing... I posted a thread about this last week. It may help me with my server, so big thanks Bombo!
Re: imessage - fast multilanguage strings -
ReneG - 21.03.2013
Quote:
Originally Posted by TheArcher
Do you know that PAWN is a scripting language and PAWNO is just a compiler?
|
Pawno is a text editor, not the compiler
Re: imessage - fast multilanguage strings -
Dzines4SAMP - 21.03.2013
Going to use it for my server, bravo!
*applause*
Re: imessage - fast multilanguage strings -
CoaPsyFactor - 21.03.2013
Well it is nice, but its not so necessary to use
I made translate system with dini, and it is fast, and very fast, every SendClientMessage and format uses that translate system, and player can't see any lag, and it doesn't eats CPU
Re: imessage - fast multilanguage strings -
steki. - 21.03.2013
Quote:
Originally Posted by VincentDunn
Pawno is a text editor, not the compiler
|
Pawn isn't a compiler either.
Re: imessage - fast multilanguage strings -
u3ber - 21.03.2013
Quote:
Originally Posted by Stewie`
Pawn isn't a compiler either.
|
yes we know that, but did he say anything about PAWN?
Respuesta: imessage - fast multilanguage strings -
TheChaoz - 21.03.2013
Test against y_language + y_text. Looks nice, but I'd be better if the plugin allow to format the message, just like y_language + y_text does.
Re: imessage - fast multilanguage strings -
Rock - 21.03.2013
Quote:
Originally Posted by TheArcher
Do you know that PAWN is a scripting language and PAWNO is just a compiler?
|
So? Almost same thing, you understant what I meant in that reply.
Re: imessage - fast multilanguage strings -
Gamer_Z - 21.03.2013
Quote:
Originally Posted by ******
You're all wrong - Pawno is an EDITOR, PAWN is a LANGUAGE, pawncc is the COMPILER!
It already HAS been done in PAWN. Speaking of which, why use a non-standard format for your text strings? IMHO the more sensible way to get people moving to your system would be to support the formats already used by other language systems (i.e. y_languages already mentioned in this thread). If people have to convert every single one of their text files they are very unlikely to port.
|
Orr.. we will just wait for a community converter :P
jk.
Re: imessage - fast multilanguage strings -
xeeZ - 21.03.2013
Or he could make support for multiple formats