The document discusses localization best practices for Windows Phone apps. It covers topics like general localization best practices, differences between resources in Windows Phone 8 vs 8.1, the Multilingual App Toolkit, and using unique identifiers to access localized resources. The presentation includes demos of how to work with localized resources in both Windows Phone 8 and 8.1 projects. It also discusses using the "qps-ploc" pseudo language for testing localization and how the resource system supports localization in universal Windows apps.
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Run your app on every Windows Phone 8.1 device in the world
1. Your app on every
Windows Phone 8.1 device
in the world
20/10/2014
2. Who am I?
20/10/2014
Bart Lannoeye
@bartlannoeye
• MADN Board Member
• Microsoft MEET Member
• Full-time Win8 dev
3. • General localization best practices
• Resources in WP8 vs WP8.1 RT
• Multilingual App Toolkit
• But we can do more !
• Universal Apps
20/10/201
4
Agenda
4. • Sentences instead of single words
• The {0} could not be synchronized.
• Be aware of word order, or 1 vs multiple word parts
• Provide enough space
• Hint: English + 40%
• Tip: test with ‘qps-ploc’
• Multiline, text wrapping, trimming
• Watch out with re-use
• ‘Text’ can be noun & verb
• Use unique identifiers to access resources, as resource can
change
• Stick to a localization approach
• Easiest: keep translations till last
• Complexity: self-translated, outsourced, automated, …
20/10/201
4
Localization best practices
5. Windows Phone 8 (SL) Windows Phone 8.1 RT
20/10/201
4
Project setup
9. Windows Phone 8 (SL)
• Generated class with
classname = resources file
• MyClass with public prop to
expose the generated class
• App.xaml: declare MyClass in
Application.Resources
• Text="{Binding
Path=MyResources.Title,
Source={StaticResource
LocalizedStrings}}"
• Adding a new resources file
‘Inconsistent accessibility’
• Fix: use
PublicResXFileCodeGenerato
r
20/10/201
4
Resources in XAML (1)
11. Windows Phone 8 (SL) Windows Phone 8.1 RT
• Generated class with
classname = resources file
• MyClass with public prop to
expose the generated class
• App.xaml: declare MyClass in
Application.Resources
• Text="{Binding
Path=MyResources.Title,
Source={StaticResource
LocalizedStrings}}"
• <TextBlock x:Uid=“MyText” />
• In resource file:
MyText.Text SomeText
• Blackbox magic done for you
20/10/201
4
Resources in XAML (2)
12. Windows Phone 8 (SL) Windows Phone 8.1 RT
• Generated class with
classname = resources file
• Every resource is a static
property
• string text =
AppResources.SomeText
20/10/201
4
Resources in C#
14. Windows Phone 8 (SL) Windows Phone 8.1 RT
• Generated class with
classname = resources file
• Every resource is a static
property
• string text =
AppResources.SomeText
• new ResourceLoader()
or
ResourceLoader
.GetForCurrentView()
• string text =
_loader.GetString(key);
• MyUid.Text -> MyUid/Text
• Use id in ctor / GetFCV() to
access a given resource file
20/10/201
4
Resources in C#
15. • Download MAT:
https://dev.windows.com/en-us/develop/multilingual-app-toolkit
• Integrated with Visual Studio
• Microsoft Language Portal integration
• Localization from actual Microsoft Products (e.g. Office)
• Machine Translator integration
• Dedicated translator UI
• XLIFF files: localization industry standard
• Export – import files to send to 3rd party (xliff – csv)
• Warning for updates, preventing accidental overwrites
• Provides pseudo (qps-ploc) for testing
20/10/201
4
Multilingual App Toolkit
MAT v4 Tech Preview: support for Xamarin
16. • Machine generated for testing purposes
• Contains special characters and provides longer strings
• Some value [7B769][!!_Śóмé νàļúé_!!]
• Windows 8 / 8.1
• Add qps-ploc to your language preferences and place it on top of the list
• Windows Phone 8.1 RT
• Only available in code, not a selectable system language
ApplicationLanguages.PrimaryLanguageOverride = "qps-ploc";
Note: PrimaryLanguageOverride can also be used in Win8 to change at runtime
20/10/201
4
Pseudo (qps-ploc)
18. • Use resource system for most dependency properties
• Use resource system for different scaling factors
• Resource.scale-140.resw
• Image.scale-140.png
• Application name & other Appxmanifest properties
• ms-resource:AppName
• Offload resources to a separate assembly: specify path as Id
• new
ResourceLoader("App1.SomeResources/Resources").GetString("MyString");
• <TextBlock x:Uid="/App1.SomeResources/Resources/SomeControl" />
20/10/201
4
But we can do more !
20. • ‘Visual layer to increase tooling support over linked files’
• If:
• Resources work on Windows 8 / 8.1
• Resources work on Windows Phone 8.1 RT
• Universal Apps is ‘just linked files’
• Then the resources system works in Universal Apps as well (*)
• (*) Remarks:
• MAT only on Windows / Windows Phone project, not on Shared
• Use export – import to prevent translating twice
• Want .xliff files on 1 place? Use a PCL instead
20/10/201
4
Next step: Universal Apps
23. Keep in touch
Bart Lannoeye
@bartlannoeye
20/10/2014
www.madn.be
@MADNbe
Editor's Notes
ResourceMap (RT): http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.resources.core.resourcemap.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
Alternative:
https://reswcodegen.codeplex.com/ (but I don’t like it)
ResourceMap (RT): http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.resources.core.resourcemap.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
Alternative:
https://reswcodegen.codeplex.com/ (but I don’t like it)