Fixing Silverlight Applications that Requires East Asian Languages Installed

6 04 2009

Recently, when working on CRSM’s Computer-Based Training Silverlight application, I have encountered quite a big problem where people whose PC does not have East Asian Language installed are unable to view it. Basically, the problem started because we have used a video carousel control which has globalization applied. Globalization allows programmers to localize and create their software in multiple languages.

Upon the loading of the XAP file, if a file under certain language is not found, Silverlight somehow disable the showing of the application altogether unless East Asian languages are installed. The error which was displayed is  “Unhandled Error in Silverlight 2 Application” with code 2105 as shown below.

silverlighteastasianlanguageerror

As our application do not require Chinese language that has been utilized by the video carousel, the chinese language DLL file which should be loaded is unnecessary for PCs without East Asian languages installed. However, Silverlight 2 automatically loads it even after knowing that the computer do not have support for East Asian Languages. This is basically a bug which has already been fixed for the next version of Silverlight, which is Silverlight 3. To temporarily fix this problem, all we need to do is to ensure that Silverlight does not load other language’s DLL file.

To do so, simply use any zipping program (i.e. Winzip or Winrar) to open the XAP file. Inside the zipped XAP file, you should get a set of files which looks like this:

xapcontentWhat we would like to do is to edit the AppManifest.xml file which is located inside this XAP file (not the one which is located in the same folder as your XAP file). After opening it, all I did was to remove the languages DLL Assembly Parts which were causing me problems. i.e:

<AssemblyPart Source=”zh-Hans/System.Windows.Controls.resources.dll” />
<AssemblyPart Source=”zh-Hans/Cokkiy.Display.VideoCarousel.resources.dll” />

Once I have taken these 2 lines ouf of the AppManifest.xml file, my Silverlight application could now run on any system whether they have East Asian languages installed or not.

However, this temporary hack won’t help in globalization because what we have basically done above will delete any initialization to different language resources. As I have mentioned before above however, this will be fixed come Silverlight 3. There are more advanced hacks available out there to allow your AppManifest.xml to load based on the language that is available in the PC if you still require globalization to be done on your application. You can find it here at http://wpf-e.spaces.live.com/blog/cns!2B248D261D0E0035!407.entry


Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: