MegaGlest Forum

Archives (read only) => Vanilla Glest => Translations => Topic started by: xiaoshao_0_0 on 16 March 2009, 09:29:53

Title: We need some hack to show UTF8 characters.
Post by: xiaoshao_0_0 on 16 March 2009, 09:29:53
Dear All:
I am new to this forum,but old player of glest.By the way, as a Chinese,my girl friend will refuse to play glest against me for the menu,hint and etc are all English or something else,not Chinese.
When I have the time to go through the source code, I found just the code cannot display a UTF8 string,actually only ASCII code can be displayed.
I have cut the code from text_render_gl.cpp.
and method of handling the string take 1 characters as 1 byte.
But actually,sometimes it takes 2 bytes or even more.
for (int i=0; utext!='\0'; ++i)
I a newbie at opengl,can somebody help to solve this issue ?
So,I also glad to be a translator for Chinese language.
Code: [Select]

for (int i=0; utext[i]!='\0'; ++i) {

switch(utext[i]){

case '\t':

rasterPos= Vec2f((rasterPos.x/size+3.f)*size, y-(size+1.f)*line);

glRasterPos2f(rasterPos.x, rasterPos.y);

break;

case '\n':

line++;

rasterPos= Vec2f(static_cast<float>(x), y-(metrics->getHeight()*2.f)*line);

glRasterPos2f(rasterPos.x, rasterPos.y);

break;

default:

glCallList(font->getHandle()+utext[i]);

}

}

Title: Re: We need some hack to show UTF8 characters.
Post by: hailstone on 14 April 2009, 03:43:43
Sorry for being so late replying to this. Can you provide a Chinese translation file so we can test any changes?
Title: Re: We need some hack to show UTF8 characters.
Post by: patz on 19 August 2010, 17:57:57
i made a very simple translation.

don't know if your browser can display this, using UTF-8.
http://pastebin.com/DqEJBbpJ

or download the language file at http://rapidshare.com/files/413919975/lang.7z
i also put a picture shows what "exit" should be like in chinese in the lang.7z, in case your os can't display it properly.

thx

btw. the lng file is in ansi format, does that matter?
Title: Re: We need some hack to show UTF8 characters.
Post by: ultifd on 19 August 2010, 18:41:14
Hi, is this for Glest or Megaglest? Don't know which, so...can't really try.
Anyways, if it works...nice.  :thumbup:
Title: Re: We need some hack to show UTF8 characters.
Post by: softcoder on 19 August 2010, 19:17:08
We already had tom123 or cds send us a Chinese lnag file but thats not good enough. I started some code changed a while back to try to get this going but there are multi-byte code issues that we need to solve all over the place so I stopped looking into it in favour of getting a stable multi-player release.

Check the forums in mega-glest and you will see how to change the character set etc.. as a start inthe glest.ini for mega-glest.

But again UTF8 is not the only thing required to support Chinese.