SlideShare a Scribd company logo
1 of 51
Cross-Platform Localization for Mobile Apps Using .NET
Chris Miller, Tyler Technologies
James Montemagno, Xamarin
May 15th, 2015
May 14 – 15, 2015
2015
Microsoft
MVP Virtual
Conference
Who we are : Chris Miller
Chris is a Senior R&D Engineer for Tyler Technologies,
Currently working on mobile apps for the K-12
transportation market. He leads the Tech Valley .NET
User Group in Albany, NY.
@anotherlab
http://www.rajapet.com
Who we are: James Montemagno
James Montemagno is a Developer Evangelist at
Xamarin. He has been a .NET developer for over a
decade working in a wide range of industries including
game development, printer software, and web services.
Previously, James was a professional mobile developer
on the Xamarin platform for over 3 years, with several
published apps on iOS, Android, and Windows.
@JamesMontemagno
http://motzcod.es/
What is localization?
Localization is the process that you follow to allow your web site or
application to support multiple languages and locales.
Why should you localize your app?
• Greater Exposure
• Easy Deployment
• Business or Legal requirements
Why should you localize your app?
Why should you localize your app?
Why should you localize your app?
Why should you localize your app?
Know the localization problem
• What are the localization requirements for your app?
• How many languages do you need to support?
• Do you need to use right-to-left languages like Arabic or
Hebrew?
• Does your application have it's own or an industry specific set of
terminology?
Common terminology
Locale - The culture for the user
Language - The language used by the user. The same language in
different countries can have different spelling and grammar rules.
Culture/UICulture - The .NET representation of a locale. Culture is
the locale, UICulture the language.
Example Images
Stop Sign (USA) Stop Sign (France)
Example Images
• Stop Sign (Japan)
Gender
• English is usually gender neutral, other languages are not.
Plural Forms
• The common pattern in English is the singular/plural form
• Asian languages typically use just a single from
• French and Brazilian Portuguese use a different singular/plural
form.
• Then it gets complicated. See https://developer.mozilla.org/en-
US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plu
ral_Rules for a long list of rules.
• Use the “Noun : Pattern” instead
• New Messages: 1
The tools that I use
• Visual Studio 2013/2015
• Xamarin (both on OS X and as a VS plugin)
• Multilingual App Toolkit (MAT)
Create native iOS, Android, Mac and
Windows apps in Visual Studio and C#
About Xamarin
Xamarin’s Unique Approach
• Native User Interface
• Native Performance
• Shared code across
platforms
• C# & .NET Framework
• Full API Coverage
Xamarin’s Unique Approach
With Xamarin.Forms:
more code-sharing, native controls
Xamarin
First
release of
Xamarin.Mac
Launch
Partner
Program
200,000
Developers
Xamarin
Founded
First release of
Xamarin.Android
Xamarin.iOS
launches (originally
known as
MonoTouch)
Ximian
Founded
Over a Decade of Enterprise Production Use
2001 2003 2009 2011 2012 2013
Mono
Launches
Ximian Acquired
by Novell
Xamarin 2.0
Component Store
Xamarin Test Cloud
Evolve 2013
Microsoft Partnership
500,000
Developers
100+ Partners
100+ Components
2014
//
Xamarin 3
2000
SAP Partnership
Fire TV Support
Salesforce partnership
Visionary in Gartner
Magic Quadrant
Google Glass Support
Visual Studio Partner
of the Year
Android Wear Support
Xamarin Evolve 2014
800,000
Developers
200+ Partners
200+ Components
Xamarin
• Provides a .NET development environment for C# and F# on iOS
and Android.
• Supports PCL libraries and shared projects.
• Compiles to native code and provides full access to native APIs.
• Xamarin.Forms provides an abstraction layer that lets you write
for that will compile and run as
• Has a plugin for Visual Studio and their own IDE called Xamarin
Studio for Windows and OS X.
• iOS development still requires an OS X machine for the
compilation and debugging.
Xamarin – Two Ways
• Xamarin.iOS and Xamarin.Android
• Xamarin.Forms
How to manage the language files
• Pick one application as the source for the string resources. This
works best for Xamarin.Forms applications. It can be done for
Xamarin.Android and Xamarin.iOS but requires some extra work
to generate the Android and iOS resource files from the Windows
RESX files.
• Have app specific sets of resource files and use tooling to
manage the language files.
Windows Store & Windows Phone
• We just need to create the .resx files for the locales to support
and let the .NET Runtime do the heavy lifting.
• Use the Multilingual App Toolkit in Visual Studio to manage the
resource files.
Xamarin.iOS
• Create the resource string files and put them in the proper
location.
• File should be named Localizable.strings and placed in a folders
for each language, with the folder name using the language code
+ .lproj. To localize the app name, set CFBundleDisplayName
in InfoPlist.strings
– en.lproj for English
– es.lproj for Spanish
• Prior to iOS 8, only the language code was supported. iOS 8
added support for locales.
Xamarin.iOS
• In Xamarin.iOS, we need to call LocalizedString, which maps to
iOS’s localizedStringForKey method to do the language look up.
• That’s too much work.
• Let’s add a string extension method to make it easy to use.
Xamarin.iOS string extension
A helper class for setting the translated text
Xamarin.iOS string extension
Some examples…
Xamarin.Android
Create the default resource files, plus additional resources for each
language supported. Strings, layouts, images, any resource can be
localized.
While you can create alternate layouts for more verbose languages
(e.g. German), this will make your app harder to maintain.
Converting RESX to iOS & Android
• iOS & Android use text files for string resources.
– iOS uses flat text file
– Android uses a XML format similar to RESX
• Use the same constants for each platform for shared resources.
We can convert this RESX file
To iOS/Android string resources
• iOS
• Android
Xamarin.Forms
• Single UI to target Android, iOS, and Windows Phone apps.
• Common set of controls that map to native controls at runtime.
• UI can be built from XAML markup or C# code.
• Can be mixed with Xamarin.iOS & Xamarin.Android.
Multilingual App Toolkit
• Is XLIFF based, an industry standard file format for resource
translations. Provides a basic audit trail of translated text values.
• Will make language specific versions of your string RESX files.
• Knows about Xamarin.iOS and Xamarin.Android and generates
their string resource files.
• Can machine translate resource files using Bing.
• Get it from https://dev.windows.com/en-us/develop/multilingual-
app-toolkit
Localization with Xamarin.Forms
• Not explicitly supported out of the box, but easy to implement.
• Xamarin has posted examples using RESX and Vernacular in their
forums.
• Works great with Multilingual App Toolkit
Multilingual App Toolkit
• Enable MAT for the project from the Tools menu
• Right-click on the project and select “Add translation languages…”
Multilingual App Toolkit
• Double-click on a XLIFF to edit it
Multilingual App Toolkit
• Right-click on a project to machine translate the XLF files
Localization with Xamarin.Forms
• Move the AppResources.resx from Windows Phone project to
shared PCL or create a new one in the PCL
• Create the localized versions of the RESX file with MAT
• Create an IMarkupExtension to do translations in the XAML
Getting the localized text in XAML
• Add your namespace
• Use the databinding to call the markup converter
Getting the localized text in code behind
• Just reference the resource file and resource id string
Right to Left (RTL) Support
• Target Android 4.2 or later.
– add android:supportsRtl="true" to the <application> element in
your manifest file
– Change all of your app's "left/right" layout properties to new
"start/end" equivalents
• iOS uses the Unicode Implicit Direction Mark Right-To-Left mark
(#200F) to set RTL in the UILabel control as a string prefix.
• Windows Phone uses FlowControl property, set automatically by
current culture.
• Xamarin.Forms does not have explicit support for RTL, it has to be
done manually.
Demo Time
General Tips
• Do one platform a time and using tooling to transform the
language resource files to the other platforms.
• Only do the languages that you need to do.
• Use a fake language to test coverage and layout. Scott
Hanselman has a tool to create a fake language.
(http://www.hanselman.com/blog/PsuedoInternationalizationAnd
YourASPNETApplication.aspx)
• Multilingual App Toolkit also generates a pseudo language.
General Tips
• To test different languages, set CurrentCulture and
CurrentUICulture in code.
• If you change the language on the device, use an emulator. It’s
not always easy to set the language back to your native choice.
• Language not showing up for Windows Phone? Make sure it’s
checked of under Supported Cultures
• To localize the app & tile title for Windows Phone you need to
create a separate resource dll. See
https://msdn.microsoft.com/library/windows/apps/ff967550%28v
=vs.105%29.aspx
• To localize the launcher name in Android, you will need to use
strings.xml in Resourcesvalues-xx-XX
General Tips
• Send the RESX or XLF to a commercial translation service.
• Hire someone to translate the resource files. Make sure that they
understand the domain and industry standard terms.
• If you can't afford a paid translation, Bing translate basic
terminology and crowd source it. Remember, you get what you
pay for.
General Tips
• If you are using 3rd party components, make sure that they can
be localized.
• Make sure to translate App Store text.
Thank You! …Questions?
The sample code from this presentation can be found on
https://github.com/anotherlab/TheDoctors
Chris Miller can be reached via
@anotherlab
http://www.rajapet.com
James Montemagno can be reached via
@JamesMontemagno
http://motzcod.es/
Resources - Platform
• Android
http://developer.android.com/guide/topics/resources/localization.
html
• Apple
https://developer.apple.com/internationalization/
• Windows Phone
http://msdn.microsoft.com/en-
us/library/windowsphone/develop/ff637522(v=vs.105).aspx
• Windows Store
http://msdn.microsoft.com/en-
us/library/windows/apps/hh710212.aspx
Resources
• Xamarin
http://xamarin.com/
• Vernacular
https://github.com/rdio/vernacular
• Third Party Localization Vendors
https://developer.apple.com/internationalization/#vendors
• Some information about XLIFF
http://info.moravia.com/blog/bid/354057/What-s-So-Sexy-
About-XLIFF-2-0
Resources - Multilingual App Toolkit
• Blog
http://blogs.msdn.com/b/matdev/
• User Voice
http://multilingualapptoolkit.uservoice.com/
• Installation
https://dev.windows.com/en-us/develop/multilingual-app-toolkit

More Related Content

Similar to MVP Virtual Conference - Americas 2015 - Cross platform localization for mobile apps

Which Language Is Best For iOS App Development.pdf
Which Language Is Best For iOS App Development.pdfWhich Language Is Best For iOS App Development.pdf
Which Language Is Best For iOS App Development.pdfQServices Inc.
 
Laura Dent: Single-Source and Localization
Laura Dent: Single-Source and LocalizationLaura Dent: Single-Source and Localization
Laura Dent: Single-Source and LocalizationJack Molisani
 
Run your app on every Windows Phone 8.1 device in the world
Run your app on every Windows Phone 8.1 device in the worldRun your app on every Windows Phone 8.1 device in the world
Run your app on every Windows Phone 8.1 device in the worldbartlannoeye
 
What makes Flutter the best cross platform sdk
What makes Flutter the best cross platform sdkWhat makes Flutter the best cross platform sdk
What makes Flutter the best cross platform sdkExpeed Software
 
Mono for Android... for Google Devs
Mono for Android... for Google DevsMono for Android... for Google Devs
Mono for Android... for Google DevsCraig Dunn
 
Best 4 Cross-Platform App Development Frameworks For Mobile Apps
Best 4 Cross-Platform App Development Frameworks For Mobile AppsBest 4 Cross-Platform App Development Frameworks For Mobile Apps
Best 4 Cross-Platform App Development Frameworks For Mobile AppsCerebrum Infotech
 
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate0112eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01Ankush Kumar
 
Cross-Platform Mobile Development using Visual Studio and Xamarin
Cross-Platform Mobile Development using Visual Studio and XamarinCross-Platform Mobile Development using Visual Studio and Xamarin
Cross-Platform Mobile Development using Visual Studio and XamarinShravan Kumar Kasagoni
 
Comparisons react native vs. flutter vs. ionic vs. xamarin vs. native script
Comparisons  react native vs. flutter vs. ionic vs. xamarin vs. native scriptComparisons  react native vs. flutter vs. ionic vs. xamarin vs. native script
Comparisons react native vs. flutter vs. ionic vs. xamarin vs. native scriptMoonTechnolabsPvtLtd
 
MobApp development 01 application platform.pptx
MobApp development 01 application platform.pptxMobApp development 01 application platform.pptx
MobApp development 01 application platform.pptxsanaiftikhar23
 
Universal Apps Oct 2014
Universal Apps Oct 2014Universal Apps Oct 2014
Universal Apps Oct 2014Joe Healy
 
Introduction to programming world
Introduction to programming worldIntroduction to programming world
Introduction to programming worldJaskaran Singh
 
Ch1- Introduction.ppt
Ch1- Introduction.pptCh1- Introduction.ppt
Ch1- Introduction.pptRaniaZiedan
 
Build your own Language - Why and How?
Build your own Language - Why and How?Build your own Language - Why and How?
Build your own Language - Why and How?Markus Voelter
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfpercivalfernandez2
 
Introduction to Xamarin Development
Introduction to Xamarin DevelopmentIntroduction to Xamarin Development
Introduction to Xamarin DevelopmentIsham Mohamed Iqbal
 

Similar to MVP Virtual Conference - Americas 2015 - Cross platform localization for mobile apps (20)

Which Language Is Best For iOS App Development.pdf
Which Language Is Best For iOS App Development.pdfWhich Language Is Best For iOS App Development.pdf
Which Language Is Best For iOS App Development.pdf
 
Laura Dent: Single-Source and Localization
Laura Dent: Single-Source and LocalizationLaura Dent: Single-Source and Localization
Laura Dent: Single-Source and Localization
 
Swift vs. Language X
Swift vs. Language XSwift vs. Language X
Swift vs. Language X
 
Programming landuages
Programming landuagesProgramming landuages
Programming landuages
 
Run your app on every Windows Phone 8.1 device in the world
Run your app on every Windows Phone 8.1 device in the worldRun your app on every Windows Phone 8.1 device in the world
Run your app on every Windows Phone 8.1 device in the world
 
What makes Flutter the best cross platform sdk
What makes Flutter the best cross platform sdkWhat makes Flutter the best cross platform sdk
What makes Flutter the best cross platform sdk
 
Mono for Android... for Google Devs
Mono for Android... for Google DevsMono for Android... for Google Devs
Mono for Android... for Google Devs
 
Programming language
Programming languageProgramming language
Programming language
 
Best 4 Cross-Platform App Development Frameworks For Mobile Apps
Best 4 Cross-Platform App Development Frameworks For Mobile AppsBest 4 Cross-Platform App Development Frameworks For Mobile Apps
Best 4 Cross-Platform App Development Frameworks For Mobile Apps
 
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate0112eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
 
Cross-Platform Mobile Development using Visual Studio and Xamarin
Cross-Platform Mobile Development using Visual Studio and XamarinCross-Platform Mobile Development using Visual Studio and Xamarin
Cross-Platform Mobile Development using Visual Studio and Xamarin
 
Comparisons react native vs. flutter vs. ionic vs. xamarin vs. native script
Comparisons  react native vs. flutter vs. ionic vs. xamarin vs. native scriptComparisons  react native vs. flutter vs. ionic vs. xamarin vs. native script
Comparisons react native vs. flutter vs. ionic vs. xamarin vs. native script
 
MobApp development 01 application platform.pptx
MobApp development 01 application platform.pptxMobApp development 01 application platform.pptx
MobApp development 01 application platform.pptx
 
Universal Apps Oct 2014
Universal Apps Oct 2014Universal Apps Oct 2014
Universal Apps Oct 2014
 
Introduction to programming world
Introduction to programming worldIntroduction to programming world
Introduction to programming world
 
Ch1- Introduction.ppt
Ch1- Introduction.pptCh1- Introduction.ppt
Ch1- Introduction.ppt
 
Build your own Language - Why and How?
Build your own Language - Why and How?Build your own Language - Why and How?
Build your own Language - Why and How?
 
Progamming Path.pptx
Progamming Path.pptxProgamming Path.pptx
Progamming Path.pptx
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdf
 
Introduction to Xamarin Development
Introduction to Xamarin DevelopmentIntroduction to Xamarin Development
Introduction to Xamarin Development
 

Recently uploaded

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 

MVP Virtual Conference - Americas 2015 - Cross platform localization for mobile apps

  • 1. Cross-Platform Localization for Mobile Apps Using .NET Chris Miller, Tyler Technologies James Montemagno, Xamarin May 15th, 2015 May 14 – 15, 2015 2015 Microsoft MVP Virtual Conference
  • 2. Who we are : Chris Miller Chris is a Senior R&D Engineer for Tyler Technologies, Currently working on mobile apps for the K-12 transportation market. He leads the Tech Valley .NET User Group in Albany, NY. @anotherlab http://www.rajapet.com
  • 3. Who we are: James Montemagno James Montemagno is a Developer Evangelist at Xamarin. He has been a .NET developer for over a decade working in a wide range of industries including game development, printer software, and web services. Previously, James was a professional mobile developer on the Xamarin platform for over 3 years, with several published apps on iOS, Android, and Windows. @JamesMontemagno http://motzcod.es/
  • 4. What is localization? Localization is the process that you follow to allow your web site or application to support multiple languages and locales.
  • 5. Why should you localize your app? • Greater Exposure • Easy Deployment • Business or Legal requirements
  • 6. Why should you localize your app?
  • 7. Why should you localize your app?
  • 8. Why should you localize your app?
  • 9. Why should you localize your app?
  • 10. Know the localization problem • What are the localization requirements for your app? • How many languages do you need to support? • Do you need to use right-to-left languages like Arabic or Hebrew? • Does your application have it's own or an industry specific set of terminology?
  • 11. Common terminology Locale - The culture for the user Language - The language used by the user. The same language in different countries can have different spelling and grammar rules. Culture/UICulture - The .NET representation of a locale. Culture is the locale, UICulture the language.
  • 12. Example Images Stop Sign (USA) Stop Sign (France)
  • 13. Example Images • Stop Sign (Japan)
  • 14. Gender • English is usually gender neutral, other languages are not.
  • 15. Plural Forms • The common pattern in English is the singular/plural form • Asian languages typically use just a single from • French and Brazilian Portuguese use a different singular/plural form. • Then it gets complicated. See https://developer.mozilla.org/en- US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plu ral_Rules for a long list of rules. • Use the “Noun : Pattern” instead • New Messages: 1
  • 16. The tools that I use • Visual Studio 2013/2015 • Xamarin (both on OS X and as a VS plugin) • Multilingual App Toolkit (MAT)
  • 17. Create native iOS, Android, Mac and Windows apps in Visual Studio and C# About Xamarin
  • 18. Xamarin’s Unique Approach • Native User Interface • Native Performance • Shared code across platforms • C# & .NET Framework • Full API Coverage
  • 19. Xamarin’s Unique Approach With Xamarin.Forms: more code-sharing, native controls
  • 20. Xamarin First release of Xamarin.Mac Launch Partner Program 200,000 Developers Xamarin Founded First release of Xamarin.Android Xamarin.iOS launches (originally known as MonoTouch) Ximian Founded Over a Decade of Enterprise Production Use 2001 2003 2009 2011 2012 2013 Mono Launches Ximian Acquired by Novell Xamarin 2.0 Component Store Xamarin Test Cloud Evolve 2013 Microsoft Partnership 500,000 Developers 100+ Partners 100+ Components 2014 // Xamarin 3 2000 SAP Partnership Fire TV Support Salesforce partnership Visionary in Gartner Magic Quadrant Google Glass Support Visual Studio Partner of the Year Android Wear Support Xamarin Evolve 2014 800,000 Developers 200+ Partners 200+ Components
  • 21. Xamarin • Provides a .NET development environment for C# and F# on iOS and Android. • Supports PCL libraries and shared projects. • Compiles to native code and provides full access to native APIs. • Xamarin.Forms provides an abstraction layer that lets you write for that will compile and run as • Has a plugin for Visual Studio and their own IDE called Xamarin Studio for Windows and OS X. • iOS development still requires an OS X machine for the compilation and debugging.
  • 22. Xamarin – Two Ways • Xamarin.iOS and Xamarin.Android • Xamarin.Forms
  • 23. How to manage the language files • Pick one application as the source for the string resources. This works best for Xamarin.Forms applications. It can be done for Xamarin.Android and Xamarin.iOS but requires some extra work to generate the Android and iOS resource files from the Windows RESX files. • Have app specific sets of resource files and use tooling to manage the language files.
  • 24. Windows Store & Windows Phone • We just need to create the .resx files for the locales to support and let the .NET Runtime do the heavy lifting. • Use the Multilingual App Toolkit in Visual Studio to manage the resource files.
  • 25. Xamarin.iOS • Create the resource string files and put them in the proper location. • File should be named Localizable.strings and placed in a folders for each language, with the folder name using the language code + .lproj. To localize the app name, set CFBundleDisplayName in InfoPlist.strings – en.lproj for English – es.lproj for Spanish • Prior to iOS 8, only the language code was supported. iOS 8 added support for locales.
  • 26. Xamarin.iOS • In Xamarin.iOS, we need to call LocalizedString, which maps to iOS’s localizedStringForKey method to do the language look up. • That’s too much work. • Let’s add a string extension method to make it easy to use.
  • 27. Xamarin.iOS string extension A helper class for setting the translated text
  • 29. Xamarin.Android Create the default resource files, plus additional resources for each language supported. Strings, layouts, images, any resource can be localized. While you can create alternate layouts for more verbose languages (e.g. German), this will make your app harder to maintain.
  • 30. Converting RESX to iOS & Android • iOS & Android use text files for string resources. – iOS uses flat text file – Android uses a XML format similar to RESX • Use the same constants for each platform for shared resources.
  • 31. We can convert this RESX file
  • 32. To iOS/Android string resources • iOS • Android
  • 33. Xamarin.Forms • Single UI to target Android, iOS, and Windows Phone apps. • Common set of controls that map to native controls at runtime. • UI can be built from XAML markup or C# code. • Can be mixed with Xamarin.iOS & Xamarin.Android.
  • 34. Multilingual App Toolkit • Is XLIFF based, an industry standard file format for resource translations. Provides a basic audit trail of translated text values. • Will make language specific versions of your string RESX files. • Knows about Xamarin.iOS and Xamarin.Android and generates their string resource files. • Can machine translate resource files using Bing. • Get it from https://dev.windows.com/en-us/develop/multilingual- app-toolkit
  • 35. Localization with Xamarin.Forms • Not explicitly supported out of the box, but easy to implement. • Xamarin has posted examples using RESX and Vernacular in their forums. • Works great with Multilingual App Toolkit
  • 36. Multilingual App Toolkit • Enable MAT for the project from the Tools menu • Right-click on the project and select “Add translation languages…”
  • 37. Multilingual App Toolkit • Double-click on a XLIFF to edit it
  • 38. Multilingual App Toolkit • Right-click on a project to machine translate the XLF files
  • 39. Localization with Xamarin.Forms • Move the AppResources.resx from Windows Phone project to shared PCL or create a new one in the PCL • Create the localized versions of the RESX file with MAT • Create an IMarkupExtension to do translations in the XAML
  • 40. Getting the localized text in XAML • Add your namespace • Use the databinding to call the markup converter
  • 41. Getting the localized text in code behind • Just reference the resource file and resource id string
  • 42. Right to Left (RTL) Support • Target Android 4.2 or later. – add android:supportsRtl="true" to the <application> element in your manifest file – Change all of your app's "left/right" layout properties to new "start/end" equivalents • iOS uses the Unicode Implicit Direction Mark Right-To-Left mark (#200F) to set RTL in the UILabel control as a string prefix. • Windows Phone uses FlowControl property, set automatically by current culture. • Xamarin.Forms does not have explicit support for RTL, it has to be done manually.
  • 44. General Tips • Do one platform a time and using tooling to transform the language resource files to the other platforms. • Only do the languages that you need to do. • Use a fake language to test coverage and layout. Scott Hanselman has a tool to create a fake language. (http://www.hanselman.com/blog/PsuedoInternationalizationAnd YourASPNETApplication.aspx) • Multilingual App Toolkit also generates a pseudo language.
  • 45. General Tips • To test different languages, set CurrentCulture and CurrentUICulture in code. • If you change the language on the device, use an emulator. It’s not always easy to set the language back to your native choice. • Language not showing up for Windows Phone? Make sure it’s checked of under Supported Cultures • To localize the app & tile title for Windows Phone you need to create a separate resource dll. See https://msdn.microsoft.com/library/windows/apps/ff967550%28v =vs.105%29.aspx • To localize the launcher name in Android, you will need to use strings.xml in Resourcesvalues-xx-XX
  • 46. General Tips • Send the RESX or XLF to a commercial translation service. • Hire someone to translate the resource files. Make sure that they understand the domain and industry standard terms. • If you can't afford a paid translation, Bing translate basic terminology and crowd source it. Remember, you get what you pay for.
  • 47. General Tips • If you are using 3rd party components, make sure that they can be localized. • Make sure to translate App Store text.
  • 48. Thank You! …Questions? The sample code from this presentation can be found on https://github.com/anotherlab/TheDoctors Chris Miller can be reached via @anotherlab http://www.rajapet.com James Montemagno can be reached via @JamesMontemagno http://motzcod.es/
  • 49. Resources - Platform • Android http://developer.android.com/guide/topics/resources/localization. html • Apple https://developer.apple.com/internationalization/ • Windows Phone http://msdn.microsoft.com/en- us/library/windowsphone/develop/ff637522(v=vs.105).aspx • Windows Store http://msdn.microsoft.com/en- us/library/windows/apps/hh710212.aspx
  • 50. Resources • Xamarin http://xamarin.com/ • Vernacular https://github.com/rdio/vernacular • Third Party Localization Vendors https://developer.apple.com/internationalization/#vendors • Some information about XLIFF http://info.moravia.com/blog/bid/354057/What-s-So-Sexy- About-XLIFF-2-0
  • 51. Resources - Multilingual App Toolkit • Blog http://blogs.msdn.com/b/matdev/ • User Voice http://multilingualapptoolkit.uservoice.com/ • Installation https://dev.windows.com/en-us/develop/multilingual-app-toolkit

Editor's Notes

  1. Hi, I am Chris Miller and I’ll be your presenter for this session. I’m a 2 year MVP and I work on mobile apps using .NET
  2. James Montemagno will be our moderator today. James is a developer evangelist for Xamarin and a first year MVP
  3. In addition to the language, this includes how dates and times are presented. It also determines how numbers are displayed.
  4. Greater Exposure: The app stores are world wide, why only target one culture? App stores give you a single click deployment to 150 countries. Business or Legal requirements: Some markets may require bi-lingual apps. Canada, must do French and English
  5. The top market for iOS apps is now China
  6. Canada, must do French and English
  7. Canada, must do French and English You see Android and Windows Phone have growing percentages in markets where the phones are not subsidized by the carriers
  8. Do you even need to localized your What markets do you need to target RTL requires additional work Terminology is import. A given word or phrase can be translated differently, entirely on the context
  9. Locale: This is the language matched to the country. It also includes how dates, numbers, and currency are displayed. Language: The same language in different countries can have different spelling and grammar rules. Why have two separate setting? Sometimes the user’s language may not have translated text, but the locale settings are available. Some people may prefer to have to have their app displayed in English, but use their own locale.  Canada has two languages for one locale.  Having added a section that refers to manually setting CurrentCulture and CurrentUICulture,
  10. It’s more than just text. The same visual asset could require images specific to the locale. If you take a look at the stop, it’s a universal symbol. But is it? The stop sign in the US and the stop sign in France have the same shape and color, but the text is very different. If you go to another country, it could have a completely different shape.
  11. While the color stayed the same, the shape and text are completely different Color has cultural significance Be careful when using color to indicate a state. In Western cultures, the color red is often used to indicate an error or as a danger signal. In China, the color red indicates good news.
  12. In English, the definite article “the” is gender neutral. Many languages, such as French and Spanish, assign a gender to a noun and their equivalent of “the” depends on the gender of that noun. Press the button. Edit the photo. In French, they could be translated as: Pressez le bouton Modifier la photo For these examples, you translate the entire sentence. If you’re creating the sentence at runtime and the noun is selected by the users, you need a way of determining the gender of the noun.
  13. f you can avoid having to use plural forms, your code will be simpler. Instead of using the singular and plural forms for the number of emails, put the number at the end like this: New messages: 1 That works for any quantity, including 0. Another reason to use this method is that it uses less screen real estate, which is always a premium on a mobile phone.
  14. The Multilingual App Toolkit works with Visual Studio to streamline your localization workflow for mobile, web, and desktop apps. The toolkit helps you localize your apps with localization file management, translation support, and editing tools. Since the last session was all about Xamarin, I’m going to jump over the “this is Xamarin” part of the presentation. If you have any questions about Xamarin, please ask
  15. We are going to whip through the Xamarin slides at high speed
  16. UI build natively per platform, leveraging C# C# + XAML C# + XML C# + XIB One shared app logic code base, iOS, Android, Mac, Windows Phone, Windows Store, Windows
  17. Xamarin recently introduced Xamarin.Forms a new library for cross platform user interface. We will touch up on this later, but this enables you to be highly productive, share code, but build out UI on each platform and access platform APIs. With Xamarin.Forms you now have a nice Shared UI Code layer, but still access to platform APIs You can start from native, pick a few screens, or start with forms, and replace with native later
  18. Xamarin recently announced that they have 1 million registered users
  19. Two main ways of writing mobile apps. Xamarin.iOS and Xamarin.Android, where you write to the native UI for each platform. Windows Phone is done using the Microsoft SDKs. Xamarin.Forms, where you use a common UI that maps to the native platform UI (Android, iOS, Windows Phone.
  20. Jump to the code
  21. Jump to the code
  22. LocalizedString maps to iOS’s localizedStringForKey method. 2nd & 3rd parameters are for default value and resource table.
  23. LocalizedString maps to iOS’s localizedStringForKey method. 2nd & 3rd parameters are for default value and resource table.
  24. Still a moving target
  25. XML formatted file based on the XLIFF (XML Localization Interchange File Format) specification developed by the OASIS Technical Committee; used as a standard means of exchanging localizable data and related information in a lossless format. MAT is free and installs in every edition of VS
  26. Vernacular is an open source library and set of tools from RDIO. It’s based on the Liniux GetText Jump to the code
  27. You can see the list of supported languages with the language and country code An xlf file will be generated for the selected language
  28. When you build the project the language specific resx file will be generated from the XLF file An upcoming release of MAT will allow you to export out only new additions to a resource file.  If you are paying for commercial translation, it would be easy to just send out the new text to translated,
  29. When you build the app, associated resource files are generated for each platform.
  30. Now it’s time to localize an app This IMarkupExtension allows us to bind our controls and not have to worry about the mechanics ResourceManager is a class that allows use to request the culture specific version of the text that we want to look up. In this case the Text field is the resource id of the text to look up. If a culture specific string can’t be located, it will use the default language.
  31. And the great thing here is that you get full Intellisense For anyone that is curious about what this line of code does: The iOS version of the app looked odd with a page title. Device.OnPlatform is a method with Xamarin.Forms that takes a value for iOS, Android, and Windows Phone. It returns the value for the platform that is running the code. In other words on iOS, we get an empty string, everything else gets the DetailsTitle
  32. This is mainly for Xamarin.Android, Xamarin.iOS, Windows Phone. Not sure how XF handles this
  33. Run the Android 5 version of the app to show it in English Jump back to VS and show English resx Gen the French resx Show the iMarkup converter Show the XAML Show the plist for ios and strings for Android