none
Bing map ajax v7 chinese language map can't load RRS feed

  • Question

  • Hi

    we are using bing maps ajax v7 we load it as following with the language user selected

    <script src="//ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&mkt=

    <%=System.Threading.Thread.CurrentThread.CurrentUICulture.Name %>"></script>

    if we choose Chinese which ajax 7 doesn't support then map doesn't load.

    I have tried to load map conditionally but what ever I tried didn't work.

    For example if I try following it loads script but translation doesn't work

    <script>


           

    varcurrentUIcultureName = '<%= System.Threading.Thread.CurrentThread.CurrentUICulture.Name %>';

           

    varcurrentUIcultureLCID = '<%= System.Threading.Thread.CurrentThread.CurrentUICulture.LCID %>';

           

    functiongetCulture() {

               

    if(currentUIcultureLCID != "zn-cn") returncurrentUIcultureLCID;

               

    elsereturn'en-US';

            }

       

    </script>

    <script src="//ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&mkt=javascript:return getCulture()"></script>

    I tried to load with jquery getscript method and also I tried to get script and add to document.header.child

    In each case I think it just loads en-US regardless of culture I am trying to load it.

    -cn)?

    If you can't support it I want to be able to load it at least with en-us for only Chinese and normal for others.

    Could you please give me the solution I have lost days searching .

    When I tracked down the error it happens in veapicore.js Unable to get property 'activating' of undefined or null reference AT i.activating()

    it happens when it tries to activate it.

    Thanks

    Reside Ozsoy


    software developer



    • Edited by resideozsoy Wednesday, June 11, 2014 3:03 PM
    Wednesday, June 11, 2014 2:42 PM

Answers

  • You can find a list of the supported cultures here: http://msdn.microsoft.com/en-us/library/gg427600.aspx Using any other culture may not work correctly. If you use a non-documented culture, most of the time the map will default to en-US. In fact trying "zn-cn" which is not a valid culture code in any system does cause the map to load in the en-US version of the map. Currently there are two Chinese culture codes that are documented: zh-HK and zh-TW

    http://rbrundritt.wordpress.com

    Wednesday, June 11, 2014 6:25 PM
  • It's also worth mentioning that your URL to the map control is missing "https".

    http://rbrundritt.wordpress.com

    Wednesday, June 11, 2014 6:26 PM
  • Actually maps in China are heavily regulated. Most online map providers are blocked in China. Bing Maps isn't and actually has decent maps available when inside the Chinese firewall. However making those maps globally available is a bit of a nightmare. We have been working on this and will hopefully be able to make this available in the future.

    http://rbrundritt.wordpress.com

    Thursday, June 12, 2014 5:58 PM

All replies

  • You can find a list of the supported cultures here: http://msdn.microsoft.com/en-us/library/gg427600.aspx Using any other culture may not work correctly. If you use a non-documented culture, most of the time the map will default to en-US. In fact trying "zn-cn" which is not a valid culture code in any system does cause the map to load in the en-US version of the map. Currently there are two Chinese culture codes that are documented: zh-HK and zh-TW

    http://rbrundritt.wordpress.com

    Wednesday, June 11, 2014 6:25 PM
  • It's also worth mentioning that your URL to the map control is missing "https".

    http://rbrundritt.wordpress.com

    Wednesday, June 11, 2014 6:26 PM
  • Hi,

    I know it is not valid. But instead of loading it en-US it fails to load the map.

    I have been trying to load it conditionally but it doesn't work.

    If you look at my code above I am trying to change it with java script but than it loads en-us for all languages so translation doesn't work. I have checked my java script return correct code for all the languages.

    Thanks


    software developer

    Thursday, June 12, 2014 8:19 AM
  • It dynamically adds http or https for each environment.

    software developer

    Thursday, June 12, 2014 8:20 AM
  • Look at the rendered html and find out what the script tag looks like in your code. Make sure it has https and a culture specified.

    http://rbrundritt.wordpress.com

    Thursday, June 12, 2014 8:35 AM
  • Hi

    I have fixed the issue java script in the script tag wasn't working. Now I am using document.write with this I have loaded one of the Chinese instead of simplified.

    However it is not professional saying that we don't have Chinese simplified but we have Taiwan instead.

    Microsoft needs to fix this as soon as possible.

    Another this it doesn't translate the labels on the map. City names etc.. still English. Do you know why would it happen?

     <script>
            var currentUIcultureName = '<%= System.Threading.Thread.CurrentThread.CurrentUICulture.Name %>';
            var currentUIcultureLCID = '<%= System.Threading.Thread.CurrentThread.CurrentUICulture.LCID %>';
            function getCulture() {
                if ( currentUIcultureName != 'zh-CN') return currentUIcultureName;
                else return 'zh-HK'//set Chinese – Hong Kong zh - HK   since chinese simplified is not supported or(Chinese - Taiwan zh - TW ) 'en-US';
            }
            var mapLanguage = getCulture();
            // if (currentUIcultureName != "zn-cn" || currentUIcultureName != 'zh-CN') mapLanguage = currentUIcultureName;
            // else mapLanguage = 'en-US';
            var mapURL = '<script src="//ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&mkt=' + mapLanguage + '"></' + 'script>'
            //document.write('<script src="//ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&mkt=it-it"></' + 'script>');
            document.write(mapURL);
            // if (currentUIcultureLCID != "zn-cn")  document.write('<script src="//ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&mkt=en-us"></' + 'script>');
            //   else document.write('<script src="//ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&mkt=en-us"></' + 'script>');
        </script>


    software developer

    Thursday, June 12, 2014 10:07 AM
  • Actually maps in China are heavily regulated. Most online map providers are blocked in China. Bing Maps isn't and actually has decent maps available when inside the Chinese firewall. However making those maps globally available is a bit of a nightmare. We have been working on this and will hopefully be able to make this available in the future.

    http://rbrundritt.wordpress.com

    Thursday, June 12, 2014 5:58 PM