The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
Can HubSection Header text be localized? RRS feed

  • Question

  • I created a Visual Studio 2013 project from the Hub App (Universal apps) template. Overall, it works.

    However, for the phone app (not the Windows app) in HubPage.xaml, there are a number of elements like
      <HubSection x:Uid="HubSection1" Header="SECTION 1" ...
    And in the shared Resources.resw
      <data name="HubSection1" xml:space="preserve">
        <value>SECTION 1</value>
      </data>

    At run time (not just design time but also at run time), localization is NOT performed. The value in the resource file is not displayed. The XAML Header value from the HubSection is displayed (not localized).

    Other elements such as TextBlock elements are localized properly (the value from the resource file is displayed for those other elements).

    What’s the localization solution for the HubSection Header?

    Tuesday, July 22, 2014 12:44 AM

Answers

  • I found my problem. The Visual Studio project template I used sets up a hub app for phone and Windows. A data model is provided with a sample JSON file for data. Depending on how each HubSection is set up in the XAML, the app may attempt to bind to data in that JSON file (or not). The phone app and Windows app, from this template out of the box, are not intended to work the same.

    I created an empty HubSection with NO binding to the sample data (just Header and x:Uid), and the localization worked fine. So, my confusion was in reading how the template's XAML was written and how it wanted to fill in that Header value at run time.

    I now see where my app is getting its values. Thanks for your time.

    Wednesday, July 23, 2014 10:46 PM

All replies

  • <Sorry not a localization expert>
    Do you have an app that is showing how the localization isn't working?  I'll show it to one of our localization guys to see what's going on.  Upload to OneDrive and share the link here.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, July 22, 2014 7:48 PM
  • You don't need an app from me. Create a new project with VS 2013 using the Hub App (Universal apps) template. The localization for each HubSection's Header value does not work for me. (I change the value in the resw file, and at RUN time I see the text from the XAML file rather than the resw file. This is not a design time problem.) Localization for other text (such as TextBlock text) works AOK.

    If you can create a new app like this and the localization of the HubSection Header works for you, then let me know. Thanks!

    UPDATE: To clarify, by "run time" I mean the VS 2013 phone emulator. I am not at my PC right now, I can let you know the settings later. I think I have been debugging with the 512MB phone selection. I don't see any messages or build errors, just the localization problem with that Header value for each HubSection.

    • Edited by GaryGo Wednesday, July 23, 2014 12:00 PM
    Wednesday, July 23, 2014 11:11 AM
  • I am confident that this is trivial, but please provide the sample app and I'll get the bug filed for this.
     


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, July 23, 2014 1:32 PM
  • I found my problem. The Visual Studio project template I used sets up a hub app for phone and Windows. A data model is provided with a sample JSON file for data. Depending on how each HubSection is set up in the XAML, the app may attempt to bind to data in that JSON file (or not). The phone app and Windows app, from this template out of the box, are not intended to work the same.

    I created an empty HubSection with NO binding to the sample data (just Header and x:Uid), and the localization worked fine. So, my confusion was in reading how the template's XAML was written and how it wanted to fill in that Header value at run time.

    I now see where my app is getting its values. Thanks for your time.

    Wednesday, July 23, 2014 10:46 PM