Reach a worldwide audience by building a world-ready app 1/15/2019 4:18 PM APP-411T Reach a worldwide audience by building a world-ready app Kipling Knox Group Program Manager Microsoft Corporation © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Agenda Why is world-readiness important for you? What does a world-ready app look like? Four easy steps to build a world-ready app You’ll leave with examples of how to Manage file and string resources in your app Apply formatting in JavaScript Get more information about advanced localization
Why is world-readiness important?
When you make a world-ready app, you significantly expand your customer base. Windows 8 makes this easy.
Most of your potential customers probably speak a different language than you Internet World Stats Copyright © 2011, Miniwatts Marketing Group.
What does it mean to be “world-ready?” Content appears in the language of your customers Data, like dates and times, are formatted correctly by culture Text input just works for all languages
What’s new in Windows 8? Your customers just list their languages, and Windows retrieves the right resources and formats A client-side resource management system for HTML/JavaScript (no need to call a server every time you want a string) The same resource management system supports all languages (JS, C#,C++) You don’t have to manually manage images for DPI or high-contrast changes
Weather app, world-ready demo Weather app, world-ready
4 easy steps to make your app world-ready
Steps to make your app world-ready Verify fallback language Structure resources and use localization APIs Use formatting APIs for culturally-sensitive data types Translate content
Step 1 Verify your app’s fallback language
Verify the fallback language of the app In Visual Studio, verify the fallback language is what you want
Step 2 Separate resources from code and use localization APIs
Approaches to resource management File-based resource management Retrieving a string directly using ResourceLoader.getString() Managing and retrieving strings naturally in HTML or XAML Localizing your app’s presence in the system through the manifest
Manifest File-based Markup getString()
File-based resource management Simplest method of resource management Works for images, media, HTML, CSS Steps (HTML or XAML) Create alternate file assets for different languages and DPI Use simple file / folder naming conventions Ensure your elements are tagged correctly Build
demo File resources
Retrieving a string directly using getString() Lowest-overhead approach to getting a string Useful for run-time operations Steps: Move strings from markup to resource file (resJSON or ResW) Use ResourceLoader.getString() to retrieve the resource by name Build
Retrieving a string directly using ResourceLoader.getString() demo Retrieving a string directly using ResourceLoader.getString()
Managing and retrieving strings naturally in HTML or XAML Best practice if you have more than a few strings Requires a resources file, a reference to the res.js toolkit, and the addition of attributes to markup Steps: Move strings from markup to resource file In HTML, add a few lines of code to leverage res.js toolkit Mark resource references using data-win-res attribute Build
Managing localized string resources in HTML demo Managing localized string resources in HTML
Localizing your app’s presence in the system Your app content is also represented in the Windows Store, on the Start screen, in search, and in its splash screen You start by localizing your manifest Steps: Add strings to resource file Add references to the manifest using ms-resource URI scheme Build
Localizing your app’s presence in the system through the manifest demo Localizing your app’s presence in the system through the manifest
Additional scenarios As you build more complex apps, you may want to Integrate localization with fragment loading Integrate data-binding with localized strings Use localization techniques to interact with multi-lingual web services Use localized SDK controls
Step 3 Use formatting APIs for culturally-sensitive data types
Examples: displaying date and time
Formatting for culturally-sensitive data NEW: JavaScript support for formatting dates and times numbers currencies calendar and clock conventions basic information about languages, regions, calendars C# apps can still use ToString() and System.Globalization C++ apps can still use NLS
Basic date/time formatting // Format using the built-in named long/short formats var dtf = Windows.Globalization.DateTimeFormatting; // longdate format var dateformat = new dtf.DateTimeFormatter("longdate"); var datestring = dateformat.format(new Date()); // e.g., "Wednesday, September 14, 2011" // e.g., "miércoles, septiembre 14, 2011" // shorttime format var timeformat = new dtf.DateTimeFormatter("shorttime"); var timestring = timeformat.format(new Date()); // e.g., "2:45 PM" © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Use formatting APIs in JavaScript to format a long date demo Use formatting APIs in JavaScript to format a long date
Step 4 Translation
Translation: a range of options “DIY” with translation glossaries http://www.microsoft.com/Language/en-US/Default.aspx Non-professional translators Professional localization vendors
In closing…
For more information RELATED SESSIONS Building World Ready Metro-style Apps with XAML(Tim Heuer) HELPFUL MATERIALS Code sample: Application resources and localization Code samples for formatting date/time, numbers, calendar
When you make a world-ready app, you significantly expand your customer base. Windows 8 makes this easy.
thank you Feedback and questions http://forums.dev.windows.com Session feedback http://bldw.in/SessionFeedback
1/15/2019 4:18 PM © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.