random
random

Reputation: 10309

Localization problems in iPhone

I have been trying to localize my iPhone app in two languages - english and german

I have created two folders en.lproj and de.lproj each containing Localizable.strings file for respective language. I have included these files in my resources folder, changed the encoding of these files to UTF-16.

I have tried cleaning the project and building it again, deleting folder at path: Library/Application Support/iPhone Simulator/User

But the problem is still there. Anybody having an idea please help.

Upvotes: 1

Views: 1293

Answers (2)

Liam
Liam

Reputation: 8092

We have added 2 languages (to test the process, 1 European & 1 Asian double byte)

It's a two stage process, you will need to localize both your strings and your xibs. For the strings,

  1. Create the Localizable.strings (Only available under the MacOSX resources)
  2. Right click the new file and 'Get Info'
  3. Click the button 'Make File Localizable' (This will automatically add one language - English for me)
  4. In the 'Groups & Files' you should now be able to expand the resource file and see the new language
  5. From the command line run the command genstrings -o English.lproj *.m. This will parse your .m files and extract all the NSLocalizedStrings and put them in the file.

If you do Get Info again, you should be able to add more languages

For the xibs, right click on them and 'Make File Localizable'. These can then be translated separately

Upvotes: 1

Sora
Sora

Reputation: 409

I tried with Spanish successfully.See the basic steps I followed. (Note:This project is not using interface builder.)

1.Add a folder named es.lproj in the root directory of the project.

2.Open terminal and go to the root directory.

3.Enter genstrings -o es.lproj *.m.This will create Localizable.strings file in the es.lproj folder. (Make sure that all the strings that you want to localize,you are using NSLocalizedString instead of NSString.)

4.Go to Xcode and add es.lproj in to the Target.Make sure to confirm when the message pops up.

5.open Localizable.strings file, edit and save.

ex: /* Phone Label */ "Phone" = "Teléfono";

5.Go to phone 'settings->General->International' and change 'Language' and 'Region format' accordingly.

6.Start you application.

This should work fine.

Upvotes: 0

Related Questions