Minify Localized Strings (iOS)

There are two major ways to reduce localized strings size.

Less size reduction, but less effort required:

  • Make sure that localized strings are encoded as text files ("key" = "value";) and not binary plists. Though it may seem odd that the human-readable format would be more size-efficient than the binary format, this is indeed the case (assuming you also follow the other tips on this page as well). You can fix this by setting "Strings File Output Encoding" (STRINGS_FILE_OUTPUT_ENCODING) to "UTF-8" in your Xcode build settings.

  • Once they're text plists, localized string files can contain comments by default like:

/* Title for a pop-up alert that tells the user the QR code they just scanned has expired. */
"code_expired" = "Code Expired";

These comments are used by translators to provide additional context about the phrase, but aren’t useful in the production app. Emerge lets you know if any files in your app still have these comments. You can remove all of them from localized strings files. If you have many strings or very detailed descriptions removing them can offer significant savings.

Note that the potential savings we show for mini

More size reduction (90%+ size decrease) but more effort required:

  • Integrate our SmallStrings library into your app following the steps in the repo
  • Replace all calls to NSLocalizedString with SSTStringForKey