You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Olga Rudchenko (JIRA)" <ji...@apache.org> on 2014/08/01 01:00:40 UTC

[jira] [Created] (CB-7245) Does not load resource file for internationalization when running Dojo project in Cordova on Windows 8 platform.

Olga Rudchenko created CB-7245:
----------------------------------

             Summary: Does not load resource file for internationalization when running Dojo project in Cordova on Windows 8 platform. 
                 Key: CB-7245
                 URL: https://issues.apache.org/jira/browse/CB-7245
             Project: Apache Cordova
          Issue Type: Bug
          Components: Windows 8
    Affects Versions: 3.5.0
         Environment: Dojo project in Cordova on Windows 8 platform
            Reporter: Olga Rudchenko
            Assignee: Jesse MacFadyen
            Priority: Critical


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>





--
This message was sent by Atlassian JIRA
(v6.2#6252)