OK, so Carbon was designed with the smart feature to provide localized standard 
application menu items,
whereas Cocoa app always are stuck with the menu from the .xib file.

The Carbon approach is much better, e.g. to accommodate new application menu 
items from Apple,
Cocoa developers has to check if a new menubar template has arrived, and update 
their .xib files,
where Carbon apps would automatically have the new application menu items 
provided by the framework.
Sorry to see that feature disappear.

And all Cocoa developers have to implement CreateStandardWindowMenu and 
updating it themselves ?
/Lars


Den 23. aug. 2018 kl. 02.39 skrev Eric Schlegel 
<[email protected]<mailto:[email protected]>>:



On Aug 22, 2018, at 5:19 PM, Lars C. Hassing 
<[email protected]<mailto:[email protected]>> wrote:

Thanks, but I would like to avoid an .xib file.
However, like you suggested I have created a new Cocoa app in Xcode, and I look 
at its content as a basis for creating the menubar programmatically.

Still, this doesn’t doesn’t solve the localization.
It seems Carbon does the localization, but Cocoa apps do not have that feature.
If I run a Cocoa app with Danish as my Preferred Language, the application menu 
has the English “Show Others”,
where a Carbon app would display “Skjul andre”.

I believe that’s because for the Carbon case, the menu contents are coming from 
HIToolbox.framework’s localized resources, and we have all of the localizations 
already provided by Apple.

In the Cocoa case, it would be up to you to localize your .nib/xib for each 
supported language. I think you can find our recommendation translation 
glossaries here: https://developer.apple.com/download/more/?=Glossaries. If you 
don’t use a nib/xib, you could instead put the localizations into a strings 
file.

-eric



/Lars


Den 23. aug. 2018 kl. 02.03 skrev Rob Petrovec 
<[email protected]<mailto:[email protected]>>:

You should use a .xib instead of creating the menu bar programatically.  Create 
a new Cocoa App in Xcode and it will have all of what you seek pre-configured 
in a .xib with no code needed.

—Rob


On Aug 22, 2018, at 2:14 PM, Lars C. Hassing 
<[email protected]<mailto:[email protected]>> wrote:

In decarbonizing I have now come to creating a menubar programmatically using 
NSMenu.

Carbon seems to be so nice to add standard items to the application menu: 
Services, Hide app, Hide Others, Show All, Quit app,
and they are added using the user’s Preferred Language setting in System 
Preferences’s Language & Region,
so in German “Hide Others” is added as “Andere ausblenden”.

However, it seems that in Cocoa I have to add these standard items myself,
but how can I find out what “Hide Others” is called in the user’s Preferred 
Language ?

And what is the Cocoa equivalent of CreateStandardWindowMenu ?
/Lars

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      
([email protected]<mailto:[email protected]>)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/carbon-dev/petrock%40mac.com

This email sent to [email protected]<mailto:[email protected]>


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      
([email protected]<mailto:[email protected]>)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/carbon-dev/ericsc%40apple.com

This email sent to [email protected]<mailto:[email protected]>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/carbon-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to