There are several ways to internationalize your app. In this article, let's check how to achieve localizeation by Storyboard, avoiding coding.
Then, .string file will be generated to selected storyboards. By doing the followings, localization is complete!:
- .storyboard file: Configure in English
- .string file: Configure in Japanse (Refer to "2. Localize after Updaing Storyboards")
Note that keys to configure are different between UI object types. After updating storyboards, it may take time to look up all the keys, so let's take a look at the shortcut in the next section.
Don't forget to backup the current .string file before the following steps, because it will be removed. Uncheck Japanese. Confirmation dialog may be shown, and select "Remove".
In the sample above, configuration is as following:
"cgO-CO-O4B.text": text of UILabel
"qY6-pH-68Q.normalTitle": text of UIButton
You can set Japanese in the right-hand side (Code below omits auto-generated comments).
"cgO-CO-O4B.text" = "Konnichiwa!"; "qY6-pH-68Q.normalTitle" = "Button label in Japanese";
When you add UI objects you may prefer this way, but of course you can edit .string file directly.
Just by switching language setting of simulators (or of course real devices), you can see app's language switch.