Download - 08 localization and globalization in windows runtime apps

Transcript
Page 1: 08   localization and globalization in windows runtime apps

Andy Wigley @andy_wigleyMatthias Shapiro @matthiasshap

Localization and Globalization in Windows Runtime Apps

WinRT Apps

29 April 2014

Building Apps for Windows Phone 8.1 Jump Start

Building Windows Runtime Apps using C# and XAML

Page 2: 08   localization and globalization in windows runtime apps

In this module…

Global market opportunityWorld-ready app demo Developing a localized Windows Runtime appGlobalizationTranslation

Page 3: 08   localization and globalization in windows runtime apps

Why globalize/localize your apps?

Page 4: 08   localization and globalization in windows runtime apps

Global Windows Phone Stores: 191 markets

Page 5: 08   localization and globalization in windows runtime apps

Support for 54 languages

AfrikaansAlbanianArabicAzerbaijani (Latin)

Basque (Basque)BelarusianBulgarianCatalanChinese (Simplified)

Chinese (Traditional)

CroatianCzechDanishDutch

English (UK)

English (US)

EstonianFilipinoFinnishFrench (Canada)

French (France)

GalicianGermanGreekHausaHebrewHindiHungarian

26 new languages were added with Windows Phone 8

IndonesianItalianJapaneseKazakhKoreanLatvianLithuanianMacedonianMalayNorwegian (Bokmål)

PersianPolishPortuguese (BR)

Portuguese (PT)

RomanianRussianSerbian (Latin)

SlovakSlovenianSpanish (Mexico)

Spanish (Spain)

SwedishTurkishUkrainianUzbek (Latin)

Vietnamese

50 languages supported in Windows Phone 8.0 4 new languages added in Windows Phone 8.1 54 Languages

Page 6: 08   localization and globalization in windows runtime apps

Priority languages

See Details Here: http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/06/21/tips-for-localizing-and-monetizing-your-app-for-windows-phone-users.aspx

Top primary user languages for all app downloaded (Jan-Jun 2013)

8languages supported

Average, top 15 highest grossing apps (WP7 & 8)

Offering your app in English only covers only 25% of Windows Phone users. Adding Mandarin and Spanish increases coverage to ~60%, and adding Russian, Italian, Portuguese (Brazil), and French covers the large majority of all Windows Phone users.

Page 7: 08   localization and globalization in windows runtime apps

Priority markets

See Details Here: http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/06/21/tips-for-localizing-and-monetizing-your-app-for-windows-phone-users.aspx

Number of app downloads per market, Jan-Jun 2013

12 of top 15 apps are published in >=

187 markets.

China and Latin America download

twice as many apps as the US

Page 8: 08   localization and globalization in windows runtime apps

User facing language improvements

Page 9: 08   localization and globalization in windows runtime apps

New Language Control PanelAdd multiple languages to phone

All 54 supported UI languages to be pre-installed on most phonesEnable multiple languages and sort them by order of preferenceLanguages will be listed by locale, enabling Region format to automatically match phone languageAdd languages which are not currently supported for UI, to be used for apps and services which support that languageContinue to auto-download language packs, containing text prediction and speech files, to align with selected languages

Page 10: 08   localization and globalization in windows runtime apps

Demo:Language/Region Settingsin Windows Phone 8.1

Page 11: 08   localization and globalization in windows runtime apps

Developing a localized app

Page 12: 08   localization and globalization in windows runtime apps

Determining language codesUsers specify their language preference list in Phone SettingsThe developer decides which application language list to supportA language is represented as a BCP-47 language tagCan support a regional language (e.g. “en” – English) as well as regional variants (e.g. “en-US”, “en-GB”, “en-HK” etc)

At runtime, Windows handles the matching of the users’ language preferences against the language resources packaged in the appFor example, user preference of “en-US” matches, in priority order “en-US”, “en”, “en-GB” etcIf no resources can be matched, the default language of the application is used

Page 13: 08   localization and globalization in windows runtime apps

Separate string resources for each locale

<TextBlock x:Uid="Greeting" Text="" />

Read resource strings from code also:

Use resource strings from XAML:

var loader = new

Windows.ApplicationModel.Resources.ResourceLoader();

var string = loader.GetString('Farewell');

Page 14: 08   localization and globalization in windows runtime apps

Localizing Fields that are defined in the ManifestYou can localize your apps’ display name, description, and other identifying features, which are in the package manifest fileSet its value to ms-resource:TokenName, where TokenName is a resource name in your resource files

Page 15: 08   localization and globalization in windows runtime apps

DPI, language and accessibility-aware imagesWindows supports automatic resource loading From code or markup, you simply refer to imagname.ext without worrying about scale, language or other resource qualifiersSource=“Images/logo.png” rather than Source=“Images/en-US/logo.scale-180_contrast-white.png

See MSDN topic: How to name resources using qualifiers http://msdn.microsoft.com/en-us/library/windows/apps/hh965324.aspx

Page 16: 08   localization and globalization in windows runtime apps

Multilingual App Toolkit (MAT)

Easy to use localization tool for WP SDKIntegrates with Visual Studio 2013 with Windows Phone SDK to provide Windows Phone Store apps with translation support, translation file management, and localization editingHelps to verify and note changes in resources over timeProvides a UI for choosing languagesSupports the localization industry-standard XLIFF file formatProvides a pseudo-language engine to identify translation issues at developmentConnects with the Microsoft Translator for quick translation suggestionsQuickly expand your customer base and markets with added languages

Page 17: 08   localization and globalization in windows runtime apps

Demo:Multilingual App Toolkit (MAT)

Page 18: 08   localization and globalization in windows runtime apps

Microsoft language assetsTerminology: lookup & downloadsUI Translations: Microsoft products via MSDN and TechNetStyle Guides: Collections of rules that define language and style conventions

Page 19: 08   localization and globalization in windows runtime apps
Page 20: 08   localization and globalization in windows runtime apps

Globalization

Page 21: 08   localization and globalization in windows runtime apps

Globalization APIs

Windows.Globalization.CalendarGetTimeZone()ChangeTimeZone()TimeZoneAsString()IsDaylightSavingTime()

Windows.Globalization.DateTimeFormattingFormat(DateTime.Now, "America/Guatemala“)

Page 22: 08   localization and globalization in windows runtime apps

Format dates and times appropriately

// Use the Windows.Globalization.DateTimeFormatting.DateTimeFormatter class // to display dates and times using basic formatters. var sdatefmt = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("shortdate"); var stimefmt = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("shorttime"); // Obtain the date that will be formatted. var dateToFormat = DateTime.Now; // Perform the actual formatting. var sdate = sdatefmt.Format(dateToFormat); var stime = stimefmt.Format(dateToFormat); // Results for display. var results = "Short Date: " + sdate + "\n" + "Short Time: " + stime;

Standard date and time picker controls conform to users’ selected region To display dates or times yourself, use Date/Time and Number formatters to automatically display the user's preferred format for dates, times and numbers

Page 23: 08   localization and globalization in windows runtime apps

Format numbers and currencies appropriately

// Determine the current users default currency. var userCurrency = Windows.System.UserProfile.GlobalizationPreferences.Currencies[0]; // Number to be formatted. var fractionalNumber = 12345.67; // Currency formatter using the current users preference settings for number formatting. var userCurrencyFormat = new Windows.Globalization.NumberFormatting.CurrencyFormatter(userCurrency); var currencyDefault = userCurrencyFormat.Format(fractionalNumber);

// Create a formatter initialized to a specific currency. // In this case it's the Euro with the default number formatting for France. var currencyFormatEuroFR = new Windows.Globalization.NumberFormatting.CurrencyFormatter("EUR", new[] { "fr-FR" }, "FR"); var currencyEuroFR = currencyFormatEuroFR.Format(fractionalNumber);

// Results for display. var results = "Fixed number (" + fractionalNumber + ")\n" + "With user's default currency: " + currencyDefault + "\n" + "Formatted Euro (fr-FR defaults): " + currencyEuroFR;

Different cultures format numbers differently Use NumberFormatting to display decimal, percent/permille numbers, currencies

Page 24: 08   localization and globalization in windows runtime apps

Use a culturally appropriate calendar

The calendar differs across regions and languagesStandard date and time picker controls conform to users’ preferred calendar formatUse Windows.Globalization.Calendar class to work directly on calendar dates; gives an appropriate calendar representation for the given culture, region, and calendar type

Page 25: 08   localization and globalization in windows runtime apps

Modern Resource Technology (MRT)

Page 26: 08   localization and globalization in windows runtime apps

MRT Bundles

MRT determines correct language resources and image assets for platform and device settingsAppX packages can be packaged as fatpacks or bundlesFatpacks contain all binaries and assets in a single package (Same for XAPs)Bundle is a package containing resource packages specific to language or device specifications

BenefitsUser downloads only the portions of a bundle applicable to their devicePackage consumes less space on users device

For more: See Session 21: App Packaging and Publication

Page 27: 08   localization and globalization in windows runtime apps

©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics 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.