+ All Categories
Home > Documents > App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates •...

App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates •...

Date post: 27-Jul-2020
Category:
Upload: others
View: 4 times
Download: 0 times
Share this document with a friend
78
#WWDC17 © 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Joaquim Lobo Silva, Internationalization Software Engineer Localization Best Practices on tvOS Session 248 App Frameworks
Transcript
Page 1: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

#WWDC17

© 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

Joaquim Lobo Silva, Internationalization Software Engineer

•Localization Best Practices on tvOS • Session 248

App Frameworks

Page 2: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding
Page 3: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

•Text •Layout and images •Exporting and testing

Page 4: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

•Text •Layout and images •Exporting and testing

Page 5: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Page 6: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Strings in Storyboards are localizable by default

Page 7: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Strings in Storyboards are localizable by default

In code, wrap strings with NSLocalizedString() calls

Page 8: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Strings in Storyboards are localizable by default

In code, wrap strings with NSLocalizedString() calls

Comments are extremely useful

Page 9: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Strings in Storyboards are localizable by default

In code, wrap strings with NSLocalizedString() calls

Comments are extremely usefullet instruction = NSLocalizedString("Subscribe", comment: "Button title, start subscription")

Page 10: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Strings in Storyboards are localizable by default

In code, wrap strings with NSLocalizedString() calls

Comments are extremely useful

Page 11: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Strings in Storyboards are localizable by default

In code, wrap strings with NSLocalizedString() calls

Comments are extremely useful

Page 12: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Page 13: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Not everything needs to be a localized string literal

Page 14: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Not everything needs to be a localized string literal

Formatters for numbers, dates and date intervals, units, etc.

Page 15: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Not everything needs to be a localized string literal

Formatters for numbers, dates and date intervals, units, etc.

let formatter = DateFormatter()

Page 16: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Not everything needs to be a localized string literal

Formatters for numbers, dates and date intervals, units, etc.

let formatter = DateFormatter()

formatter.timeStyle = .shortlet string = formatter.string(from: date) // 9:41 AM

Page 17: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text

Not everything needs to be a localized string literal

Formatters for numbers, dates and date intervals, units, etc.

let formatter = DateFormatter()

formatter.timeStyle = .shortlet string = formatter.string(from: date) // 9:41 AM

Measurements and Units WWDC 2016

Internationalization Best Practices WWDC 2016

Page 18: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Remote Content

Page 19: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Remote Content

Remote text should match your app's language

Page 20: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Remote Content

Remote text should match your app's language• e.g. media content and descriptions

Page 21: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Remote Content

Remote text should match your app's language• e.g. media content and descriptions

APIs to determine best language to display

Page 22: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Remote Content

Remote text should match your app's language• e.g. media content and descriptions

APIs to determine best language to display

Considers regional variants and appropriate fallbacks

Page 23: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Remote Content

Remote text should match your app's language• e.g. media content and descriptions

APIs to determine best language to display

Considers regional variants and appropriate fallbacks

Locale.preferredLanguages bundle.localizations bundle.preferredLocalizations

es-MX en, en-GB, es-ES, es-419, zh-Hans es-419

zh-CN en, es, fr, ja, ko, zh-Hans, zh-Hant zh-Hans

Page 24: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

// Get the localization the app is currently launched in

let currentLocalization = Bundle.main.preferredLocalizations.first

// Get best localization match from a list of available localizations

let available = myServerSupportedLanguages()

let matchedLocalization = Bundle.preferredLocalizations(from: available).first

Page 25: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

// Get the localization the app is currently launched in

let currentLocalization = Bundle.main.preferredLocalizations.first

// Get best localization match from a list of available localizations

let available = myServerSupportedLanguages()

let matchedLocalization = Bundle.preferredLocalizations(from: available).first

Page 26: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

// Get the localization the app is currently launched in

let currentLocalization = Bundle.main.preferredLocalizations.first

// Get best localization match from a list of available localizations

let available = myServerSupportedLanguages()

let matchedLocalization = Bundle.preferredLocalizations(from: available).first

Page 27: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Text Summary

Use strings in Storyboards

Use NSLocalizedString

Use formatters

Use Bundle APIs to determine language for remote content

Page 28: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

•Text •Layout and images •Exporting and testing

Page 29: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout

Page 30: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout

Adapt for…

Page 31: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout

Adapt for…• Different translation lengths

Page 32: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout

Adapt for…• Different translation lengths

BackupEnglish

Page 33: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout

Adapt for…• Different translation lengths

Backup VarmuuskopiointiEnglish Finnish

Page 34: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout

Adapt for…• Different translation lengths

• Script directionality

Backup VarmuuskopiointiEnglish Finnish

Page 35: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout

Adapt for…• Different translation lengths

• Script directionality

Backup VarmuuskopiointiEnglish Finnish

HelloEnglish

Page 36: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout

Adapt for…• Different translation lengths

• Script directionality

Backup VarmuuskopiointiEnglish Finnish

Hello مرحبًاEnglish Arabic

Page 37: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in UIKit

Page 38: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in UIKit

UIStackView

Page 39: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in UIKit

UIStackView

1

23 4

Page 40: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in UIKit

UIStackView

1

23 4

Left-to-Right

Page 41: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in UIKit

UIStackView

1

23 4

Left-to-Right

Auto Layout: Leading/trailing constraints

Page 42: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in UIKit

UIStackView

1

23 4

Left-to-Right

Auto Layout: Leading/trailing constraints• Leading resolves to left in left-to-right, right in right-to-left

Page 43: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in UIKit

UIStackView

Right-to-Left

1

234

Auto Layout: Leading/trailing constraints • Leading resolves to left in left-to-right, right in right-to-left

Page 44: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in UIKit

UIStackView

Right-to-Left

1

234

Auto Layout: Leading/trailing constraints • Leading resolves to left in left-to-right, right in right-to-left

Page 45: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout in TVMLKitNEW

Page 46: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Templates do all the work

Layout in TVMLKitNEW

Page 47: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Templates do all the work

For custom positioning:

Layout in TVMLKitNEW

Page 48: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Templates do all the work

For custom positioning:• leading and trailing tv-position and tv-align

Layout in TVMLKitNEW

Page 49: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Templates do all the work

For custom positioning:• leading and trailing tv-position and tv-align

- leading resolves to left in left-to-right, right in right-to-left

Layout in TVMLKitNEW

Page 50: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Templates do all the work

For custom positioning:• leading and trailing tv-position and tv-align

- leading resolves to left in left-to-right, right in right-to-left• @(media layout-direction: rtl) media queries for margins and padding

Layout in TVMLKitNEW

Page 51: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Templates do all the work

For custom positioning:• leading and trailing tv-position and tv-align

- leading resolves to left in left-to-right, right in right-to-left• @(media layout-direction: rtl) media queries for margins and padding

Layout in TVMLKit

Advances in TVMLKit Grand Ballroom B Tuesday 11:20AM

NEW

Page 52: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Page 53: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Universal

Page 54: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Universal Mirrored

Page 55: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Universal Mirrored

Page 56: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Universal Mirrored Dedicated

Page 57: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Universal Mirrored Dedicated

Page 58: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Universal Mirrored Dedicated

Page 59: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Page 60: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

Page 61: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Images

What’s New in International User Interfaces WWDC 2016

Page 62: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Layout and Images Summary

UIKit • UIStackView • Auto Layout

TVMLKit • Templates • New direction APIs

Page 63: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

•Text •Layout and images •Exporting and testing

Page 64: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Adding Languages to Your Project

Page 65: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Adding Languages to Your Project

Page 66: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Exporting Your Localizable Content

Page 67: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Importing Translated Content

Page 68: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Testing

Page 69: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Testing

Xcode has several features for testing and verification

Page 70: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Testing

Xcode has several features for testing and verification

Even if you don't speak the language!

Page 71: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Testing

Xcode has several features for testing and verification

Even if you don't speak the language!• Localizability static analyzer

Page 72: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Testing

Xcode has several features for testing and verification

Even if you don't speak the language! • Localizability static analyzer • Pseudolanguages

Page 73: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Testing

Page 74: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Testing

Xcode has several features for testing and verification

Even if you don't speak the language! • Localizability static analyzer • Pseudolanguages

Localizing with Xcode 9 Grand Ballroom B Tuesday 10:20AM

Page 75: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Project Setup Summary

Add supported languages to your project

Export and import localizable content

Static analyzer and runtime pseudolanguages

Page 76: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

More Informationhttps://developer.apple.com/wwdc17/248

Page 77: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Localizing with Xcode 9 Grand Ballroom B Tuesday 10:20AM

Advances in TVMLKit Grand Ballroom B Tuesday 11:20AM

Internationalization Best Practices WWDC 2016

What’s New in International User Interfaces WWDC 2016

Measurements and Units WWDC 2016

Related Sessions

Page 78: App Frameworks #WWDC17 - Apple Developer...• UIStackView • Auto Layout TVMLKit • Templates • New direction APIs • Text • Layout and images • Exporting and testing Adding

Recommended