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 186616

Summary: I18N: "displayName" is used in both UI and generated codes
Product: javafx Reporter: Masaki Katakai <masaki>
Component: UnsupportedAssignee: David Kaspar <dkaspar>
Status: RESOLVED FIXED    
Severity: normal Keywords: I18N
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Masaki Katakai 2010-05-24 15:33:11 UTC
The following string is used for UI on properties window,

org/netbeans/api/javafx/composer/model/control/Bundle.properties:
     ButtonModel.action.displayName=Action

But it's also used in generated codes. When new action method is created,
the following codes are inserted. "Action" will be localized when
it's localized.

    function buttonAction (): Void {
        //TODO
    }

When it's localized, the code will be

    function button<Translation of Action> (): Void {
        //TODO
    }

We usually do not use multibytes in codes except string. Please separate the properties for UI and codes so that such localized strings will not be into the actual codes.

It looks other strings are also inserted into the generated codes, e.g.

./org/netbeans/api/javafx/composer/model/control/experimental/Bundle.properties:
  MenuModel.onHiding.displayName=On Hiding
  PopupMenuModel.onHiding.displayName=On Hiding
  MenuModel.onShowing.displayName=On Showing
  MenuModel.onShown.displayName=On Shown

It's not easy to understand which strings should be localized or not, so it's better to extract just UI strings into Bundle.properties file.
Comment 1 David Kaspar 2010-05-24 17:05:08 UTC
I am going to fix it ASAP. Meanwhile feel free to commit your I18N bundles.
Comment 2 David Kaspar 2010-05-24 17:50:06 UTC
Fixed in Composer repository as 100463976ca4 changeset. The change will be visible in next Composer continuous build.
Comment 3 David Kaspar 2010-05-24 17:58:44 UTC
The root cause of the issue is caused in properties.control.FieldPanel class and affects all properties. It took their display-name instead of field-name when generating code.

Currently the identified in generated code is composed as:

instanceNameOfTheComponent + fieldNameOfThePropertyOfTheComponent

optionally it may have a suffix in the following format:

"At" + selectedStateName

E.g. buttonAction or buttonActionAtNewState1

Note that the selectedStateName is entered by an user and is I18N as well. Its initial value is taken from "LBL_new_state_name" key in:
javafx.composer.design/org/netbeans/modules/javafx/composer/design/states/Bundle.properties
file.

Therefore there still may be a chance to have a multi-bytes character in the code.
If this is a problem we can remove the key from bundle (i.e. un-I18N it). Or just do not localize this single key.