---
title: "#178: Improved Internationalization with Localize-Swift 🌏"
url: https://littlebitesofcocoa.com/178-improved-internationalization-with-localize-swift
author: Jake Marsh
published: 2016-01-27
topics: ["Libraries","Localization"]
description: "Localization can go a long way towards increasing the sales of our apps. Users are browsing the App Store all over the world, and when they come across a..."
---

# #178: Improved Internationalization with Localize-Swift 🌏

By Jake Marsh, January 27, 2016. HTML: https://littlebitesofcocoa.com/178-improved-internationalization-with-localize-swift

<img src="https://camo.githubusercontent.com/68670b270ff0f916c5cb2dfe0d158a5cb4245681/687474703a2f2f692e696d6775722e636f6d2f767372707142742e676966" style="max-width: 300px; float: right; margin-left: 20px; margin-bottom: 20px;" />

_Localization_ can go a long way towards increasing the sales of our apps. Users are browsing the **App Store** all over the world, and when they come across a neat looking **app** that's not translated into their language, they're very likely to keep on scrolling. Today we’ll check out a library called [Localize-Swift][1] from [Roy Marmelstein][2] that makes this process much nicer.

The first helpful addition [Localize-Swift][1] brings us is a better way to localize our **strings**:

``` swift
searchBar.placeholder = "Hello World".localized()
```

Then we can easily test our translations at runtime using:

``` swift
Localize.availableLanguages()
Localize.setCurrentLanguage("fr")
```

We can respond to language changes using an **NSNotification**:

``` swift
NSNotificationCenter.defaultCenter().addObserver(
  self, 
  selector: "setText",
  name: LCLLanguageChangeNotification, 
  object: nil
)
```

[Localize-Swift][1] also provides a custom `genstrings.py` script to easily fill our `.strings` files even though we're not using **NSLocalizedString** directly, neat!

More info about _Localize-Swift_ can be found at [git.io/localizeswift](http://git.io/localizeswift)

[1]: https://github.com/marmelroy/Localize-Swift
[2]: https://github.com/marmelroy
