Graphics Programs Reference
In-Depth Information
At this point, you can use the terminal command
ls
to print out the directory contents and
confirm that
ItemsViewController.m
is in that list.
To generate the strings table, enter the following into
Terminal
and hit return:
genstrings ItemsViewController.m
This creates a file named
Localizable.strings
in the same directory as
Item-
sViewController.m
. Drag this file into the project navigator. When the application is
compiled, this resource will be copied into the main bundle.
Oddly enough,
Xcode
sometimes has a problem with strings tables. Open the
Localiz-
able.strings
file in the editor area. If you see a bunch of upside-down question
marks, you need to reinterpret this file as Unicode (UTF-16). Show the utilities area and
select the file inspector. Locate the area named
Text Settings
and change the pop-up menu
next to
Text Encoding
to
Unicode (UTF-16)
(
Figure 17.5
). It will ask if you want to rein-
terpret or convert. Choose
Reinterpret
.
Figure 17.5 Changing encoding of a file
The file should look like this:
/* Name of application */
"Homepwner" = "Homepwner";
Notice that the comment above your string is the second argument you supplied to the
NSLocalizedString
function. Even though the function doesn't require the comment
argument, including it will make your localizing life easier.