nibTranslate Tutorial: First Steps

  1. Create new Xcode project ('nibTranslateExample')
  2. Add German localization to MainMenu.xib
  3. Add label titled 'English' to English MainMenu.xib
  4. Save & close Interface Builder, run your app to see
  5. Open nibTranslate, save document to Xcode project folder
  6. In nibTranslate: click on '+' Button (bottom left), add MainMenu.xib from English.lproj
  7. Most of the missing strings are from the menu bar and can be ignored for now*
  8. Search for 'english' (the text of the label in step 3), put in 'German' as localized string and click on Set.
  9. Click on menu item nibTranslate > Generate Outdated Localized Files... (ignore warning about missing translations)
  10. Change the Export path to your projects German.lproj
  11. Click on Export button
  12. Save & close nibTranslate project
  13. In Xcode, got to Arguments tab of Info panel for projects executable
  14. Add argument: -AppleLanguages "( German, English )"
  15. Run your program
  16. Un-check the AppleLanguages argument from your project's executable, and run again
* To ease the translation of the menu bar items, go to:
http://developer.apple.com/internationalization/downloads/ and download the glossary for the target language.
Use nibTranslate's File > Import AppleGlot Glossary... menu command. Select all the files and import. Will find translations for most of the files.

nibTranslate Tutorial: Next Steps

  1. Open your Xcode project ('nibTranslateExample')
  2. Add the following code to your project's app delegate:
    - (IBAction) showAlert:(id)sender
    {
        [[NSAlert alertWithMessageText:NSLocalizedString(@"Attention!", nil)
                         defaultButton:nil
                       alternateButton:nil
                           otherButton:nil
             informativeTextWithFormat:NSLocalizedString(@"Something happened.", nil)] runModal];
    }
  3. Add the following code to your project's app delegate header:
    - (IBAction) showAlert:(id)sender;
  4. Save both changed files (step 2 and 3)
  5. Double click on MainMenu.xib (English) to open Interface Builder
  6. Add a button titled 'Push Me.' (or whatever you'd like) to the window, and connect it to the showAlert: method
  7. Save MainMenu.xib and close Interface Builder
  8. Run your program in Xcode to make sure it works (make sure to run the English version, see 'First steps' tutorial regarding executable's arguments)
  9. Open projects nibTranslate document and note the icon next to the MainMenu.xib indicating that the file has been updated (i.e. needs to be reparsed)
  10. Click on said icon, you should now see the missing translations count went up by one
  11. Search for the buttons title (see step 6) and give it a translation (don't forget to press Set)
  12. Open Terminal.app, go to your project's folder and execute the following command, you will get a new file ('Localizable.strings') in your English.lproj folder:
    genstrings -o English.lproj *.m
  13. In nibTranslate click on the "+" Button in the lower left, add the 'Localizable.strings' file, and translate the two new strings
  14. In the menu bar click on nibTranslate > Generate Outdated Localized Files... and export the two outdated files to the German.lproj directory
  15. You can now save and close nibTranslate
  16. In Xcode, open your projects Resources group
  17. In Finder, select both Localizable.strings files, drag and drop them into the Resources group in Xcode and add them. (Don't worry if the contents of the strings file look like garbage.)
  18. Run the program's English version
  19. Activate the AppleLanguage argument in the project's executable infos and run again
If you now change localizable strings in your code, you have to use the genstrings tool again (see step 12) before nibTranslate can pick them up.