Click
  1. Click
  2. CLK-655

Provide a pluggable ResourceBundle service

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.0-M1
    • Component/s: core
    • Labels:
      None

      Description

      Provide feature to plug custom ResourceBundle implementations into Click.

        Activity

        Hide
        Finn Bock added a comment -

        Hi,

        Attached is my take on the messages map service. The messages map that page & control holds is just a Map<String, String> and my DefaultMessagesMapService return instances of the MessagesMap which is the default implementation of the Map<String, String>.

        Let me know if you had something entirely different in mind.

        Show
        Finn Bock added a comment - Hi, Attached is my take on the messages map service. The messages map that page & control holds is just a Map<String, String> and my DefaultMessagesMapService return instances of the MessagesMap which is the default implementation of the Map<String, String>. Let me know if you had something entirely different in mind.
        Hide
        Bob Schellink added a comment -

        This looks great, exactly what I had in mind. Just to expand a little on the use cases where a custom messages map is useful:

        • Plug in a MessageMap that conditionally caches properties
        • Use an alternative algorithm to load property files. For example at work we have a central code base that is customized for different clients. While each client uses English property files some clients want alternative labels for fields. Currently we use a hacked MessagesMap to provide "context sensitive" lookups, but with this service we could simply plug in our custom version.

        I'm not sure MessageMapService is the right name but can't think of something better at the moment. We can refactor it at a later stage so feel free to commit.

        Kind regards

        Bob

        Show
        Bob Schellink added a comment - This looks great, exactly what I had in mind. Just to expand a little on the use cases where a custom messages map is useful: Plug in a MessageMap that conditionally caches properties Use an alternative algorithm to load property files. For example at work we have a central code base that is customized for different clients. While each client uses English property files some clients want alternative labels for fields. Currently we use a hacked MessagesMap to provide "context sensitive" lookups, but with this service we could simply plug in our custom version. I'm not sure MessageMapService is the right name but can't think of something better at the moment. We can refactor it at a later stage so feel free to commit. Kind regards Bob
        Hide
        Finn Bock added a comment -

        Applied.

        Show
        Finn Bock added a comment - Applied.
        Hide
        Adrian A. added a comment -

        > I'm not sure MessageMapService is the right name but can't think of something better at the moment.
        In the DTD, there's:
        log-service, resource-service, template-service
        So to be consistent, maybe to name it simply "message-service" ?

        Show
        Adrian A. added a comment - > I'm not sure MessageMapService is the right name but can't think of something better at the moment. In the DTD, there's: log-service, resource-service, template-service So to be consistent, maybe to name it simply "message-service" ?
        Hide
        Bob Schellink added a comment -

        I think we should call this ResourceBundleService. "MessageMap" doesn't provide enough context as a service name. It sounds as if it has something to do with messaging (JMS) rather than localization. ResourceBundle on the other hand, is quite obvious.

        Of course we still create a MessagesMap instance.

        Show
        Bob Schellink added a comment - I think we should call this ResourceBundleService. "MessageMap" doesn't provide enough context as a service name. It sounds as if it has something to do with messaging (JMS) rather than localization. ResourceBundle on the other hand, is quite obvious. Of course we still create a MessagesMap instance.

          People

          • Assignee:
            Finn Bock
            Reporter:
            Bob Schellink
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development