How to Localize All Your iOS Apps into 20 Languages in 5 Minutes

Mark Parker
3 min readMar 4, 2023

--

Original post: https://markparker.me/blog/localize-ios-app-in-5-minutes

Introduction

In today’s globalized world, the demand for mobile applications that cater to users from different countries and regions has increased significantly. To reach a wider audience, it’s important for iOS application developers to make their apps accessible to users in multiple languages. Localizing an iOS app can offer many benefits:

  • Reach a wider audience: By localizing your app, you can reach users who may not speak your app’s default language. This can help you tap into new markets and increase your user base.
  • Improve user experience: Users are more likely to use and enjoy an app that is available in their native language. Localizing your app can help you provide a better user experience, which can lead to better reviews, ratings, and retention rates. Localizing your app can give you a competitive advantage in regions where your competitors may not have localized their apps.
  • Increase revenue: Localizing your app can lead to increased revenue, as users are more likely to make in-app purchases or pay for subscriptions if the app is available in their native language.

But there are also a few problems and potential issues that developers may run into. Localizing an app can be time-consuming and resource intensive, especially for apps with a large amount of content and a long list of languages. Developers must allocate sufficient time and resources to ensure effective localization.

But we wouldn’t be developers if we didn’t always try to automate everything. Automated localization can translate content quickly and efficiently, reduce the costs associated with manual translation, such as hiring professional translators or dedicating internal resources to the task. This is especially effective if the application is being created by a single developer.

Prepare your project

I won’t go into detail about how localization of strings works in a xcode project, there are already many other tutorials on this subject. I’ll just highlight a few key steps:

  1. Create Localizable.strings file and fill it with strings you want to localize.
/* optional description */
"[key]" = "[string]";

/* Example: */
"welcome text" = "Welcome to XCodelocalize";

2. Go to the project file settings, add the desired languages. Apple recommended EFIGS (English French Italian German Spanish) + Chinese as a base.

3. Create Localizable.strings files for all selected languages. You may also want to localize plist, storyboard and intentdefinition files.

Install XCodeLocalize

Unexpectedly, the ios development tool turned out to be written in python, so make sure you have python 3.9+

After that, install the tool using pip:

pip3 install xcodelocalize

Also, available installations from .whl file from github releases or via poetry from source code.

Run automatic localization

cd to the project root folder and run

xcodelocalize [OPTIONS]

or

python3 -m xcodelocalize [OPTIONS]

Options

  • --base-language: code of the language from which all strings will be translated. [default: 'en']
  • --override / --no-override: a boolean value that indicates whether strings that already exist in the file will be translated. Retranslate if override, skip if no-override. [default: no-override]
  • --format-base / --no-format-base: sort base file strings by key. [default: no-format-base]
  • --file: Names of the strings files to be translated. Multiple files can be specified. If not specified, all files will be translated. [default: None]
    Example:
xcodelocalize --file InfoPlist xcodelocalize --file InfoPlist --file MainStoryboard --file Localizable
  • --key: Keys of the strings to be translated. Multiple keys can be specified. If not specified, all keys will be translated. [default: None]
  • --language: Language codes of the strings files to be translated. Multiple language codes can be specified. If not specified, all files will be translated. [default: None]
  • --log-level: One from [progress|errors|group|string]. [default: group]
  • --help: Show info

Automation

You can go to Target -> Build Phases -> New Run Script Phase in your xcode project and paste xcodelocalize there. It will localize necessary strings during every build and your localization files will always be up-to-date.

Conclusion

Now you know how to quickly localize your iOS applications in many other languages. Add a star to the repo if you like it.

--

--