Author Topic: Chinese Language Support (utf8/unicode)  (Read 3440 times)

cds

  • Guest
Chinese Language Support (utf8/unicode)
« on: 2 May 2010, 09:05:27 »
Could someone build a the game for Chinese ,this is what we can change:(I can't build the game)
HFONT hFont=CreateFont(size, 0, 0, 0, width, 0, FALSE, FALSE, GB2312_CHARSET,
      OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DRAFT_QUALITY, DEFAULT_PITCH, type.c_str());
When you finish it ,please send the .exe file to chenlifengnuaa@163.com.
Thank you!

cds

  • Guest
Chinese Language Support (utf8/unicode)
« Reply #1 on: 3 May 2010, 01:54:00 »
For chinese ,we should change as below:
in sdl/gl_wrap
lf.lfCharSet = GB2312_CHARSET;

HFONT font= CreateFont(
      size, 0, 0, 0, width, FALSE, FALSE, FALSE, GB2312_CHARSET,
      OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
      DEFAULT_PITCH| (useRealFontName.c_str() ? FF_DONTCARE:FF_SWISS), useRealFontName.c_str());

BOOL err= wglUseFontBitmapsw(dc, 0, 30000, base);//charCount=30000
in graphics/font_d3d9.cpp
HFONT hFont=CreateFont(size, 0, 0, 0, width, 0, FALSE, FALSE, GB2312_CHARSET,
      OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DRAFT_QUALITY, DEFAULT_PITCH, type.c_str());
in graphics/font.cpp
const int Font::charCount= 30000;
Font::Font(){
   inited= false;
   type= "宋体";
   width= 400;
}
it may work!

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #2 on: 3 May 2010, 03:22:05 »
Chinese version of you, you really can achieve, Oh, man, this is really cool! To cut a game screen you???
By the way: My brother just need a Chinese version of glest, his English is not good!

By the way: My brother just need a Chinese version of glest, his English is not good!

Hi, Softcoder! Can provide a Chinese version of the language file, such as: chinese.lng

Or to become the Chinese version of glest??? Haha, I just BTW, I am out of my brother's personal circumstances into account!
I do not know how could he bring glest into Chinese.
« Last Edit: 3 May 2010, 04:51:07 by tom123 »

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #3 on: 3 May 2010, 05:16:41 »
Yes I'll try to add the changes into the 3.3.5 dev release (working on it now).

Could somone translate the english.lng file in their Mega-Glest folder to Chinese so that we can "try" to offer native support in Mega-Glest?

EDIT: The code in SVN has the changes mentioned below. To enable experimental Chinese support, build the Windows version of Mega-Glest using the latest SVN code and edit your glest.ini file and add this:

FONT_CHARCOUNT=30000
FONT_TYPENAME=宋体
FONT_CHARSET=134

If anyone has the chance, let me know if this works? You need to have the Chinese locale and fonts installed for this to work in Windows.
« Last Edit: 3 May 2010, 06:30:42 by softcoder »

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #4 on: 3 May 2010, 07:47:14 »
Hi, Softcoder! My brother to do the test (for now SVNl code inside a compiler, has been glest.exe), but found the menu options the game is still in English, maybe he really needs a chinese.lng file Can you provide a copy of, thank you!
My brother's operating system is XP 32bit Chinese
By the way: he glest.ini file which adds:

FONT_CHARCOUNT = 30000

FONT_CHARSET = 134

FONT_TYPENAME = Times New Roman
« Last Edit: 3 May 2010, 07:56:28 by tom123 »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Chinese Language Support (utf8/unicode)
« Reply #5 on: 3 May 2010, 09:11:35 »
Does MG support unicode in langfiles yet?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #6 on: 3 May 2010, 11:47:59 »
No, It does not support! It can identify the encoding format is ANSI .  But my brother needed a chinese.lng!
« Last Edit: 3 May 2010, 11:59:07 by tom123 »

cds

  • Guest
Chinese Language Support (utf8/unicode)
« Reply #7 on: 3 May 2010, 13:51:21 »
This is a chinese.lng  .charset is GB2312_CHARSET,there are many word in Chinese ,at least 5000 needed.Also ,we need to change single byte to multibyte.I can help to test it.my email is chenlifengnuaa@163.com .I need only the .exe file.If there is any problem about chinese ,please tell me!
Thank you !If we succeed ,more chinese people will play this game!

; chinese lang file

;Main strings
3dArt=3D a艺术
3dAnd2dArt=3D 和 2D 艺术
2dArtAndWeb=2D 艺术和网络
About=关于
Address=地址
AlreadyUpgraded=已经更新
All=所有
AmbientVolume=Ambient Volume
Animation=动画
Armor=防御力
Attack=攻击
AttackDistance=攻击距离
AttackSpeed=攻击速度
AttackStopped=停止攻击
AttackStrenght=毁灭
AutoConfig=自动确认
BattleOver=战斗结束
Build=建造
BuildSpeed=建造速度
BuildingNoPlace=建筑物不能建在哪里
BuildingNoReqs=建筑物不满足需求
BuildingNoRes=没有足够的资源建造建筑
Built=建好了
CameraModeSet=视图模式设置到
CanRepair=可以修复
Cancel=取消
Canceled=取消了
ChatMode=聊天模式
Closed=关闭了
Command=命令
CommonCommand=普通命令
Connect=连接
Connected=连接好
ConnectedToServer=连接到服务器
Consume=消费
Control=控制
Cpu=CPU
CpuUltra=CPU (Ultra)
CustomGame=自定义
Deaths=死亡
Defeat=击败
Deleting=正在删除
Difficulty=难度
Difficulty0=很容易
Difficulty1=容易
Difficulty2=中等
Difficulty3=éš¾
Difficulty4=很难
Difficulty5=极难
Disabled=关闭的
Disable=关闭
Disconnect=脱离连接
Discount=Discount
Ep=EP
EpCost=EP 消耗
Exit=退出
ExitGame?=退出游戏?
Faction=种族
Fast=å¿«
Fields=区域
Filter=过滤
FreeCamera=自由
FxVolume=音量
GameCamera=游戏快照
GameMusic=游戏音乐
GamePaused=游戏暂停
GameResumed=游戏恢复
GameSpeedSet=游戏速度设置
Harvest=收获
HarvestSpeed=收获速度
Hp=生命值
Human=人
Initializing=初始化中
InvalidOrder=命令不可用
InvalidPosition=位置不可到达
Kills=杀死
JoinGame=加入游戏
Language=语言
LinuxPort=linux端口
Load=加载
LoadedSpeed=加载速度
Loading=加载中
Map=地图
MaxFilterAnisotropy=Max Filter Anisotropy
MaxLights=最大灯光数
MaxLoad=最大加载
MaxPlayers=最多玩家
MeetingPoint=会和地点
Morph=升级
MorphSpeed=升级速度
Move=移动
MusicVolume=音量
Network=网络
NewGame=新游戏
No=否
NotConnected=为连接
None=没有
Normal=普通
Of=Of
Ok=好
Options=选项
OrdersOnQueue=Orders on queue
Play=玩
PlayNow=开始玩!
Player=玩家
Port=端口
Produce=生产
Producing=生产中
ProductionSpeed=生产速度
Programming=编程
Projected=Projected
ReactionSpeed=反应速度
Regeneration=æ›´æ–°
Repair=修复
RepairSpeed=修复速度
Reqs=需求
Resources=资源
ResourcesHarvested=资源收获
Result=结果
Return=返回
Scenario=脚本
Score=得分
Server=服务器
ServerType=服务器类型
ServerTypeNew=æ–°çš„
ServerTypePrevious=先前的
ShadowMapping=阴影地图
Shadows=阴影
Sight=视力
Size=大小
Slow=慢的
SomeOrdersFailed=一些命令不能给出
SoundAndMusic=声音和音乐
SplashRadius=扩散半径
StartingToUpgrade=开始升级
Stop=停止
Store=存储
Tip=指点
Team=组
TechTree=科技树
Textures3D=3D 文本
Tileset=标题设置
Tutorial=教学任务
UnitAddedToProductionQueue=单元增加到生产队列
UnitNoPlace=不能放置单元
UnitNoReqs=不满足单元生产条件
UnitNoRes=没有足够的资源生产此单元
UnitReady=单元好了
UnitsProduced=单元生产好了
Upgrade=升级
UpgradeNoReqs=升级不满足条件
UpgradeNoRes=没有足够资源进行升级
UpgradeSpeed=升级速度
Upgrades=升级
Upgrading=升级中
Victory=取胜
WalkSpeed=行走速度
WaitingHost=等候服务器发起游戏
Yes=是
YouLose=你输了!
YouWin=你赢了!
FONT_CHARCOUNT=30000
FONT_TYPENAME=宋体
FONT_CHARSET=134

ultifd

  • Airship
  • ********
  • Posts: 4,443
  • The Glest Video Guy :) The one and only. :P
    • View Profile
    • My Youtube Channel
Chinese Language Support (utf8/unicode)
« Reply #8 on: 4 May 2010, 00:02:37 »
Yeah I tried it, does not work, because when you save the .lng file, you have to save in unicode...and...yeah  :(
at least this is related to the other thread  :thumbup:

cds

  • Guest
Chinese Language Support (utf8/unicode)
« Reply #9 on: 4 May 2010, 00:22:54 »
This needs an operating system for China.And the fonttype must exist in this os.We should change other code.Some about support for Chinese,some about read the .lng file as byte stream,some about show the string not in ansi mode but in double byte mode.Unicode is not right for Chinese ,it is GB2312 standard.

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #10 on: 4 May 2010, 00:33:17 »
I think this issue will be resolved because the only matter of time!

cds

  • Guest
Chinese Language Support (utf8/unicode)
« Reply #11 on: 4 May 2010, 04:49:37 »
Chinese word begins with 1,but english begins with 0.I think maybe wchar_t works!Could someone send your glest.exe to me,I want to test it!

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #12 on: 4 May 2010, 06:23:28 »
After reading a lot on how C / C++ dealk with Chinese (And other multibyte languages) the solution isn't fast and easy.

We'll need to:

1. Save language files in UTF8
2. Read in language files using wstring
3. convert wstring to something (perhaps unicode) when creating the Fonts
4. Who knows what else.

I have a few libraries that supposedly wrap all this work, but I don't want to make MG much larger just for the sake of supporting multi-byte, so we shall see.

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #13 on: 4 May 2010, 06:28:07 »
我不觉得是什么字体编码问题导致不能显示中文字符,而在于对应关系!汉字是双字节编码的,而英文等语言的字母是单字节编码的,游戏应该是默认单字节读取,导致每一个汉字都被当做两个字来读取或输出,自然显示不出来!这个问题应该不只是中文的问题,多字节编码的语言都会遇到这个问题!

English meaning:

I do not think that is what caused the font encoding can not display Chinese characters, but in the correspondence! Double-byte character encoding, but English is the language of the letter is single-byte encoding, the game should be the default single-byte read, resulting in each character as two words have been read or the output, naturally not show up! This question should be not only of Chinese, multi-byte code language will encounter this problem!

ultifd

  • Airship
  • ********
  • Posts: 4,443
  • The Glest Video Guy :) The one and only. :P
    • View Profile
    • My Youtube Channel
Chinese Language Support (utf8/unicode)
« Reply #14 on: 4 May 2010, 06:44:17 »
Quote
multi-byte code language will encounter this problem!
Yeah...but cds already stated in a older post so...  :|
But I guess this will be hard...to uh...solve  :|

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #15 on: 4 May 2010, 06:47:28 »
I think the strong Softcoder should solve the problem as soon as possible, he will surprise us all, he is a genius!

Hi, Softcoder! If I said something wrong, I apologize to you, thank you!
« Last Edit: 4 May 2010, 06:51:16 by tom123 »

ultifd

  • Airship
  • ********
  • Posts: 4,443
  • The Glest Video Guy :) The one and only. :P
    • View Profile
    • My Youtube Channel
Chinese Language Support (utf8/unicode)
« Reply #16 on: 4 May 2010, 08:09:41 »
Well, someday...
Quote
1. Save language files in UTF8
I guess that is the easy part.
Quote
4. Who knows what else.
Yeah,
everyone,
research...  

Quote
but I don't want to make MG much larger just for the sake of supporting multi-byte
that's true...  

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Chinese Language Support (utf8/unicode)
« Reply #17 on: 4 May 2010, 11:16:22 »
The question is always so difficult, but as long as we wait patiently, we believe Softcoder will solve these problems, thank you!

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Chinese Language Support (utf8/unicode)
« Reply #18 on: 26 May 2011, 23:30:20 »
One year later we are coming closer :)

see here: https://forum.megaglest.org/index.php?topic=7232.msg73935#msg73935
« Last Edit: 4 June 2011, 05:28:28 by softcoder »

 

anything