So in win32 is not working? Hmmm
Well, anyway, GREAT. At least we have linux support for internationalization that could atract more collaborators to the project.
Also i just have done the new commit with the mania_drive.c file internationalizated, the po scripts updated and mania_drive_i18n.c deleted.
About your idea of the implementation of the message(of the circuits) reader with i18n, can you explain a bit more?
Did you take a look the working version thath i passed you a few days ago? The code worked with msg files like this:
Code:
// Messages for beg1.msg
en=[
Welcome to ManiaDrive !
The "beginners" mode will help you to master your car,
so you can play smoothly the "Pro" mode.
];
es_ES.UTF-8=[
Bienvenido a ManiaDrive!
Los Tutoriales te ayudaran a dominar tu coche,
para que puedas jugar bien al modo profesional.
];
fr_FR.UTF-8=[
];
it_IT.UTF-8=[
];
en=[
ManiaDrive offers a challenging gameplay: the car is hard
to control, with complex physics and barrier contacts must
be avoided. The main idea is:
^0Drive clean. Speed will come after.^f
];
es_ES.UTF-8=[
ManiaDrive ofrece un juego muy competitivo: el coche es
dificil de controlar, con fisica compleja. Los quitamientos
deben evitarse. La idea es:
^0Conduce limpiamente. La velocidad vendra luego.^f
];
fr_FR.UTF-8=[
];
it_IT.UTF-8=[
];
en=[
This first track shows how "checkpoints" works:
To complete this track, you must go trough the
blue checkpoint, on the left.
];
es_ES.UTF-8=[
La primera pista muestra como van las metas:
Para completar esta pista, debes pasar por la meta
azul, a la izquierda.
];
fr_FR.UTF-8=[
];
it_IT.UTF-8=[
];
en=[
You must complete this track in less than 20 seconds.
];
es_ES.UTF-8=[
Debes completar la pista en menos de 20 segundos.
];
fr_FR.UTF-8=[
];
it_IT.UTF-8=[
];
In this way you can evade the problems of simplify languages too much with 2 letters. In fact es_ES and es_AR are slightly different (the word "coger" is "take" and "fuck" respectively in each language). Well we could remove the UTF8, that will be always repeated
The interesting part of the code is the ShowMessage function:
Code:
void showMessage(char *file, int id)
{
int handle;
FILE *fp;
int count;
signed char found=0;
int lines[32]; // start index of each line
int ret;
char var[RAYDIUM_MAX_NAME_LEN];
char val_s[RAYDIUM_GUI_DATASIZE];
float val_f[10];
int size;
raydium_gui_window_delete_name("menu");
fp=raydium_file_fopen(file,"rt");
if(fp)
{
count=0;
while( (ret=raydium_parser_read(var,val_s,val_f,&size,fp))!=RAYDIUM_PARSER_TYPE_EOF)
{
//if(!strcasecmp(var,"en"))
if(!strcasecmp(var,setlocale(LC_MESSAGES,"")))
{
if(ret!=RAYDIUM_PARSER_TYPE_RAWDATA)
{
raydium_log("message is wrong type, must be RAWDATA.");
continue;
}
if(count!=id)
{
count++;
continue;
}
found=1;
break;
}
}
fclose(fp);
} // fp was ok
if(found)
{
int nlines=0;
int i;
int start=0;
int len;
float width;
float heigth;
int mx;
len=strlen(val_s);
mx=0;
for(i=0;i<len;i++)
if(val_s[i]=='\n')
{
val_s[i]=0;
lines[nlines]=start;
if(strlen(val_s+start)>mx)
mx=strlen(val_s+start);
start=i+1;
nlines++;
}
width=mx*1.6;
heigth=(nlines+2)*5;
if(width<20) width=40;
handle=raydium_gui_window_create("menu",((float)100-width)/2,((float)100-heigth)/2,width,heigth);
raydium_gui_widget_sizes(0,0,18);
for(i=0;i<nlines;i++)
{
sprintf(var,"lbl%i",i);
raydium_gui_label_create(var,handle,50,100-((float)100/(nlines+2))*(i+1),val_s+lines[i],0.2,0,0);
}
// create button here
sprintf(var,"btnMessageOk;%i",id+1);
raydium_gui_widget_sizes(15,5,18);
id=raydium_gui_button_create(var,handle,40,100-((float)100/(nlines+2))*(i+1.5),"OK",btnMessageOk);
raydium_gui_widget_focus_name(var,"menu");
raydium_gui_show();
}
else
{
trackdata.message_file[0]=0;
raydium_osd_cursor_set(NULL,0,0); // hide mouse cursor
raydium_gui_hide();
}
}
Well, i remember that the "en" messages was not supported yet in my version
![Smile :)](./images/smilies/icon_smile.gif)