.NET Zone is brought to you in partnership with:

Jonathan creates software, mostly with C#, XAML, and HTML5/JS. He was awarded the Microsoft MVP in the "Client Application Development section in January 2011 Jon is a DZone MVB and is not an employee of DZone and has posted 23 posts at DZone. You can read more from them at their website. View Full User Profile

Windows 8 XAML Video Player: Easy Globalization / Translations

  • submit to reddit

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 Jon Antoine, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)