[ 
https://issues.apache.org/jira/browse/PIVOT-940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13960043#comment-13960043
 ] 

Roger Whitcomb commented on PIVOT-940:
--------------------------------------

Well, the .json file is "associated" with the class, just as a means of finding 
the resource via the ClassLoader.  But, you're correct in that not every file 
in your application will be associated with Pivot, so putting all your i18n 
resources into a Pivot .JSON file is not always available.  In fact, in our 
fairly large application, there is a section that is GUI-related, for which we 
use the Pivot resources, and a portion almost as big, that is not GUI-related, 
for which I use regular Java ResourceBundle.  So, I made an Intl class that 
provides seamless access to either one through this one mechanism.

But, the way we package JSON files isn't any different, really, than the way we 
package resource bundles.  Yes, the names are different, but they are all still 
packaged inside the .jar file.  But, I suppose you mean that there are other 
ways to access these regular resource bundles (like with a URL), so there 
should be other ways to locate/access these JSON files than just by the class' 
ClassLoader ....?!  Am I understanding you correctly?

I guess the scenario that was imagined was that the resources would always be 
bundled in a .jar file and so should be reachable via the same ClassLoader as 
the regular .class files, but if you want to use another mechanism, then we 
should provide that as well, maybe by adding a Resources constructor that takes 
a URL, or just a File or InputStream??  Although, looking at the regular Java 
ResourceBundle, I see that the only alternative they have that we don't have is 
the ability to specify an alternate ClassLoader from which to load the 
resources.  So, would that suffice for you?

> Localisation Using a Non Class Related File
> -------------------------------------------
>
>                 Key: PIVOT-940
>                 URL: https://issues.apache.org/jira/browse/PIVOT-940
>             Project: Pivot
>          Issue Type: Improvement
>          Components: core-json, core-serialization, wtk
>    Affects Versions: 2.0.3
>         Environment: ALL
>            Reporter: Mark Chambers
>            Assignee: Sandro Martini
>            Priority: Minor
>              Labels: Localization
>
> Currently it seems that the resources in Pivot are done that same way as the 
> JDK, so .json files are associated with the classes. 
> Since anybody working in an International software industries has to deal 
> with the problem of continualy having to translate applications languages, it 
> seems strange to have to wrap up the languages with the Class Files.
> Ideally an external file, should be able to be specified, like the bxml 
> file... That is sitting somewhere with the other resource files, 
> configuration files etc...
> No reason to link it too the class, since 95% of class are not even GUI 
> components, and the way Apache Pivot does it is has a single GUI class, so 
> why bother linking it to the Class...And it is relevant to the bxml files not 
> the classes...
> Also means that when you wrap it up in a Jar for deployment the language 
> files can be sitting outside, so distributors and resellers, or open source 
> community members etc. can make the application support their language 
> themselves, just by copying,renaming and modifying the Language file...means 
> we can obfuscate jars easier etc...



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to