Wicket
  1. Wicket
  2. WICKET-2531

Open DropDownChoice null value internationalization key

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.4.1
    • Fix Version/s: 1.4.4, 1.5-M1
    • Component/s: wicket
    • Labels:
      None

      Description

      DropDownChoice null value internationalization key is hardcoded in AbstractSingleSelectChoice.getDefaultChoice(Object);
      The same happen for nullValid.
      I suggest to externalize the building of these keys in 2 other methods.

      See discussion http://www.nabble.com/DropDownChoice-and-null-value-internationalization-key-td25924643.html

        Activity

        Hide
        Guillaume Mary added a comment -

        Here is the modified file, methods getNullKey() and getNullValidKey() are the ones which build the keys. getDefaultChoice() is modified to call them.

        Show
        Guillaume Mary added a comment - Here is the modified file, methods getNullKey() and getNullValidKey() are the ones which build the keys. getDefaultChoice() is modified to call them.
        Hide
        Juergen Donnerstag added a comment -

        I don't think the provide patch is good enough

        String option = getLocalizer().getStringIgnoreSettings(getNullValidKey(), this,null, null);
        if (Strings.isEmpty(option))

        { option = getLocalizer().getString("nullValid", this, ""); }

        getNullValidKey() can be redefined but if not found, "nullValid" without id is still used.

        Show
        Juergen Donnerstag added a comment - I don't think the provide patch is good enough String option = getLocalizer().getStringIgnoreSettings(getNullValidKey(), this,null, null); if (Strings.isEmpty(option)) { option = getLocalizer().getString("nullValid", this, ""); } getNullValidKey() can be redefined but if not found, "nullValid" without id is still used.
        Hide
        Guillaume Mary added a comment -

        I understand what you mean, meanwhile I volontary left "nullValid" as the global default value, as it is in Wicket in Application.properties.
        We could even more decouple all of this, with 2 methods for "nullValid" and 2 others for "null", one of each aimed at giving the very default key. But I don't see any advantage with that: why overriding the very default key since it's sufficient to override the getNullKey() or getNullValidKey() ?
        So i suggest to leave it as it is.

        Show
        Guillaume Mary added a comment - I understand what you mean, meanwhile I volontary left "nullValid" as the global default value, as it is in Wicket in Application.properties. We could even more decouple all of this, with 2 methods for "nullValid" and 2 others for "null", one of each aimed at giving the very default key. But I don't see any advantage with that: why overriding the very default key since it's sufficient to override the getNullKey() or getNullValidKey() ? So i suggest to leave it as it is.
        Hide
        Juergen Donnerstag added a comment -

        fixed

        Show
        Juergen Donnerstag added a comment - fixed

          People

          • Assignee:
            Juergen Donnerstag
            Reporter:
            Guillaume Mary
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development