Localization of MapGuide Enterprise 2011 and a fix for Search command in Ajax viewer


There are so many languages in the world, but MapGuide Enterprise is provided in only a few languages. I think many developers are trying to localize it to make it more user friendly.

Here are the basic steps to localize MapGuide Enterprise:

 

1. Prepare the resource file, which locates at C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\www\localized by default.

2. Copy the file en to a new one named as zh for Chinese, fr for France, for example. Put it into the same directory. Please be note that this is NO extension for this file.

3. Open the copied resource file and translate the message into local language.

4. Save the file, please save it using Unicode if needed, especially for east Asian language.

5. Pass the locale parameter to the Ajax viewer.

<code_begin>

<frameset rows="0,*" border="0" framespacing="0">

<frame />

<frame src="/mapguide2011/mapviewernet/ajaxviewer.aspx?SESSION=<%= sessionId %>&WEBLAYOUT=<%= webLayout %>&Locale=zh" name="ViewerFrame" />

</frameset>

<code_end>

6. Just change the tooltip and command name in MapGuide Studio 
to localize the build-in command.

 

After that, you will notice that almost all items are localized. Sit back and have some drink! :)

But wait, it seems that the Search command is still using the English version. The “SEARCHTITILE” is not localized, always use the en version. What’s going on?!

clip_image002

 

Actually, it is a defect of MapGuide Enterprise 2011 Ajax Viewer. after some investigations, I finally found the bug out and fixed it! Here you go:

 

Problem Analysis:

searchprompt.aspx should pass the “LOCALE” parameter to search.aspx, but this parameter is missed .

 

How to fix? . Fortunately, the source code is provided, you can fix it yourself:

Pass the “LOCALE” parameter to search.aspx in searchprompt.aspx

 

C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\www\viewerfiles\searchprompt.templ,

Line 101

<input type="hidden" name="SESSION" value="%s">

<input type="hidden" name="LOCALE" value="%s"> <!—Add this line here-->

<input type="hidden" name="FILTER" value="%s">

 

C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\www\mapviewernet\searchprompt.aspx

Line 52

String[] vals = {

target.ToString(NumberFormatInfo.InvariantInfo),

popup.ToString(NumberFormatInfo.InvariantInfo),

cmdIndex.ToString(NumberFormatInfo.InvariantInfo),

clientWidth.ToString(NumberFormatInfo.InvariantInfo),

GetSurroundVirtualPath(Request) + "search.aspx",

cmdIndex.ToString(NumberFormatInfo.InvariantInfo),

target.ToString(NumberFormatInfo.InvariantInfo),

popup.ToString(NumberFormatInfo.InvariantInfo),

EscapeForHtml(layerId),

mapName,

sessionId,

locale, //Add this line here

EscapeForHtml(filter),

matchLimit.ToString(NumberFormatInfo.InvariantInfo)

};

 

File Affected:

C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\www\viewerfiles\searchprompt.templ,

C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\www\mapviewernet\searchprompt.aspx

 

Here is the test result, I localized the UI to Croatian :)

Problem solved.

clip_image002[8]

 

Cheers,

Daniel Du

DevTech, ADN

作者: 峻祁连
邮箱:junqilian@163.com 
出处: http://junqilian.cnblogs.com 
转载请保留此信息。




本文转自峻祁连. Moving to Cloud/Mobile博客园博客,原文链接:http://www.cnblogs.com/junqilian/archive/2010/07/16/1779079.html ,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值