2 Replies Latest reply on Nov 18, 2009 10:48 AM by P.o.l.a.c.o

    Locale Resource Bundle Best Practice

    P.o.l.a.c.o Level 1

      Hi

      I have a Flex application that loads it's locale resource bundle from a service.
      So when the httpservice loads the bundle it populates an instance of a class "I18NBundle" that contains all the bundle properties. For instance you could do:
      i18nBundle.hello_message and it would return "Hello"

      I'm currently using Cairngorm for this project so this i18nBundle instance it's on the model locator.

      What I'm seeing and that I don't like is that for a component be able to get the bundle it must access to the model locator and then to the i18nBundle.
      Instead of that what I would like is that each component doesn't rely on this for getting the bundle.
      I guess I could create a "bundle" property on each component class and then pass it the reference to the bundle when it is instanciated. It seems it could be messy and a difficult task to initialize this property in some cases for instance on a datagrid cell renderer.

      Other could be transforming the I18NBundle class into a singleton and then when the service response it's recieved the singleton it's initialized. Since all application components should/must access the same locale bundle I guess this could be a better option.

      What do you think about this?
      Do you think there is some a better way to achieve this with Flex?

      Any opinion or recommendation would be appreciatted.

      (I don't wish to use the Adobe Flex proposal of having the properties file on the Flex project and the compiling them into swf.)


      thanks in advance.

      Polaco.

      ps: If you think I haven't expressed myself correctly please let me know and I will rewrite it.