royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com.INVALID>
Subject Re: Struggling with resource files
Date Sun, 01 Oct 2017 14:19:17 GMT
IMO, Resources should/could be included as richer versions of IValuesImpl.
 (IValuesImplWithCompileTimeResources, IValuesImplWithLoadableResources,
etc).

But also, IMO, there is a PAYG dimension around resource types.  If your
resources are all strings, it is wasteful for the compiler to compile the
current resource files into the bundle classes like in regular Flex.  It
should be much faster to include them or load them as text and parse them
into Objects at runtime with simple String.split() calls.

Then the locale chain should be able to dictate the prototype inheritance
of those objects so the lookup is done by the browser.

Of course, I could be wrong.  I was going to play around with this after
we get the project rolling again, but someone is welcome to get started
now.

-Alex

On 10/1/17, 2:40 AM, "Harbs" <harbs.lists@gmail.com> wrote:

>I’m trying to figure out an elegant way to use resource bundles in a PAYG
>way and I’m having trouble.
>
>I’m actually not really sure how resource bundles are compiled and used
>in classic Flex.
>
>As I see it, there’s three cases where resource bundles might be used:
>
>1. The locale is known at compile time.
>2. The locale is known at app initialization.
>3. The locale might be changed during runtime.
>
>The ResourceManager classes in classic Flex is designed with #3 in mind
>and it’s not very PAYG at all.
>
>I’d venture to say that the biggest use case is #1. #2 is relatively
>common as well. #3 is probably pretty rare.
>
>For case #2, it’s probably necessary to load the resource bundles as
>separate HTTP request(s) once the app initializes. I’m not sure if a
>default resource bundle should be included at compile time as well. Dunno.
>
>Case #1 seem the most straight-forward and there really should be some
>way to specify resources when compiling an app.
>
>I just committed some code which takes a stab at compile time resource
>strings, but it’s kind of hacky, and I feel like there’s a better way to
>go about it. Ideally, there should be some way to specify and .properties
>file and have it included in the app.
>
>To use what I committed you’d do something like this (not tested and
>probably not working, but I wanted to commit the general idea):
>
><js:CurrencyValidator>
>  <js:beads>
>    <js:SimpleResourceStringBead
>resources=“org.apache.flex.utils.validation.resources.creditcard.en_us”/>
>  </js:beads>
></js:CurrencyValidator>
>
>Any ideas on how to better go about this?
>
>Harbs

Mime
View raw message