Internationalization

First, you will use the NumberFormatter and NSNumber classes to internationalize the ConversionViewController.

Formatters

In Chapter 6, you used an instance of NumberFormatter to set the text of the Celsius label in ConversionViewController. NumberFormatter has a locale property, which is set to the device’s current locale. Whenever you use a NumberFormatter to create a number, it checks its locale property and sets the format accordingly. So the text of the Celsius label has already been internationalized.

The Locale type knows how different regions display symbols, dates, and decimals and whether they use the metric system. An instance of Locale represents one region’s settings for these variables. ...

Get iOS Programming: The Big Nerd Ranch Guide, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.