initWithWindowNibPath and Base Internationalization
initWithWindowNibPath and Base Internationalization
- Subject: initWithWindowNibPath and Base Internationalization
- From: Chris Cianflone <email@hidden>
- Date: Wed, 16 Aug 2017 10:16:26 -0500
Hi all,
I’d like to understand how this function from NSWindowController.h:
- (instancetype)initWithWindowNibPath:(NSString *)windowNibPath
owner:(id)owner;
is supposed to work. We have an application that supports a plugin
architecture and these plugins can launch dialogs as part of our app’s
plugin API. We are just starting down the road of using “Base
Internationalization”. We decided to start on the plugin side thinking
this would be a smaller task to iron out all the details, and unfortunately
we have run into some problems (well, fortunately that we found them
earlier rather than later maybe).
In our test plugin, we have a dialog 20129.xib that has a base localization
and a German localization for testing purposes, but just the 20129.strings
file as we are trying to use Auto-Layout and only have the .strings to be
localized as opposed to the entire .xib file. We have not been able to get
the correct strings showing up. Fast forwarding to some of the important
things we have discovered, the initWithWindowNibPath seems to work fine (as
well as the similar initWithWindowNibName) when we localize a .xib file on
the application side. However, when we do this on the plugin side,
initWithWindowNibPath fails to get the localizable .strings file
correctly. Further, that API seems to want to grab such a 20129.strings
file from the main app’s resources. If I add the 20129.strings file to the
app’s /Contents/Resources/de.lproj/ folder, the plugin dialog has the
correct localized German strings. I should note that I am simply testing
this by going into the scheme settings and under the Options section,
setting Application Language to German and Application Region to Germany.
Is this just a bug in initWithWindowNibPath or is there something else we
are missing here? According to this comment in NSWindowController.h:
/* Instances initialized with the "Name" methods will eventually locate
their nib file in the file's owner's class' bundle or in the app's
+mainBundle using standard NSBundle API. Use the "Path" method if your nib
file is at a fixed location (which is not inside one of those bundles).
*/
We had to go the “Path” route (as opposed to the “Name” methods) as the
resources are in the plugin, not the main app, and the file’s owner’s class
is also in the main app, not the plugin. Any suggestions on how to get
this all working?
Thanks!
Chris
-----------------------------
Chris Cianflone
www.makemusic.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden