{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner
dotnet,how-to,microsoft,tools,windows,visual studio,.net & windows,c-sharp,windows-8

Windows 8 XAML Video Player: Easy Globalization / Translations

Now that you can easily stream videos from Azure’s blobs, you may want to translate the strings used in the player Framework.

Today, I struggled a lot doing something basic : translating in french the text of the “error view” in the player framework.

As usual, there is an easy solution! I tried a lot of things, but none of it has done the job :

  • to set the language attribute of the mediaPlayer
  • to remove the default ErrorPlugin and add a one with the language set
  • to create and apply a custom error view style

Finally, I downloaded the source code of the player framework and I noticed that there is a ResourceLoader property on the MediaPlayer class. This is the resource loader used to get all the strings of the MediaPlayer.

So the solution is easy : just copy the resource file of the player framework and customize it for your application. As this is a static property, you can do it once and for all in the App’s Loaded method.

Here is what I do in my app :

MediaPlayer.ResourceLoader = new ResourceLoader("/Microsoft.PlayerFramework");

With this folder/file tree :

If you need to refresh your knowledge, you can also read my post on ressources. It targets WinJS but the basics are the same.

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks