[brailleblaster] Re: Where should properties files go?

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Mon, 6 Dec 2010 07:24:14 -0600

Thanks for the article on factories.

My internationalization package is called 
org.brailleblaster.localization If I understand what your are saying 
correctly properties files must be in the directory corresponding to 
this package or in a subdirectory or parent directory. This directory 
will not be available outside the jar file. How can the user make new 
localization files in that case?

Another question is how the values in the properties files will be 
encoded. How would I represent the Hebrew letter aleph, for example?

John

On Mon, Dec 06, 2010 at 10:40:19AM +0000, Michael Whapples wrote:
> Hello,
> For these properties files the path you specify is relative to the path 
> of the ClassLoader use in ResourceBundle.getBundle. If you use 
> ResourceBundle.getBundle(baseName, locale) then this will use the 
> ClassLoader this.getClass().getClassLoader(). This will result in the 
> properties file being found relative to the base of the package 
> structure and can be within a jar.
> 
> So as an example the English UK file which has menu messages might be 
> called MenuMessages_en_GB.properties and might be placed in a directory 
> which would relate to the package org.brailleblaster.i18n. This would 
> mean that the baseName would be org.brailleblaster.i18n.MenuMessages.
> 
> As to how ResourceBundle and the getBundle method works, it would be an 
> example of a factory pattern 
> http://www.javaworld.com/javaworld/javaqa/2001-05/02-qa-0511-factory.html. 
> It is worth noting that article doesn't go very far, but the factory 
> method can make decisions based on parameters passed in. So while 
> ResourceBundle is abstract, you may still make use of its static methods 
> and instances of subclasses can appear as a type ResourceBundle due to 
> polymorphism, meaning you need never know what specific type is being used.
> 
> Michael Whapples
> On 06/12/10 08:59, John J. Boyer wrote:
> >It looks like ResourceBundle.getBundle will look first for a subclass
> >with a given candidate name and then for a properties file with this
> >name. Where should such properties files go? Would it be acceptable to
> >place them in a subdirectory of brailleblaster called propertiesfiles?
> >Since ResourceBundle is an abstract class, it canot be instantiated. I'm
> >rather puzzled about how all this fits together.
> >
> >John
> >
> 

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities


Other related posts: