Graphics Programs Reference
In-Depth Information
that this file can be localized, automatically creates
en.lproj
, and moves the
De-
tailViewController.xib
file to it.
Click the
+
button again and select
Spanish
. This creates an
es.lproj
folder and adds a
Figure 17.2 Localizing DetailViewController.xib
Back in
Xcode
, look in the project navigator. Click the disclosure button next to
De-
tailViewController.xib
(
Figure 17.3
) and then Control-click on each of these
XIB files and select
Show in Finder
to show that file in its
lproj
directory. Keep these
windows open; you'll need them shortly.
Figure 17.3 Localized XIB in the project navigator
In the project navigator, click the
Spanish
version of
DetailViewController.xib
.
When this file opens, the text is not in Spanish. You have to translate localized files your-
self;
Xcode
isn't
that
smart.
One option is to manually edit each string in this XIB file in
Xcode
. However, this ap-
proach does not scale well if you're planning multiple localizations. What happens when
you add a new label or button to your localized XIB? You have to add this view to the
XIB for every language. This is not fun.
Instead, you can use a command-line tool named
ibtool
to suck the strings from your nat-
ive language XIB file into a file. Then, you can translate these strings and create a new