Creating a localized MonoMac application (both strings and XIB)

After I found exactly zero examples for the great MonoMac library (create OS X Mac applications in C# without the need to install Mono separately on a Mac) on how to do localization of Xcode Interface Builder XIB files, I found one discussion about that topic. With some help of the original poster Florian, I was able to bring up a solution that worked for me.

I’ve assembled an example project that you may download as a ZIP file.

While I found plenty of examples/postings on how to do localization of pure strings (through the „Localizable.strings“ files), I found none on how to do it with whole XIB files.

Basically the folder structure looks like this:

The example contains a localization for German („DE“) and a localization for Englisch (the default, „EN“). Whereas MonoMac places the XIB files (like „MainMenu.xib“ and „MainWindow.xib“) inside the root of the application, I did not manage to make the application multilingual when keeping the structure this way.

Instead, I moved all XIB files that need to be localized/translated into the „en.lproj“ folder. I also placed the strings file „Localizable.strings“ into this folder. Since I need the files for German, too, I copied them to the „de.lproj“ folder, too. Next, I double clicked the XIB files in the German folder, which launched them inside Interface Builder. I then translated them graphically inside Interface Builder, saved, switched back to Mono and was done.

After compiling the application and starting, it showed my correctly a German UI (since my Mac has the German language active) for the main menu, the elements on the main window and also the label was correctly set to the text read from the German „Localizable.strings“ file.

Things to keep in mind:

  • The „Localizable.strings“ files have to be set to the Build Type „Content“.
  • All XIB files (i.e. the English and non-English files) have to be set to the Build Type „InterfaceDefinition“.
  • I first got success after I did a „Clean“ command (right-click on the root node in the Solution Explorer tree) and then a Rebuild command. My guess is that the automatically-generated Xcode project may have interfered somewhat. Also I quit Xcode completely before doing the cleanup.
  • I am unaware if the steps I did are usually and best-practice, since it involves in copying/duplicating whole XIB files which seems to be very error-prone to me.

I’m really happy for any feedback you have for me!

Ankommende Suchanfragen:

  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1835 Da2E14beG-vpnh57wE5L14cWASUwWmzPeE9pYWF5attbemwp3RFvibBreyzIYue8 c78420bdb0af6c14beb0ee674afe5943afd8440f&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1843 sVX78vpwXmNQeqbLNCULVBLXgc_RbLQlqQF_-sJcWsasoCHYZWLtxa0BpkTTIOww b69ca09bcff8f031f39f449c64cbeef6bd8afb57&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme