UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

How to localize your apps more easily

Take your app around the world with smarter, simpler code

Paul Hudson       @twostraws

Localization is one of those topics that never seems to get in-depth coverage: most developers largely ignore the topic, and others don’t even know how it works.

Regardless of how much you already localize your apps, Marco Santarossa has written a great set of tips to help you get started, including:

  • Extending String to make your code shorter.
  • Switching to enums for extra safety.
  • Using @IBInspectable to localize UIKit components in IB.
  • Pluralizing strings with numbers.

I’ve written similar code for localizing UIKit components, but his enum approach is brilliant in its simplicity. Of course, if Xcode actually had codegen for strings this wouldn’t be a problem, but until then I suggest you check out his article. Don't worry if you're completely new to localization – Marco gives you just enough at the beginning to help you get started, so there really is no excuse for not trying it.

Link: App Localization Tips With Swift

Hacking with Swift is sponsored by Superwall

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

BUY OUR BOOKS
Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

Average rating: 4.5/5

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.