Condividi tramite


How to internationalize content, libraries and web services (XAML)

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

Ensure that your app's content is internationalized in a way that is consistent with external components and web services.

Instructions

If your app interacts with external components, it is recommended that you ensure that the UI of the external component is consistent with that of your app. Components, such as SDKs, that utilize the resource management system or globalization APIs (Windows.Globalization and Windows.Globalization.NumberFormatting), automatically load a consistent application language.

The application and web services that you use may have the same extent of localization as your app. The extent of localization can include, for example, the number of languages supported, or localized info. This equal localization can be true in particular if you control the web services along with the app. In this case, you can utilize the HTTP Accept-Language headers to mimic the application language behavior, as it is set to the user's language profile list.

However, some components that have a different extent of localization than your app (those that are localized into more or fewer languages), may use a different mechanism for localization. Most notably, these include public web services or code libraries. In these cases, it is recommended that your app resolve the language that is used inside the application first, before making a request to the service, and that the app then be explicit about the language to use with the service.

One useful technique is to specify possible URLs or API parameters that the web service or library supports as string resources, and look them up locally before making a request. This utilizes the same language-matching logic as your local application, to choose the correct language for UI from the service.

For example, a weather app may currently display a UI in French (France), but the user's top language in their preference list is German. The app may need to explicitly request French (France) to the service in order to remain consistent within the app.

Note  See the Application resources and localization sample, which contains a scenario about this topic.

 

Application resources and localization sample

Windows.Globalization

Windows.Globalization.NumberFormatting