(X) Hide this
    • Login
    • Join
      • Generate New Image
        By clicking 'Register' you accept the terms of use .
        Login with Facebook

Internationalization/Globalization in Silverlight - Part 7 - Dates and Images

(0 votes)
Ross Wozniak
>
Ross Wozniak
Joined Feb 19, 2010
Articles:   9
Comments:   0
More Articles
0 comments   /   posted on Feb 26, 2010

This article is compatible with the latest version of Silverlight.

Usually when we think of internationalization we think of the text that appears on the screen. However, it is important that you also think about dates, and perhaps images as well.

Dates

In the U.S. we get used to thinking of dates in terms of month, day and year, in that order. There are different ways of representing these (month name vs. number, 2 vs. 4-digit year, etc.) but it is important to recognize the fact that dates are not always represented the same way in other countries. For example, in England the day comes first and the month comes second.

Incorrect approach…

What you do not want to do is something like this:

<TextBlock Text="{Binding CreatedDate, StringFormat='M/d/yy'}"/>

Or in a Telerik RadGridView:

<telerikGridView:GridViewDataColumn Header="Due" DataMemberBinding="{Binding DueDate}" 
DataFormatString="{}{0:M/d/yy}"/>

The problem with these approaches is that you have hardcoded the date format. In England, a user would think 2/1/10 is January 2nd, not February 1st.

Correct approach…

What you do want to do is this:

<TextBlock Text="{Binding CreatedDate, StringFormat='{0:d}'}"/>

Or in a Telerik RadGridView:

<telerikGridView:GridViewDataColumn Header="Due" DataMemberBinding="{Binding DueDate}" 
DataFormatString="{}{0:d}"/>

Images

Technically if you are internationalizing an app you should include your icons in your .resx. The reason for this is that an icon that work in the U.S. may not work for folks in another country. For example, using a mailbox icon for an ‘Inbox’ tree node may makes perfect sense to some, but not others. Some other countries do not have mailbox, so this icon would be confusing to them.

Having said that, there isn’t currently a smooth way to do this. If you open your .resx file, do Add Resource, and add an icon file, it won’t work (it won’t compile). I came across a workaround here:

http://forums.silverlight.net/forums/t/20368.aspx

I was able to get the technique to work using the steps outlined in Justin’s post, but for some reason when I ran my app it was very sluggish. My animations no longer ran smoothly, and I eventually bailed on it. At some point in the future when I have more time I’ll look into it further and see if I can figure out why I experienced these problems, but for now, I don’t have a good answer for this one.


Subscribe

Comments

No comments

Add Comment

Login to comment:
  *      *       
Login with Facebook

From this series