[Plugin] imessage - fast multilanguage strings
#1

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(playerid0xFFCC00AAimes);
    ...
    return 
1

Result:


0.3e, 0.3x, 0.3z, 0.3.7 tested




You can see the plugin in work on test servers below.
Reply
#2

Fast.. well, any benchmarks?
Reply
#3

I'll make a benchmark later, but I have nothing to compare with
Reply
#4

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.
Reply
#5

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
Reply
#6

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.
Reply
#7

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
It is something like my plugin! This is good. Let's see, but a short while later.
Reply
#8

I don't really think it was necessary a plugin for this, it could be done in pawno too.
Reply
#9

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?
Reply
#10

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.
Reply
#11

Funny thing... I posted a thread about this last week. It may help me with my server, so big thanks Bombo!
Reply
#12

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
Reply
#13

Going to use it for my server, bravo!



*applause*
Reply
#14

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
Reply
#15

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Pawno is a text editor, not the compiler
Pawn isn't a compiler either.
Reply
#16

Quote:
Originally Posted by Stewie`
Посмотреть сообщение
Pawn isn't a compiler either.
yes we know that, but did he say anything about PAWN?
Reply
#17

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.
Reply
#18

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.
Reply
#19

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.
Reply
#20

Or he could make support for multiple formats
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)