Re: Why do "loose" nibs take precedence over nibs in .lproj?
Re: Why do "loose" nibs take precedence over nibs in .lproj?
- Subject: Re: Why do "loose" nibs take precedence over nibs in .lproj?
- From: Ricky Sharp <email@hidden>
- Date: Wed, 19 Jan 2005 09:09:35 -0600
On Wednesday, January 19, 2005, at 08:44AM, Jerry Krinock <email@hidden> wrote:
>I have the following directory structure in my package:
>
>Contents
> MacOS
> Resources
> MainMenu.nib
> English.lproj
> MainMenu.nib
>
>You see, there are two MainMenu.nib.
>
>(This happened because the original release of my app was not localized and
>had the "loose" MainMenu.nib at the higher level. Later, I released a
>localized version with a new MainMenu.nib in English.lproj, but Installer
>does not delete depracated files when doing an "Upgrade". (That will be the
>subject of another thread.))
>
>Anyhow, when this application runs, it uses the old MainMenu.nib instead of
>the latest one, causing much pain.
>
>Of course, everyone has "English" somewhere in the Languages list of their
>System Preferences > International, so I believe that the MacOS should, by
>design, use the one in English.lproj.
>
>Is there a good reason why it does not, or should I file a bug report?
Looking first for a non-localized version is most likely by design. Check out this quote from the docs on NSBundle's pathForResource:ofType:
"...The method first looks for a nonlocalized resource in the immediate bundle directory; if the resource is not there, it looks for the resource in the language-specific ?.lproj? directory (the local language is determined by user defaults)."
Ultimately, it would be best if the installer/updater would have removed the non-localized version. I would write up a bug about that. As a workaround, perhaps look into a post-install/update shell script which can clean up unwanted files.
If the installer/updater cannot be modified for some reason, there may be a way to manually load the appropriate MainMenu nib. Perhaps you could remove the NSMainNibFile key-value pair from your Info.plist (to suppress the automatic loading) and then use pathForResource:ofType:inDirectory: somewhere near app startup to load the appropriate MainMenu nib.
Finally, even if you initially don't plan on any localization, you should really set your nibs, strings. etc to be localizable. This will allow you to more easily localize in the future. I know this statement doesn't help your current situation, but it can prevent the same problems with future apps you write.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden