zoukankan      html  css  js  c++  java
  • 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
    转载请保留此信息。
  • 相关阅读:
    C#图片无损压缩
    as3.0 动态文本属性大全
    卡​马​克​卷​轴​算​法​研​究​_​地​图​双​缓​冲
    春卷活动心得
    移动端videojs视频插件使用直播流rtmp、hls、http-flv的注意事项
    在Windows2008系统中利用IIS建立FTP服务器
    winform 窗体自适应 根据新窗体大小按比例放缩
    HTTPS抓包
    数据库 事物 锁
    sql 事物 锁 快照(转发的,写的非常好)
  • 原文地址:https://www.cnblogs.com/junqilian/p/1779079.html
Copyright © 2011-2022 走看看