In doing localization work, I found several useful links, but this is the most concise:
The main points are:
- Extract strings from your xib files: [sourcecode lang=”cpp”]ibtool –generate-strings-file Example.strings en.lpoj/Example.xib[/sourcecode]
- Extract strings from your code: [sourcecode lang=”cpp”]genstrings -o en.lproj *.m[/sourcecode]
- Get those translated (or translate them yourself)
- For the files from step 2, put them in an appropriately named dir (e.g., French -> fr.lproj – see lang codes).
- Add the new language dirs to your project. (see note below)
- For the files from step 1, create localized xib files: [sourcecode lang=”cpp”]ibtool –strings-file fr.lproj/Example.strings -write fr.lproj/Example.xib en.lproj/Example.xib[/sourcecode]
- Put the new xib files in your project
NOTE: One thing that stumped me was that the en.lproj and fr.lproj seemed to be able to be anywhere. Xcode/the app pick up on the language letters (e.g., en) and use the right dir and the file type “.strings” and the ‘magic’ happens.
So I added a ‘Localized’ group in my ‘Resources’ group. Then I added the en.lproj and fr.lproj dirs to ‘Localized.’ Each time under the <lang code>.lproj item was a .swp file that caused build problems. I removed those files – problem gone.
As a test, I just used the same Localizable.strings file in each lang dir but made a change to some text so when I ran the app, I’d know if it was using the right version (e.g., “Done” -> “FRENCH!”).
I changed my language setting in the Settings app and ran the app. The first time I didn’t see a change, but when I ran it again, viola!