2 Replies Latest reply on Nov 17, 2009 11:15 AM by ghempton

    Skinning and Localization: Best Practices

    ghempton

      I cannot decide if it is better to put localization logic (e.g. resourceManager.getString()) inside of the skin or inside of the host component. In the latter case, the host component would set the label etc. on the skin part. Anyone have any insight?

        • 1. Re: Skinning and Localization: Best Practices
          GordonSmith Level 4

          For something like a label, you presumably want to specify a different one for each instance of your component. So the ResourceManager call to fetch the String for the label doesn't belong in either the compoenent or its skin... it belongs in the code creating instances of the component. The component should expose a bindable 'label' property and then when you use the component you do

           

          <MyComponent label="{resourcManager.getString(...)}"/>

           

          Gordon Smith

          Adobe Flex SDK Team

          • 2. Re: Skinning and Localization: Best Practices
            ghempton Level 1

            Yeah I fully understand that scenario for re-usable components, but for any application there is going to be a component (maybe the Application component itself) which contains the Button component you mentioned and assigns the label. So this component would be "the code creating instances of the component" which you mentioned. So in this case, the Button's label could either be assigned in the component or the skin of the component, which place do you think is the best practice? I can think of arguments for both.