This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 256245 - Can't localize CANCEL_OPTION_CAPTION in netbeans\core\windows\services\Bundle.properties
Summary: Can't localize CANCEL_OPTION_CAPTION in netbeans\core\windows\services\Bundle...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Property Sheet (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-29 03:21 UTC by anusanraj
Modified: 2015-10-29 10:44 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Bundle file for French version (3.62 KB, application/octet-stream)
2015-10-29 03:24 UTC, anusanraj
Details
Property window of the implemented editor (3.19 KB, image/png)
2015-10-29 09:23 UTC, anusanraj
Details
Editor window in netbeans (15.24 KB, image/png)
2015-10-29 09:26 UTC, anusanraj
Details

Note You need to log in before you can comment on or make changes to this bug.
Description anusanraj 2015-10-29 03:21:10 UTC
I am trying to localize the text of Cancel button in property editor to French language. In doing so, I am overriding the bundle through branding => org/netbeans/core/windows/services/Bundle.properties.

Following are the property keys representing those texts. 

[code]
CLOSED_OPTION_CAPTION=Fermer
CANCEL_OPTION_CAPTION=Annuler
HELP_OPTION_CAPTION=Aide
OK_OPTION_CAPTION=OK 
[/code]

However, there is no effect on them except for Help button. Help button shows the text correctly as "Aide".

Furthermore, I checked the source of org.netbeans.core.windows.services.NbPresenter.java and it should work according to its implementation. 

[code]
    private final JButton stdYesButton = new JButton(NbBundle.getBundle(NbPresenter.class).getString("YES_OPTION_CAPTION")); // NOI18N
    private final JButton stdNoButton = new JButton(NbBundle.getBundle(NbPresenter.class).getString("NO_OPTION_CAPTION")); // NOI18N
    private final JButton stdOKButton = new JButton(NbBundle.getBundle(NbPresenter.class).getString("OK_OPTION_CAPTION")); // NOI18N
    private final JButton stdCancelButton = new JButton(NbBundle.getBundle(NbPresenter.class).getString("CANCEL_OPTION_CAPTION")); // NOI18N
    private final JButton stdClosedButton = new JButton(NbBundle.getBundle(NbPresenter.class).getString("CLOSED_OPTION_CAPTION")); // NOI18N
    private final JButton stdHelpButton = new JButton();
    private final JButton stdDetailButton = new JButton(NbBundle.getBundle(NbPresenter.class).getString("HELP_OPTION_CAPTION")); // NOI18N 
[/code]
Comment 1 anusanraj 2015-10-29 03:24:27 UTC
Created attachment 157034 [details]
Bundle file for French version
Comment 2 Ondrej Vrabec 2015-10-29 06:50:34 UTC
What property editor, can you make a screenshot of the dialog?
Comment 3 anusanraj 2015-10-29 09:20:12 UTC
This is a custom editor implemented in our application by extending java.beans.PropertyEditorSupport. Following is its implementation.

[code]



public class MyEditor extends PropertyEditorSupport implements ExPropertyEditor
{
    private PropertyEnv pe;
    private MyPanel myPanel;

    public MyEditor()
    {
        MyPanel = MyPanel.getInstance();
        Locale currentLocale = Locale.getDefault();
        HelpCtx.setHelpIDString(myPanel, "some id goes here");
    }

    @Override
    public void attachEnv(PropertyEnv pe)
    {
        this.pe = pe;
    }

    @Override
    public Component getCustomEditor()
    {
        if (pe != null)
        {
            pe.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
            pe.addVetoableChangeListener(new VetoableChangeListener()
            {
                @Override
                public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException
                {
                    if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName()) && evt.getNewValue().equals(PropertyEnv.STATE_VALID))
                    {
                        String ret = myPanel.validateErrorValue();
                        if (ret == null)
                        {
                            myPanel.saveGUIValues();
                            pe.removeVetoableChangeListener(this);
                        }
                        else
                        {
                            throw new PropertyVetoException(ret, evt);
                        }
                    }
                }
            });
        }
        return myPanel;
    }

    @Override
    public void setValue(Object value)
    {
		// some code goes here
    }

    @Override
    public boolean supportsCustomEditor()
    {
        return true;
    }

    @Override
    public String getAsText()
    {
        return myPanel.toString();
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException
    {
		// some code goes here
    }

}

[/code]
Comment 4 anusanraj 2015-10-29 09:23:42 UTC
Created attachment 157036 [details]
Property window of the implemented editor
Comment 5 anusanraj 2015-10-29 09:26:00 UTC
Created attachment 157037 [details]
Editor window in netbeans
Comment 6 anusanraj 2015-10-29 09:31:16 UTC
https://netbeans.org/bugzilla/attachment.cgi?id=157037

The buttons I am talking about is as same as the buttons in the attached property window of netbeans app.
Comment 7 Ondrej Vrabec 2015-10-29 10:11:08 UTC
You're localizing a wrong Bundle. Property editor manager provides its own Cancel button, change it in:
openide.explorer/src/org/openide/explorer/propertysheet/Bundle.properties#CTL_Cancel
Comment 8 anusanraj 2015-10-29 10:44:04 UTC
Yes. With the given path it works fine.....