Once your project is fully internationalized, the process of localization can begin. Matt begins the process for the H+ Sport app by creating some new localizations in Xcode.
- [Instructor] So by now we have nearly all the user-facing text in our HPlusSport app internationalized, and we're just about ready to prepare our files and get them ready to be sent out for translation. There's a couple final steps that we're going to do, and those involve adding some new localizations to our project and then localizing our storyboard and nib files. So if you've been following along with the previous lessons, you remember that from the outset, I added some localized string files down here, and I added those so we'd immediately be able to see how our NSLocalizeString macro was working.
But I'm going to go ahead and delete all that stuff and we're going to get this project right back to a clean slate where it would be if you had developed this from scratch. So to start with that, I'm going to go up here to our project file, and I'm under the Info tab right here, and down in the Localizations section, I'm just going to click on each one of these and I'm going to delete it. And it's asking me if I want to completely delete the files or just remove the reference to them, and I'm going to delete them altogether.
I'm going to do the same thing for Portuguese here and then also for French. I'm going to delete that, as well. And now you'll see that none of those are listed under localizations anymore. It's just our development language. And the last thing I'm going to do is go ahead and delete that file out of there, as well. And I'm going to move it to the trash. So now if I run the app in another language, for example, I'm going to run it in Spanish here, you'll be able to see that we already localized, we localized some of the numerical values and the currency, and iOS is handling that for us, but all of our text is still in English because I removed those localizable.strings files.
So now this project is where it would be if you wanted to start adding your first localizations. I'll collapse this panel here. And to do that, we're just going to start here in our project file like normal. We're under the Info tab, and I'm just going to add some files. So I'm going to select Spanish. And so that comes up with a window that is asking me to localize any localizable files that are already in the project. And by default the storyboard and the launch screen are already localizable in a project.
It's set up that way by default. I'm going to uncheck the storyboard because we don't use that in this demo app, but I do want to create a Spanish language version of my storyboard, the main one. And over here there's an important selection that you can make for the file type, and you can see you can select between a localizable strings file and a full, complete storyboard file that will be specific to the Spanish language. I'm going to dive into that in more detail in the following lesson, but for now let's pick a strings file.
So now you can see after I hit Finish that if I go down and I look at the main storyboard over here in the file tree, I can expand it, and it has a Spanish language strings file that goes along with it. So I'm going to do the same thing and I'm going to add French localization. Again, we don't need to use the launch screen. And I'm also going to add back that Brazilian Portuguese localization, as well.
So now I've got these three new localizations added, and you can see it's telling me I've got one file that's been localized, and that's the main storyboard. Now this is a good time to talk about this checkbox right down here called Use Base Internationalization. It's always checked by default in a new project, and it's a really great feature. And basically what it means is that if you don't have a strings file for a particular localization, or you don't have a localized storyboard, there's a master copy of each one of those files that is stored in a base folder in your project, and I'm going to show you that in the project folder.
So here inside the project folder for the HPlusSport app, you can see that there's this base project folder. We have one for Spanish and French and Portuguese that I just created. And inside the base project folder is the main storyboard, and there's also the launch screen storyboard that I told you it creates. And inside our Spanish and French and Portuguese folders are the Main.strings files that we just created when we knew we added those localizations.
So now that we have newly added these localizations to our project, there's just one more task that we're going to be doing before we're ready to actually start exporting our translation files, and that's setting up the storyboards and the nibs to be localized, and we're going to be dealing with that in the next lesson.
- Internationalization vs. localization
- Internationalizing strings, dates, and measurements
- Localizing storyboards and nibs
- Exporting XLIFF files for translation
- Importing translated XLIFF files
- Testing localization