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 ,如需转载请自行联系原作者
相关文章
N..
|
6月前
|
XML JSON 前端开发
jQuery实现Ajax
jQuery实现Ajax
N..
68 1
|
6月前
|
XML 前端开发 JavaScript
jQuery中ajax如何使用
jQuery中ajax如何使用
68 0
|
6月前
|
JSON 前端开发 Java
利用Spring Boot处理JSON数据实战(包括jQuery,html,ajax)附源码 超详细
利用Spring Boot处理JSON数据实战(包括jQuery,html,ajax)附源码 超详细
149 0
|
6月前
|
敏捷开发 JavaScript 前端开发
❤❤❤【Vue.js最新版】sd.js基于jQuery Ajax最新原生完整版for凯哥API版本❤❤❤
❤❤❤【Vue.js最新版】sd.js基于jQuery Ajax最新原生完整版for凯哥API版本❤❤❤
|
5月前
|
前端开发 JavaScript
杨校老师课堂之基于Servlet整合JQuery中的Ajax进行表单提交[基于IDEA]
杨校老师课堂之基于Servlet整合JQuery中的Ajax进行表单提交[基于IDEA]
45 0
杨校老师课堂之基于Servlet整合JQuery中的Ajax进行表单提交[基于IDEA]
|
3月前
|
XML JSON 前端开发
AJAX是什么?原生语法格式?jQuery提供分装好的AJAX有什么区别?
AJAX是什么?原生语法格式?jQuery提供分装好的AJAX有什么区别?
32 0
|
3月前
|
JavaScript 前端开发
Ajax的使用(jquery的下载)
这篇文章是关于Ajax学习笔记的分享,包括JQuery的下载方式、Ajax的主要参数说明,以及如何在网页中使用Ajax进行异步请求的示例代码。