+1 to Locale.getDefault() I've seen them use that practice in Lucene+Solr. Cheers, Chris
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Chris Mattmann, Ph.D. Senior Computer Scientist NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA Office: 171-266B, Mailstop: 171-246 Email: [email protected] WWW: http://sunset.usc.edu/~mattmann/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Adjunct Assistant Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -----Original Message----- From: Martin Desruisseaux <[email protected]> Organization: Geomatys Reply-To: "[email protected]" <[email protected]> Date: Friday, May 3, 2013 10:03 AM To: Apache SIS <[email protected]> Subject: AbstractMetadata.toString() representation >Hello all > >This is a minor details, but all metadata should now have 'toString()' >representation. An example is like below (needs UTF-8 encoding and >monospaced font for proper output). This example does not show much >geographic stuff, but other ISO 19115 objects are more clearly geographic. > >DefaultCitation > ├─Title…………………………………………………………………………………… Some title > ├─Alternate title (1 of 2)………………………………… First alternate title > ├─Alternate title (2 of 2)………………………………… Second alternate title > ├─Edition……………………………………………………………………………… Some edition > ├─Cited responsible party (1 of 2) > │ ├─Organisation name………………………………………… Some organisation > │ └─Role…………………………………………………………………………… Distributor > ├─Cited responsible party (2 of 2) > │ ├─Individual name……………………………………………… Some person of contact > │ ├─Contact info > │ │ └─Address > │ │ └─Electronic mail address…… Some email > │ └─Role…………………………………………………………………………… Point of contact > ├─Presentation form (1 of 2)…………………………… Map digital > ├─Presentation form (2 of 2)…………………………… Map hardcopy > └─Other citation details……………………………………… Some other details > > >Up to now all "toString()" implementations were formatting in >Locale.ROOT (kind of "unlocalized" locale, very similar to >Locale.ENGLISH except for a few things like dates). This is because >'toString()' were mostly for debugging purposes and were intended to be >parseable for example by the org.apache.sis.measure.Angle(String) >constructor. However since I don't think that anyone will try to parse >String representation of metadata (if one want to do that, he should use >XML instead), I wonder if we should use Locale.getDefault() in the >metadata case? This impact number and date formatting, and some labels >for which a translation is available. > >Same question apply to timezone, currently fixed at UTC for >AbstractMetadata.toString(). I wonder if we should use the locale >timezone... > >Note that this is just for developer convenience. If such output is >desired for end-user, then the steps are to get a TreeTable >representation of the metadata, configure a TreeTableFormat and use it >like below: > > AbstractMetadata myMetadata = ...; // Any of the ~80 available >subclasses. > TreeTable treeTableViewOfMyMetadata = metadata.asTreeTable(); > TreeTableFormat format = new TreeTableFormat(myLocale, myTimezone); > String s = format.format(treeTableViewOfMyMetadata); > > > > Martin >
