Hi Landon, I will implement my changes to I18N and show an example.
For the location of the resource files they will be in the same jar as the plug-in as "resource files" which are basically just non java class files stored in a JAR. If you were using maven you would have the following project structure src main java com revolsys jump foo FooExtension.java resources com revolsys jump foo language jump.properties jump_en.properties When you build with maven it copies everything in the resources directory into the JAR file. Paul Sunburned Surveyor wrote: > Paul, > > I think I understand what you are trying to explain to me. Let me see > if I'm on the same page as you: > > [1] You suggest that we remove the code to internationalize plug-ins > from the plug-in class itself to the main I18N class that we are > already using in OpenJUMP. > > [2] You suggest that we do this in a way that allows us to put the > i18n strings in separate property files, instead of one big property > file. > > [3] You suggest that we add a getText(String Category, String key) > method and a getInstance(category) method to the I18N class. In this > scenario the getInstance(category) method will be used to create a > ResourceBundle that is specific to a plug-in based on a properties > file specific to that plug-in. > > I think I only have one question: > > [1] Where is the property file for a plug-in stored? Is it in the JAR > file for the plug-in, or in a plug-in specific subfolder of OpenJUMP's > /lib/ext folder? > > Please correct any misunderstandings I may have about this. I'm still > trying to get a handle on how I18N works in general, and in OpenJUMP. > > If Martin, Larry, Stefan, Andreas and the others have no objections to > what Paul suggests, then I will help him with the implementation and > test it out with my Super Select Plug-In. > > The Sunburned Surveyor > > On 10/22/07, Paul Austin <[EMAIL PROTECTED]> wrote: > >> Landon, >> >> For the I18N stuff I'd like to find a way to do this that is not tied >> into the plug-in itself as there are many other classes used by a >> plug-in such as Swing panels etc which also need to have I18N. >> >> What I propose is that we extend the current I18N class to support >> different categories of I18N resource bundles. >> >> At the simplest the following method would be added to the I18N class. >> >> public String getText(String category, String key) { >> I18N i18n = getInstance(category); >> if (i18n == null) { >> return key;// or code to create text based on key >> } else { >> return i18n.getText(key); >> } >> } >> >> The getInstance(category) method would create an I18N instance for the >> resource bundle that would be category ".language" or something like that. >> >> The non-static getText would be the same as the current static get() >> method but just work on an instance. >> >> So if I have my plug-ins in the com.revolsys.jump.foo package I'd create >> resources under /com/revolsys/jump/foo/language_xxx.properties And use >> com.revolsys.jump.foo as my category. >> >> Paul >> >> >> Sunburned Surveyor wrote: >> >>> I'm working on an extension of AbstractPlugIn that I would like to use >>> for most of my OpenJUMP PlugIns. At this time I only plan to add two >>> (2) things to this class: >>> >>> [1] The code from the OpenJUMP Wiki that allows a programmer to obtain >>> an i18n String from the plug-in. (This will be done using Java's >>> ResourceBundle class as shown in the wiki.) >>> >>> [2] Implement the IPlugInDependency interface to support plug-in >>> dependencies. >>> >>> I'm going to make my SuperSelectToolboxPlugIn class extend this new >>> class so I can test the functionality. (I wanted to internationalize >>> the plug-in anyways.) >>> >>> Are there other useful additions that you have personally made to >>> OpenJUMP's basic PlugIn class? Do you find yourself adding the same >>> functionality to each of your plug-ins? >>> >>> I'd like any comments on this so I can design a well rounded and >>> comprehensive extension to the AbstractPlugIn class. >>> >>> I'm not suggesting this new class go into the core, but I will make it >>> available on my SurveyOS SourceForge site. >>> >>> The Sunburned Surveyor >>> >>> P.S. - I noticed that the i18n code on the OpenJUMP wiki creates an >>> instance of the ResourceBundle class in the plug-in's intialize >>> method. I wonder if this leads to uneccessary memory usage. Would it >>> be better to create the ResourceBundle class in the execute method? >>> (This might make setting an internationalized menu name a little >>> trickier, as it won't be available if we create the ResourceBundle in >>> the execute method instead of the intialize method.) >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Splunk Inc. >>> Still grepping through log files to find problems? Stop. >>> Now Search log events and configuration files using AJAX and a browser. >>> Download your FREE copy of Splunk now >> http://get.splunk.com/ >>> _______________________________________________ >>> Jump-pilot-devel mailing list >>> Jump-pilot-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>> >>> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Jump-pilot-devel mailing list >> Jump-pilot-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel