Localization is an important part of app development that is often skipped. Unfortunately this means that users not in your native language or region will have a lesser experience.
Localizing your apps gives you a bigger market of potential customers and gives your users a much better experience.
In this series we will show how to use the various tools at our disposal to provide a tailored experience for our users.
Length: about 1 hour
In this episode we will define what Localization is and why you should localize your apps.
Let's quickly review how to work with the Locale object. Then we can use various locales in conjunction with NumberFormatter and ListFormatter to have localized output provided for us.
Using DateFormatter we can format dates and times to whatever format we choose. However, in most cases we should rely instead on the builtin styles instead, which are locale aware. This way we can present dates and times that are consistent with the user's preferences.
There's a bit of prep work we need to do to get our project ready to be localized. We'll start by defining which languages we want to support, localize any interface-based files like Storyboards, and then move on to localizing strings in code.
In this episode I will show two ways you can export all of the strings in your project. The first is using Xcode, but since this is a process you'll likely want to repeat, we'll also show how to do it via the command line so you can automate it. We'll then take the xliff files and send them off for translation using a translation service.
Once we have our translated files back from our translators, we can now import them for use in our project. I'll show how do do this within Xcode and from the command line.
Sometimes you may find that you want to localize images specific to a locale. In this episode we'll make up a contrived example where we want to change our splash image from a pizza to sushi if the locale if Japanese. We can easily do this with Asset Catalogs and provide a more tailored experience.
Pluralization rules vary by language, so it's not as easy as just adding an "s". To properly handle these cases, we need to use a Stringsdict file and format our string using a special syntax.