TechEd Europe: How To Make Your Silverlight 4 Application World Ready

Going to TechEd Europe 2010 in Berlin ? Come and see my session (WEB307) How To Make your Silverlight 4 Application World Ready. This is the same session I'm doing at the 34th Internationalization and Unicode Conference (#IUC34, where it is called How To Achieve World-Ready Domination In Silverlight 4) and I did last night at the Silverlight UK User Group (where it was called Internationalizing Silverlight 4). Here's the abstract:-

So you've written your Silverlight application and you want it to work in another language ? Then this session is for you. World-Readiness is all of the work that a developer needs to do to globalize an application and make it localizable (i.e. capable of being localized). Whereas these concepts are well established in Windows Forms and ASP.NET, Silverlight is not only a cut-down version of the .NET Framework but also cross platform and client-side. In this session you will learn how to localize Silverlight applications using .resx files, download culture-specific resources on demand so that users only download resources for the culture they need, understand what System.Globalization types and properties Silverlight does not support and why, what globalization and font support you can expect on Windows and the Mac, what the Silverlight installation user experience is for non-English users and what language support you can expect from the Silverlight framework.

Currently rated 1.8 by 4 people

  • Currently 1.75/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Thursday, September 16, 2010 at 5:35 PM
Tags:
Categories: Internationalization | Silverlight | Events
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Internationalizing Silverlight 4 Slides and Source Code

Thanks to everyone who came to the Internationalizing Silverlight 4 presentation at the Silverlight UK User Group last night. A particularly huge thanks to Mark Mann who provided a personalised and internationalized introduction to me. Never had something like this before and I was very impressed and touched. Best introduction ever.

Excellent chat in the pub afterwards too. Really enjoyed it ? thanks everyone.

The slides for the presentation are available at http://www.guysmithferrier.com/Downloads/I18NSilverlight.zip. The source code is at http://www.guysmithferrier.com/Downloads/I18NSilverlightSource.zip.

Ian Smith took a video of the presentation which will be posted soon.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Thursday, September 16, 2010 at 10:51 AM
Tags:
Categories: Internationalization | Silverlight | Events
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Silverlight Globalization Namespace Comparison Updated For Silverlight 4

When Silverlight 2 was released I wrote a short document comparing the classes in the Silverlight System.Globalization namespace with those of the .NET Framework's same namespace. Last year I updated it for Silverlight 3 and now I have done the same again for Silverlight 4. Before you get too excited, however, the System.Globalization classes and their methods and properties in Silverlight 4 have not changed since Silverlight 3. That is not to say that there aren't internationalization changes in Silverlight 4 (right-to-left support being a very welcome addition), just that the classes themselves have not changed (not even to include TextInfo.IsRightToLeft). You can download the document here.

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Thursday, September 09, 2010 at 3:42 PM
Tags:
Categories: Silverlight | Internationalization
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

PublicResourceCodeGenerator now works with Visual Studio 2010

I have updated the PublicResourceCodeGenerator (and all of the other code generators) so that it installs and works with Visual Studio 2010 (as well as Visual Studio 2008). The PublicResourceCodeGenerator is used to create Strongly Typed Resource Classes with a public class and a public constructor so that resx files can be used with Silverlight (you can read all about these code generators here). You can download an MSI/EXE and/or the source code (for Visual Studio 2010, 2008 and 2005) here.

Currently rated 4.3 by 3 people

  • Currently 4.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Wednesday, September 01, 2010 at 6:30 PM
Tags:
Categories: Internationalization | .NET Internationalization Book | Silverlight
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Internationalizing Silverlight 4

I will be presenting a Silverlight 4 version of my Internationalizing Silverlight presentation twice in the coming months. The first is at the Silverlight User Group in London on Wednesday 15th September 2010 and the second is at the 34th Internationalization and Unicode Conference (where it is entitled "How To Achieve World(-Ready) Domination In Silverlight 4") in Santa Clara, California from Monday 18th October to Wednesday 20th October 2010. Typically I present internationalization subjects to developers and the consequence is that there is sometimes some groundwork that needs to be covered for the subject to make sense. Each of these upcoming events approaches this subject from a different viewpoint: the Silverlight User Group members know Silverlight very well and therefore will be solely focused on internationalization and the Internationalization and Unicode Conference attendees know internationalization very well and will be focused solely on Silverlight. I'm looking forward to the different perspectives. Here's the abstract:-

So you've written your Silverlight application and you want it to work in another language ? Then this session is for you. World-Readiness is all of the work that a developer needs to do to globalize an application and make it localizable (i.e. capable of being localized). Whereas these concepts are well established in Windows Forms and ASP.NET, Silverlight is not only a cut-down version of the .NET Framework but also cross platform and client-side. In this session you will learn how to localize Silverlight applications using .resx files, download culture-specific resources on demand so that users only download resources for the culture they need, understand what System.Globalization types and properties Silverlight does not support and why, what globalization and font support you can expect on Windows and the Mac, what the Silverlight installation user experience is for non-English users and what language support you can expect from the Silverlight framework.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Wednesday, July 28, 2010 at 10:37 AM
Tags:
Categories: Silverlight | Internationalization
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (2) | Post RSSRSS comment feed

Automatically Translating resx Files Using Microsoft Translator

Back in April 2009 I wrote about the Microsoft Translator (aka the Bing Translator), the various APIs that it exposes and in particular the REST API that it exposes to allow the automation of translation. At the time I also added a Microsoft Translator class to the list of translator classes used in the tool suite for my book, .NET Internationalization. In this post I join the dots and show you how to make use of these classes and automatically translate your resx files to another language.

  1. Get your Microsoft Translator "app id" from http://search.live.com/developers/appids.aspx.
  2. Download the free source code for the book from here.
  3. Extract the source code to a folder of your choice.
  4. Open ResourceAdministration\ResAdmin\App.Config and change the "value" of the "MicrosoftTranslatorApplicationId" key to the "app id" that you were given for the Microsoft Translator.
  5. Build the source code by opening a Visual Studio command prompt in the folder that you extracted the source code to and running "msbuild BuildAll.proj". If FxCop is not installed on your machine there will be build errors but these are not related to the translation tools and you can ignore these.
  6. Connect to the internet (the Microsoft Translator needs an internet connection).
  7. In ResourceAdministration\ResAdmin\bin\debug you will find ResAdmin.exe. This is the Resource Administrator which is a developer tool for managing resources. Run ResAdmin.exe.
  8. You will see the following dialog. In the "Source of Resources" enter the base directory containing your resx files. In the "Invariant language" enter the language code that the original resources are in (e.g. "en" for "English"). Click OK. ResAdmin Resources Source
  9. Next you will see the main form. You need to tell the Resource Administrator what language(s) to translate to. Select Tools | Languages and enter all of the languages to translate to (you should probably de-select Albanian at this point). Click OK. ResAdminMainForm
  10. You will be asked if you want to automatically add the necessary resx files for the new language(s).ResAdminAddLanguages Click Yes. At this point if "Automatic Translation" is on (see the status bar) the text in the resx files will be translated.
  11. The Resource Administrator tool uses a collection of machine translators to translate text where it falls back to other suitable translators if one fails. You can configure which translators are included in the list by selecting Tools | Translators.

Note that the Resource Administrator utility is not hard wired to use solely resx files. You can use the same utility with other sources of resources (including a database) by selecting Tools | Resources Source.

For more information on how to use the Resource Administrator see the .NET Internationalization book.

Currently rated 3.8 by 4 people

  • Currently 3.75/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Tuesday, September 29, 2009 at 6:14 PM
Tags:
Categories: Internationalization | .NET Internationalization Book
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

LRC XIV: Localisation in The Cloud

The 14th annual LRC (Localisation Research Centre) conference will be held on Thursday/Friday 24th and 25th September 2009 in Limerick City, Ireland. I will be there presenting a poster. This is a new kind of presentation for me; the idea is to stand in a communal area during the break for lunch next to an A0 poster that you have prepared and be prepared to chat to anyone who is interested. It seems a bit like the Ask The Experts format but with better focus. If it works I might try it at dev events in the UK. My poster is on Internationalizing Silverlight and is based on the presentation that I have started giving this year. All in all I'm very excited about LRC as it will be a rare treat for me to be at a conference that is solely on localization and everyone there is guaranteed to be interested in the subject.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Tuesday, September 08, 2009 at 9:12 AM
Tags:
Categories: Internationalization | Events | Silverlight
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Internationalizing Silverlight Slides And Source Code

Thanks to everyone who came to the Internationalizing Silverlight (aka How To Achieve World-Ready Domination In Silverlight) talk at NxtGen Southampton on Thursday. The slides are at http://www.guysmithferrier.com/Downloads/I18NSilverlight.pptx and the source code for the completed demos are at http://www.guysmithferrier.com/Downloads/I18NSilverlightSource.zip. Note that the font I was using is not included in the download as the licence prevents redistribution but you can substitute an alternative font.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Saturday, June 20, 2009 at 11:51 AM
Tags:
Categories: Silverlight | Internationalization | Events
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Localizing ASP.NET MVC

I've noticed that there has been a bit of confusion regarding localization in ASP.NET MVC so I thought I'd write up the solution to try to clear things up. ASP.NET has quite a reasonable localization model as by default it uses the ResourceManager and .resx files all wrapped up fairly neatly using the Generate Local Resources menu option in Visual Studio. Whereas there are some gaps the model is reasonably sound. Where this solution has learnt from previous localization models is in the resource provider model where you can replace the ResourceManager/.resx solution with an alternative resource implementation of your own design such as a WCF resource service. If you are unfamiliar with ASP.NET localization you should get up to speed with it before looking at localization in ASP.NET MVC.


ASP.NET MVC utilizes most of the ASP.NET localization model so the basics of using a resource provider and the default provider using the ResourceManager and .resx files is no different. The difference is that ASP.NET server side controls are either not possible without the the ASP.NET page model or difficult and are mostly unwanted in the 'pure' world of MVC. This difference is important in localization terms because Visual Studio's Generate Local Resources menu option expects to find ASP.NET server side controls. By default, the Generate Local Resources menu option creates a new .resx file in the App_LocalResources folder corresponding to the .aspx/.ascx page or control (so App_LocalResources\Default.aspx.resx is created to correspond to Default.aspx). Generate Local Resources iterates through every control looking for properties that are decorated with the LocalizableAttribute (set to true). Each control with any such property is modified to have a meta:resourcekey tag and the value of the property together with a key is added to the corresponding .resx file. The property is then said to be implicitly bound to the resource.


There are two problems with localizing MVC: there are no HTML properties that are decorated with the LocalizableAttribute and the HTML controls are not server side. The first issue means that Generate Local Resources does not find any properties to localize so the .resx file is not populated with resource entries and the HTML controls are not marked with a meta:resourcekey tag. What is important to note here, though, is that this is simply the nature of the Generate Local Resource menu option. The model still works so if you manually add a meta:resourcekey and you manually add the corresponding entry in the resx file (and the HTML control is server side) then localization will occur just as it does in an ASP.NET application. The second problem is that HTML controls are not server side by default. Localization occurs on the server and there's just no getting round this if you want to make use of all of the ASP.NET localization infrastructure. The solution is to change the HTML controls to be server side.

So here's an example with this humble HTML button control:-

<input type="button" value="Press Me"/>

To localize it for ASP.NET MVC first run Tools | Generate Local Resources. This will create the necessary .resx file and make minor modifications to the page (but not to the HTML control itself). To localize the control you need to add a runat tag and a meta:resourcekey tag:-

<input type="button" value="Press Me" runat="server" meta:resourcekey="PressMeButtonResources"/>

Then open up the associated .resx file (in the App_LocalResources folder) and add an entry with the key "PressMeButtonResources.value" and the value "Press Me (From resx)". When you run the site you will see that the button shows the value from the .resx file and not the value from the .aspx file. The button is now localizable.

 

Of course, all of the rest of the UI including the static text in the HTML, text in JavaScript, text in the code behind, text in libraries and text and resources everywhere still need to be localized but the solutions to localizing all of this text are the same for ASP.NET MVC as they are for ASP.NET so I'm not going to cover them here.

 

What is needed for MVC is an equivalent to Generate Local Resources that performs the same task except that instead of identifying properties as localizable based on having the LocalizableAttribute it uses some other means such as having a dictionary of 'known localizable properties'. For example the value property of an HTML INPUT control with type="Button" is always localizable and it does not need to be marked with a
LocalizableAttribute for this to be true.

 

By the way, if you're not using ASP.NET MVC and your regular ASP.NET application has lots of HTML and you're wondering about how to localize that then you have many more (better) options open to you. The main one of these is to convert your HTML controls to equivalent ASP.NET server side controls. If this is your plan then you should take a look at the I18NRefactorings (an add-in for the free DXCore) in the download at http://www.dotneti18n.com/Downloads.aspx that will help automate this process. I will blog about this separately at a future date.

Currently rated 3.6 by 11 people

  • Currently 3.636364/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Friday, May 15, 2009 at 9:44 PM
Tags:
Categories: Internationalization | .NET Internationalization Book
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (9) | Post RSSRSS comment feed

Machine Translation Using The Microsoft Translator

When Live was first released it's true to say that I was disappointed because all other competitive search engines had online translation tools and these were missing from Live. I think it is fair to say that Microsoft has delivered now. The basic online translator, Microsoft Translator, has been available for some time now but at MIX 09 Microsoft announced a widget and various APIs and tools that build on the translation engine and open up machine translation to a much broader range of applications. This post describes what's available and how you can get started.

Microsoft Translator provides the basic online interactive translation facility like Google, Alta Vista and everyone else. Translation is from English to 13 languages and vice versa (there are no language pairs that are not either to or from English). The Microsoft Translator site also accepts URL parameters that allow you to tell it to automatically translate a site:-

http://www.microsofttranslator.com/bv.aspx?lp=en_fr&lo=TP&a=www.guysmithferrier.com

The "lp" parameter is the language pair ("en_fr" specifies that the translation is from English to French), the "lo" parameter is the page layout of the translation result ("TP" specifies that the page should be shown as translated with the original language appearing as tooltips) and the "a" parameter is the URL to translate. This facility is very useful for being able to send links of translated pages.

The first major announcement at MIX was the Translator Widget. The translator widget is a snippet of HTML and JavaScript that you add to your page that provides translation facilities for your page. You can try it out on this site (see the blue "Microsoft Translator" box on the top left hand side of this page). You can also see it working on http://www.dotneti18n.com. To add one of these to your site you need to request a widget code from http://www.microsofttranslator.com/widget (you can't copy the HTML/JavaScript from a site that already has the widget because the code only works for the site it was generated for).

The Translator Widget is certainly a great starting point but you can provide finer control over the translation process using the Translator AJAX API. This allows you to call into the translation API to specify what parts of the page should be translated and how. To use the AJAX API you need to request a (different) code from http://www.microsofttranslator.com/dev/ajax.

The area that is of greatest interest to me, however, is the HTTP REST API. This provides programmatic access to the Microsoft Translator API from any code that can make HTTP calls. As such it is perfect for utilities like the Resource Administrator on http://www.dotneti18n.com that translates resx files. Again you need to request an "app id" to use this API (this is a different code from the widget code and the AJAX API code) and you can request one from http://search.live.com/developers/appids.aspx. Armed with your AppId you can use an HttpWebRequest to execute POST requests like this:-

http://api.microsofttranslator.com/V1/Http.svc/Translate?appId=yourAppId&from=en&to=es

where the content is the text that you want to translate.

The following resources will help you get up to speed on all of these:-

As always you should read the terms of use (the terms of use for the REST API are here) but in general they say that these are available for non-commercial use. Commercial licences are available by contacting Microsoft.

In addition Microsoft has a growing collection of implementations of this technology:-

Others have said that 2009 will see the coming of age of machine translation. These advances certainly move that goal further forwards.

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Saturday, April 18, 2009 at 1:56 PM
Tags:
Categories: Internationalization | .NET Internationalization Book
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (9) | Post RSSRSS comment feed