April 28, 2006

Presenting at Desert Code Camp on May 6

Filed under: Uncategorized — Anthony Park @ 5:56 pm

I will be presenting two sessions about Windows XP Media Center development at the upcoming Desert Code Camp on May 6, 2006 in Tempe, AZ.

Developing a Background AddIn for Windows Media Center

There are currently two types of development models for Windows Media Center: AddIns and Hosted HTML Applications. AddIns are essentially background services that have very limited user interface capabilities. In this 45 minute session, Anthony Park will demonstrate the design, coding, and installation of a Windows Media Center AddIn


Developing a Hosted HTML Application for Windows Media Center

There are currently two types of development models for Windows Media Center: AddIns and Hosted HTML Applications. Hosted HTML Applications are essentially rich DHTML applications that can interact with the Media Center object model. In this 45 minute session, Anthony Park will demonstrate the design, coding, and installation of a Windows Media Center Hosted HTML Application.


The two sessions will be very “code-centric” and will introduce a new open source plugin I have recently started writing for Media Center.

—-

What is a Code Camp? In short, it is a free developer conference. Who is welcome? Anyone!

To get a better understanding, here’s the Code Camp Manifesto:

By and For the Developer Community


Code Camps are about the developer community at large. They are meant to be a place for developers to come and learn from their peers. Topics are always based on community interest and never determined by anyone other than the community.

Always Free


Code Camps are always free for attendees.

Community Developed Material


The success of the Code Camps is that they are based on community content. All content that is delivered is original. All presentation content must be provided completely (including code) without any restriction. If you have content you don’t want to share or provide to attendees then the Code Camp is not the place for you.

No Fluff only Code


Code Camps are about showing the code. Refer to rule #1 if you have any questions on this.

Community Ownership


The most important element of the Code Camp is always the developer community. All are welcome to attend and speak and do so without expectation of payment or any other compensation other than their participation in the community.

Never occur during work hours


We need to understand that many times people can’t leave work for a day or two to attend training or even seminars. The beauty of the Code Camp is that they always occur on weekends.

The community leaders in the desert have worked together to arrange this venue for our software developer communities. It’s not a “one-technology” event. There will be sessions on Java, Flash, open source, Microsoft, database, and all other technologies. Nothing is off limits.

Visit http://www.desertcodecamp.com for more information.

April 18, 2006

An Approach for Implementing Client-Side Multi-Language Support in DHTML

Filed under: Uncategorized — Anthony Park @ 7:18 pm

Shortly after the first version of MCEBrowser shipped, I started getting requests for MCEBrowser to be translated into different languages. I also had several people offer to do the translations for me. So, I decided that if this feature was so important to so many people, maybe I should devote some time to implementing it.

Being new to multi-language development, I really wasn’t sure where to start. I found tons of information online about adding multi-language support to compiled applications (Win32, .NET, Java), and even to web-based applications (ASP, Java, etc). However, I was working on an application that was almost strictly client-side HTML and JavaScript. I could not find any information about how to support multiple languages in this environment.

So, here is the solution I came up with. I decided to use spans in my HTML page to represent each text item that I wanted to be defined in a language file. Each of these spans contains the English version of the text that I want displayed. Ex:



The span id’s are defined in a separate XML file, along with the text inside of them. The English example looks like this:



This XML file is named “en-us.xml”, the language code for the US English language plus a “.xml” extension. Great! Now all of the text for the controls is defined in an XML file, but now we need a way to load it into the controls. Consider the following JavaScript function:



This function uses the “Microsoft.XMLDOM” ActiveX object to load a file from the local file system that matches the current “navigator.browserLanguage”. Once the XML file is loaded, it iterates through the elements in the XML file and loads the text in each node into the control on the current page that matches the ID as defined in the file. This function can now be called from a page onLoad function like this:



Notice that we are including the Translation.js file, which contains the loadPageTranslationData function in the head section of the page. In the onload event of the body, we are calling the loadPageTranslationData function, passing ‘selectLocationPage’ (the name of our page) as the parameter. This function will find the correct language file for the current browser language and load all of the text into our page elements.

Cool! Now, we just need translations of our English XML file to other languages. A Traditional Chinese example of the earlier English selectLocationPage might look something like this:



As new translations are added, they just need to be added to the “languages” folder under the project and the translated text will display automatically in the browser:



The result?