run your app on every windows phone 8.1 device in the world
DESCRIPTION
Presentation on the resources system of Windows Phone RT / Windows 8.TRANSCRIPT
![Page 1: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/1.jpg)
Your app on every Windows Phone 8.1 device
in the world
14/04/2023
![Page 2: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/2.jpg)
Who am I?
14/04/2023
Bart Lannoeye@bartlannoeye
• MADN Board Member• Microsoft MEET Member• Full-time Win8 dev
![Page 3: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/3.jpg)
14/04/2023
• General localization best practices• Resources in WP8 vs WP8.1 RT• Multilingual App Toolkit• But we can do more !• Universal Apps
Agenda
![Page 4: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/4.jpg)
14/04/2023
• 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, …
Localization best practices
![Page 5: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/5.jpg)
14/04/2023
Windows Phone 8 (SL) Windows Phone 8.1 RT
Project setup
![Page 6: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/6.jpg)
14/04/2023
Demo
![Page 7: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/7.jpg)
14/04/2023
Windows Phone 8 (SL) Windows Phone 8.1 RT
.resx files don’t update ! .xlf files update on rebuildmachine generated translations
Project setup
![Page 8: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/8.jpg)
14/04/2023
Demo
![Page 9: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/9.jpg)
14/04/2023
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 PublicResXFileCodeGenerator
Resources in XAML (1)
![Page 10: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/10.jpg)
14/04/2023
Demo
![Page 11: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/11.jpg)
14/04/2023
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
Resources in XAML (2)
![Page 12: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/12.jpg)
14/04/2023
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
Resources in C#
![Page 13: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/13.jpg)
14/04/2023
Demo
![Page 14: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/14.jpg)
14/04/2023
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
Resources in C#
![Page 15: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/15.jpg)
14/04/2023
• 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
Multilingual App Toolkit
MAT v4 Tech Preview: support for Xamarin
![Page 16: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/16.jpg)
14/04/2023
• 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
Pseudo (qps-ploc)
![Page 17: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/17.jpg)
14/04/2023
Demo
![Page 18: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/18.jpg)
14/04/2023
• 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" />
But we can do more !
![Page 19: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/19.jpg)
14/04/2023
Demo
![Page 20: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/20.jpg)
14/04/2023
• ‘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
Next step: Universal Apps
![Page 21: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/21.jpg)
14/04/2023
Demo
![Page 22: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/22.jpg)
14/04/2023
![Page 23: Run your app on every Windows Phone 8.1 device in the world](https://reader034.vdocument.in/reader034/viewer/2022051400/55906e691a28ab2c228b45a4/html5/thumbnails/23.jpg)
Keep in touch
Bart Lannoeye@bartlannoeye
14/04/2023
www.madn.be@MADNbe