Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7245

Does not load resource file for internationalization when running Dojo project in Cordova on Windows 8 platform.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.5.0
    • None
    • cordova-windows
    • None
    • Dojo project in Cordova on Windows 8 platform

    Description

      We are trying to prototype the project using Dojo+Cordova.
      It is working really well on Android and iOS platforms but having an internationalization issue when we run a Windows 8 version. We are targeting tablets.
      In particular on Windows 8 platform when we run an app in Visual Studio 2013 it does not return the resource file for internationalization. To be more precise it is returning object in a Dojo doLoad function in i18n.js but it is empty  There is no Root element in the object.

      index.js file
      var app = {
      // Application Constructor
      initialize: function()

      { this.bindEvents(); }

      ,
      // Bind Event Listeners
      //
      // Bind any events that are required on startup. Common events are:
      // 'load', 'deviceready', 'offline', and 'online'.
      bindEvents: function()

      { document.addEventListener('deviceready', this.onDeviceReady, false); }

      ,
      // deviceready Event Handler
      //
      // The scope of 'this' is the event. In order to call the 'receivedEvent'
      // function, we must explicitly call 'app.receivedEvent(...);'
      onDeviceReady: function() {
      app.receivedEvent('deviceready');
      console.log('In onDeviceReady');
      require(["dojo", "dojo/i18n"],
      function () {
      require(["dojo/i18n!./js/nls/tdresourse.js", "dojo/domReady!"],
      function (tdresourse)

      { console.log('In require tdresourse=' + tdresourse); console.log('In require tdresourse.mainMsg=' + tdresourse.mainMsg); var mainView = document.getElementById("output"); mainView.innerText = tdresourse.mainMsg; }

      );
      });
      },
      // Update DOM on a Received Event
      receivedEvent: function(id)

      { var parentElement = document.getElementById(id); var listeningElement = parentElement.querySelector('.listening'); var receivedElement = parentElement.querySelector('.received'); listeningElement.setAttribute('style', 'display:none;'); receivedElement.setAttribute('style', 'display:block;'); console.log('Received Event: ' + id); }

      };

      index.html file
      <!DOCTYPE html>
      <html>
      <head>
      <meta charset="utf-8" />
      <meta name="format-detection" content="telephone=no" />
      <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
      <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
      <link rel="stylesheet" type="text/css" href="css/index.css" />
      <meta name="msapplication-tap-highlight" content="no" />
      <title>Hello World</title>
      <script data-dojo-config="isDebug: false, async: true, parseOnLoad: true, mblHideAddressBar: false" src="dojo/dojo.js" type="text/javascript"></script>
      </head>
      <body>
      <div class="app">
      <h1>Apache Cordova</h1>
      <div id="deviceready" class="blink">
      <p class="event listening">Connecting to Device</p>
      <p class="event received">Device is Ready</p>
      </div>
      <div id="output">Test</div>
      </div>
      <script type="text/javascript" src="cordova.js"></script>
      <script type="text/javascript" src="js/index.js"></script>
      <script type="text/javascript">
      app.initialize();
      </script>
      </body>
      </html>

      Attachments

        Activity

          People

            purplecabbage Jesse MacFadyen
            flower Olga Rudchenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: