Finding Non-localized Strings

A quick tip to help track down strings that are missing from a localization.

When you are localizing an application it is easy to miss a string. Perhaps you forgot to update/regenerate the strings file after a change to the interface or include the latest localizations from the translator. Either way, if you do not spot the problem before shipping the result is an ugly experience for your users.

Launch Argument - NSShowNonLocalizedStrings

I have written about using launch arguments to make it easier to test different localizations. There is another launch argument you can add that will also detect strings that you have not yet localized for that language. From the Apple Resource Programming Guide:

You can pass this argument, with a value of “YES”, to an application at launch time by adding it to the Xcode scheme. From the Xcode Product menu use Scheme > Edit Scheme and for the Run phase use the Arguments tab. Make sure you include the leading hypen “-”. In the screenshot below I also have the launch argument to run the application using the Spanish localization.

Launch Arguments

With the launch argument set, running in a locale with a missing localization for a string writes an error to the debug console:

Localizable string “Hello World” not found in strings table “Localizable” of bundle CFBundle

This will also work if you have strings in a storyboard that you have not localized though the error message is not so helpful in telling you which string is missing:

Localizable string “So6-fv-SWh.text” not found in strings table “Main” of bundle CFBundle

Xcode Options (Update 22-Dec-2015)

Thanks to the many people who have pointed out that Xcode 7 has options to directly enable localization debugging and setting the application language/region. The syntax for the launch arguments is tricky so this makes it much easier. In the scheme editor take a look at the Options tab. In the following screenshot I have “Show non-localized strings” enabled with the application language set to “Spanish”:

Xcode options

Further Reading

Never miss a post!

iOS Size Classes Cheat Sheet

Subscribe and get my free iOS Size Classes Cheat Sheet

Success! Now check your email to confirm your subscription and download your free guide to iOS Size Classes.

There was an error submitting your subscription. Please try again.

Unsubscribe at any time.
No time to watch WWDC videos?

Sign up to get my iOS posts direct to your inbox and I will send you a free PDF of my iOS Size Classes Cheat Sheet.

OK! Check your inbox (or spam folder) for an email to confirm your details and download your free guide to iOS Size Classes.

There was an error submitting your subscription. Please try again.

Unsubscribe at any time.
Archives Categories