I use the org.openide.awt.MenuBar(DataFolder)
constructor to automatically build a MenuBar from actions registered in the layer.xml file:
menuBar = new MenuBar(DataFolder.findFolder(FileUtil.getConfigFile("MyMenuBar")));
And below is an example of the ImportMix
action registration in the "MixFile" submenu:
@ActionID(category = "MixConsole", id = "org.jjazz.ui.mixconsole.actions.importmix")
@ActionRegistration(displayName = "#CTL_ImportMix", lazy = true)
@ActionReferences(
{
@ActionReference(path = "MyMenuBar/MixFile", position = 200)
})
public class ImportMix extends AbstractAction
I can easily localize the ImportMix
action name, but how to localize the submenu name ? ("MixFile" in the example)
OK I finally got it.
There is the displayName
attribute that can be added to a layer.xml
folder, and the attribute value can be redirected to a localizable Bundle property.
The easier way to do it is to edit layer.xml
via Netbeans IDE:
It automatically adds the attribute and updates the Bundle.properties
with a new property ready to be localized.