----- Original Message ----- From: "James Strachan" <[EMAIL PROTECTED]> > From: "Elliotte Rusty Harold" <[EMAIL PROTECTED]> > > At 3:26 PM +0100 4/20/02, James Strachan wrote: > > > > > > >Another extension of this idea could be to also support the common > locales > > >that are defined as static constants in the Locale class via their name > and > > >to use reflection to find them. Then we could do things like... > > > > > >upper-case( /foo/bar, 'FRENCH' ) > > >lower-case( /foo/bar, 'CHINA' ) > > > > > > > I think it would make more sense to use legal xml:lang values like > > fr, fr-CA, and en-US-Brooklyn; then convert them to the appropriate > > Locale object inside the extension function, This way you're not > > limited to just the ones that have defined named constants and it's > > overall more in keeping with global de jure standards. > > I really like this approach and have nearly implemented. One minor problem; > you need at least a country and language to be able to create a Locale. So I > couldn't allow 'fr' but could allow 'fr-CA' or 'en-US-Brooklyn'. The > constructor of Locale requires at least country and language. > > If just a language is specified, I could iterate through > Locale.getAvaliableLocales() and find the first locale matching the given > language - though I suspect this might lead to different behaviour on > different JVMs?
Actually the above should work if I test for the only locale with language = 'fr' and no country or variant specified. So 'fr' should match Locale.FRENCH. So Elliotte's proposal works very nicely. Sorry for the reams of emails on this. Will implement this shortly, using "-" as the seperator and supporting language, language-country and language-country-variant notations. Thanks once again Elliotte for another great idea. James _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest