Graphics Programs Reference
In-Depth Information
XIB file for each language. To get started, open Terminal.app in the Applications/
Utilities directory.
Once Terminal launches, you'll need to navigate to the location of en.lproj . If you are
familiar with Unix, have at it. If not, you're about to learn a cool trick. In Terminal , type
the following:
cd
followed by a space. Drag the en.lproj folder's icon from the Finder onto the Terminal
window. Terminal will fill out the path for you. Hit return. The current working directory
of Terminal is now this directory. For example, my terminal command looks like this:
cd /iphone/Homepwner/Homepwner/en.lproj
Next, you will use ibtool to suck the strings from this XIB file. Enter the following ter-
minal command and enter it all on the same line. (We only broke it up so that it would fit
on the page.)
ibtool --export-strings-file ~/Desktop/DetailViewController.strings
DetailViewController.xib
This will create a DetailViewController.strings file on your desktop that con-
tains all of the strings in your XIB file. Edit this file according to the following text. The
numbers and order may be different in your file, but you can use the text field in the
comment to match up the translations.
/* Class = "IBUILabel"; text = "Name"; ObjectID = "4"; */
"4.text" = "Nombre";
/* Class = "IBUILabel"; text = "Serial"; ObjectID = "5"; */
"5.text" = "Numéro de serie";
/* Class = "IBUILabel"; text = "Value"; ObjectID = "6"; */
"6.text" = "Valor";
/* Class = "IBUILabel"; text = "Label"; ObjectID = "7"; */
"7.text" = "Label";
Notice that we do not change the Label text because it will be created at runtime. Save
this file.
Now you will use ibtool to create a new Spanish XIB file. This file will be based on the
English version of DetailViewController.xib but will replace all of the strings
with the values from DetailViewController.strings . To pull this off, you need
to know the path of your English XIB file and the path of your Spanish directory in this
project's directory. Remember, you opened these windows in Finder earlier.
Search WWH ::




Custom Search