royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <>
Subject Re: Struggling with resource files
Date Sun, 01 Oct 2017 12:05:54 GMT

> On Oct 1, 2017, at 2:42 PM, Idylog - Nicolas Granon <> wrote:
> Hi Harbs,
> "I’m not sure if a default resource bundle should be included at compile time as well."
> Well, it seems to me that, in Flex, there must be a default bundle (cooked inside the
swf) that is used by the framework itself for a number of tasks :
> Standard validators, standard formatters, default button label (ok, cancel...), default
loader label (loading ...%) and, in a general manner, all "standard" texts and value come
from there.

There is a default locale for compiled swfs which is usually en_us.

> The default locale is any of the locales defined in the frameworks/locale folder or the
selected sdk.
> Maybe it is not necessary to cook that default locale inside the compile js but I cannot
imagine there is no default locale at all..??
> (if the default locale is not cooked inside the base js, we must manage the case where
it fails to load…)

Right. This is something that needs to be considered for resources loaded at runtime.

> As for the PAYG way, it seems to me that if we have ResourceBundle and ResourceManager
it is acceptable to load resources (any resource!) at run time, and at any time. Or maybe
I did not correctly understand your concerns ?

PAYG means that there’s no extra code if you don’t need it, so for resources that are
defined at compile time, there should not be a need for ResourceManager.

For this to work, there would probably need to be “ResourceManager beads” and “non-ResourceManager

> "I’m actually not really sure how resource bundles are compiled and used in classic
> "Compiled" resources are really nothing more than an object whose property name are the
.properties file keys and the values are the values from the .properties (might be indirect
in case of binary values).
> Resource bundle can even be created at runtime (we use this a lot : it allows us to have
resources containing values that depend on user login).
> Maybe I can help about this. What exactly is unclear to you ?\

What parses the resource into objects? The resources are not in true object notation.

> Nicolas Granon
>> -----Message d'origine-----
>> De : Harbs []
>> Envoyé : dimanche 1 octobre 2017 11:41
>> À :
>> Objet : Struggling with resource files
>> 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=“”
>> />
>>  </js:beads>
>> </js:CurrencyValidator>
>> Any ideas on how to better go about this?
>> Harbs

View raw message