royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Idylog - Nicolas Granon" <ngra...@idylog.com>
Subject RE: Struggling with resource files
Date Mon, 02 Oct 2017 06:35:38 GMT
>From our point of view (app development), the Flex way Alex describes is simple and easy
to grab.

The only "complaint" is that you cannot alias the resource file to a var/const inside the
metatag which would be more convenient than declaring a separate constant.
I believe that most people using resource bundles use an "alias" const like this :

<code>
[ResourceBundle ("mybundlefilename")]

private const THE_BUNDLE:String="mybundlefilename");

...
resourceManager.getString(THE_BUNDLE,mykey);
...
</code>

This avoids misspelling the bundle name at each call to resourceManager.getXXX(bundle_name,
key);

The cleanest way would be to be able to use a const inside the metatag like :

<code>
[ResourceBundle (THE_BUNDLE)]
...
Private const THE_BUNDLE:String="mybundlefilename";
</code>

...but I know that usually, you cannot use a declared const inside a metatag...

Maybe it is possible to "autodeclare" a const alias inside the metatag itself like :

<code>
[ResourceBundle("mybundlefilename",MY_ALIAS)]
</code>


Where MY_ALIAS would be automatically declared as a String const ? (possibly conflicting with
another declaration...)


But this is a minor inconvenience.


Nicolas Granon



> -----Message d'origine-----
> De : Alex Harui [mailto:aharui@adobe.com.INVALID]
> Envoyé : lundi 2 octobre 2017 01:28
> À : dev@royale.apache.org
> Objet : Re: Struggling with resource files
> 
> 
> 
> On 10/1/17, 7:31 AM, "Harbs" <harbs.lists@gmail.com> wrote:
> 
> >I’d really like for the compiler to include resources as strings, but
> >I’m not sure what the best way to declare it is.
> >
> >How can we declare a reference to the resource and have the compiler
> >include it?
> 
> Well, that depends...
> 
> The [ResourceBundle] metadata and the compiler's -locale option seemed
> to make people happy.  I don't remember any complaints about it, my
> only issue was that it didn't seem to be efficient for String-only
> resources.
> [ResourceBundle] allows the strings to be managed in separate
> .properties files that are packaged with a SWC.  That's probably
> important because you probably don't want to have to list out every
> component's resources as beads in your app.  It probably needs to be
> driven automatically by metadata.
> 
> So, if we decide to stick with it, the challenge will be to teach the
> compiler to do something different with the resource properties.
> 
> Thoughts?
> -Alex
> 
> >



Mime
View raw message