Two weeks ago I participated in the Microsoft Virtual Conference. I did a session on cross platform localization for native apps using .NET. It’s a continuation of the localization article that I did for CODE magazine 18 months ago.
The V-Conf was two days with 5 concurrent tracks running. The US MVPs had IT, Developer, and Consumer tracks. The Latin American MVPS had a combined track in Spanish. The Brazilian MVPs had a track in Portuguese. Each session had a presenter who was responsible for the content, plus a moderator who handled questions from the audience during the session. Anyone could attend from the comfort of their home or office. And it was free.
I had the great luck of having a Microsoft MVP and Xamarin Developer Evangelist, James Montemagno, as my moderator. He did a great job and did it with the presenter’s equivalent of having one hand tied behind his back. James was at the airport, waiting for a flight. He used his phone as a hotspot for his laptop in a busy terminal.
I talked about the why and the how of localization. I concentrated on how to use the Multilingual App Toolkit and Xamarin.Forms to quickly build and test multilingual apps. I was able to use the new Android emulator that comes with Visual Studio 2015 to show the same app running side by side in different languages. I thought about using Release Candidate of Visual Studio 2015, but I decided not to tempt the Demo Gods. But I did want the new Android emulators that come with VS2015.
Tip:
To use the Visual Studio 2015 Android Emulator with Visual Studio 2013 (or any other Android development tool), you can run the following command line:
"%ProgramFiles%\Microsoft Emulator Manager\1.0\emulatormgr.exe" /sku Android
That will launch the Emulator manager and let you install different virtual Android device images and run them.
Like Genymotion and the Xamarin Android Player, the Microsoft Android Emulator runs as a virtual x86 image. This starts up and runs much faster the Android Emulator that comes with the Android SDK. The Android Emulator emulates the phone down to the native chipset, which is usually ARM based. It’s a high fidelity simulation, but it’s very slow. Running x86 device images provide a much better experience for coding and testing.
The cool thing about the Microsoft Android Emulator is that it runs under Hyper-V, which means you can run it with the Windows Phone emulator. Genymotion and the Xamarin Android Player run inside Virtual Box, which does not play well with Hyper-V.
For the V-Conf session, I wanted as many of the simulators running at the same time on the same screen. This way the audience could see the same app running in multiple languages. Unfortunately this precluded showing the iPhone simulator on the same screen that was being shared with the audience. Since the demo app was written with Xamarin.Forms, the iOS version would have behaved very much like the Android and Windows Phone versions of the app. The audience didn’t miss much without the iOS experience.
As a presenter, I would log into a Lync/Skype for Business session and when it was my turn, I would present my screen and do my presentation. To keep the screen size at sane size for bandwidth, we were recommended to use a 1280×720 screen resolution.
I run two identical monitors on my home machine, at 1920×1080. Knocking one of them down to 1280 was jarring. The nice thing about using the Microsoft emulators is that they have a “Fit to Screen” button on the floating taskbar that comes with the emulator
Clicking the Fit to Screen button would scale the emulator to fit the height of the current screen resolution. It also kept the emulators more or less equally sized on the screen. I had enough room to run three emulators side by size.
I ran one instance of a 5″ Android phone with Android 5 (aka Lollipop), another 5″ Android with Android 4.4 (Kitkat), and 4.7″ Windows 8.1 phone image. The Lollipop phone I left in English. During the presentation, I added a German translation to the app and switched the Kikkat phone to German. I forgot to reboot the phone after making the change, James reminded me about that step.
With Windows Phone, I left the phone in English, but showed how to use code to force a specific language at run-time. This is very handy because if you don’t read the language you are testing, it can be awkward to reset the phone (especially Windows Phone) back to your native tongue.
Tip:
To avoid having to change the phone locale and rebooting, you can force a specific locale when the app starts up by setting the CurrentCulture and CurrentUICulture.
// Force the app to use a specific language // In this case, French Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
Microsoft has posted the video from my session here. The slide deck from the presentation should be posted up there soon. In the meantime, I posted it up on Slideshare.net. Some of the slides use animations to place images over the text and you may want to download the deck instead of viewing it online.
The source code for the sample project is up on GitHub. It does require Xamarin.Forms. If you don’t have Xamarin and would like to try the code, they do have a 30 day free trial.
This presentation was geared around Xamarin.Forms, but this is also applicable for “Classic” Xamarin.Android and Xamarin.iOS. The Multilingual App Toolkit has support for Xamarin.Android and Xamarin.iOS and can create the platform native string resource files for Android and iOS.
In addition to my session, I was the moderator the Microsoft Band session presented by Christine Flora. She had first slot of the day and had to deal with bandwidth problems that prevented the audience from seeing most of her presentation. Christine showed how to connect to Project Online and display the current status to your Microsoft Band. That’s actually a lot cooler than the apps currently available for the band that allow you to add a custom logo to the Band.
Want to find out what’s behind this tile? Sign up for my session to find out. http://t.co/slhmCDNSXw #MVPvConf pic.twitter.com/sCPlmWMblQ
— Christine Flora (@velvetdagger) May 12, 2015
She did a great job and Microsoft will be posting an updated version of her presentation shortly. If you follow Christine on the Twitters, she’ll let you know when the updated Band session will be available.
I had a lot of fun doing the session and I want to thank Microsoft for letting me be one of presenters. I also want to thank James Montemagno for being my moderator. If you are going to do a presentation that uses a lot of Xamarin technology, you can’t go wrong with having a Xamarin Developer Evangelist assisting you. Read James’s blog. Go right now, I’ll wait. I used his tips on how to bring some of the Material Design goodness to Android version of my demo Xamarin.Forms app.