How to make iOS apps multilingual (XCode 12)

Generally speaking, when you start an iOS app, you start with one language. When you've reached a certain point, maybe you've got enough users, the next step is to make the app multilingual, so that the original app supports more languages. This process is called localization, and in this post I'm going to organize the process of testing multilingualization in XCode 12.4.

Supported Languages

The first step is to make sure that "Use Base Internalization" is turned on in XCode. This is turned on by default in Xcode 12, but to make sure, go to Project setting->Info. At this point we probably only have one language, so press the + sign to add the new language you want to support.

How to make iOS apps multilingual (XCode 12) 3

Localizable.strings

To translate from the language used at the beginning of development to another language, each word needs a translation. This is where the Localizable.string file comes in. For each supported language, Localizable.strings has a corresponding file that stores the key-value pair for each word and the corresponding translation.

The next thing to do is to create Localizable.strings. From File->New->File, select Strings File and name it Localizable.strings.

After this step we can see that there is now a Localizble.string file in the project, and a new Traditional Chinese version has been added.

Here is an example app implemented in SwiftUI, XCode will find all the English words we need to translate, which is very convenient. Next, we just need to go to Localizable.strings and fill in the corresponding translations. The left side is the original English translation, which is automatically generated by XCode, and the right side is the Chinese translation which I filled in.

The original SwiftUI didn't need any changes at all.

Multilingualization of App names

The previous method can only handle multilingual app interface content, so if you want to add app name translation? Actually we can use similar method, but we need to make another InfoPlist.strings file. The method is the same as the previous one, select Strings file from File->New->File, and then name the new file as InfoPlist.strings.

The app name corresponds to the key CFBundleDisplayName. In the Chinese InfoPlist.strings, add the following line, change YOURAPPNAME to the app name you want to use in the Traditional Chinese version.

"CFBundleDisplayName" = "YOURAPPNAME";

References

https://developer.apple.com/videos/play/wwdc2020/10119/


Thank you for reading this post. If you like my post, please follow up withFacebook Fan Specialist,Twitter,IGThe

Leave a ReplyCancel reply