locked
loading resources in web context

    Question

  • Hello guys.

    quick question: i'm looking at scenario 12 from the application resources and localization sample. I've understood most of the rationale, but I've got a question: why do you use a global variable called strings to hold the json returned from the app? Is the use of this global variable by the WinJS resource api documented anywhere? Where did  this magic variable appeared from?

    thanks


    Luis Abreu

    Monday, May 28, 2012 1:33 PM

Answers

  • Hi,

    In the base.js file provided by the SDK, search for _getStringJS, and we will see this method relies on a global variable named strings:

    var str = global.strings && global.strings[resourceId];

    Moreover, we can also step into the source code of WinJS to investigate on it.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    Tuesday, May 29, 2012 7:24 AM
    Moderator

All replies

  • Hi,

    In the base.js file provided by the SDK, search for _getStringJS, and we will see this method relies on a global variable named strings:

    var str = global.strings && global.strings[resourceId];

    Moreover, we can also step into the source code of WinJS to investigate on it.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    Tuesday, May 29, 2012 7:24 AM
    Moderator
  • Hello Ming Xu.

    Thanks.

    Probably it will be a good idea to document this, right?


    Luis Abreu

    Tuesday, May 29, 2012 7:40 AM
  • Hi,

    I will collect the information and try to report this documentation request.

    Thanks a lot for your feedback.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework




    Tuesday, May 29, 2012 8:12 AM
    Moderator