DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Add Localization properties to StandardSystemProperty #1520

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please also add the following properties to StandardSystemProperty:

user.language
user.region
user.timezone

http://docs.oracle.com/javase/1.3/docs/api/java/util/Locale.html#setDefault(java
.util.Locale)

Original issue reported on code.google.com by sebastia...@gmail.com on 30 Aug 2013 at 5:47

GoogleCodeExporter commented 9 years ago

Original comment by kak@google.com on 30 Aug 2013 at 1:47

GoogleCodeExporter commented 9 years ago
Hmm, do you have any other links to docs that explain these? user.region 
doesn't seem to exist (at least in our JVM).

Original comment by kak@google.com on 30 Aug 2013 at 6:34

GoogleCodeExporter commented 9 years ago
Currently StandardSystemProperty explicitly limits itself to the set of 
standard properties listed in System.getProperties(), right? Do we really want 
to be expanding it beyond that?

Original comment by cgdecker@google.com on 30 Aug 2013 at 6:36

GoogleCodeExporter commented 9 years ago
user.language is the only one I found a reference to in the docs I searched 
(which doesn't necessarily mean (a) that it's particularly standard beyond that 
setDefault checks for permission to change it or (b) that it and the others 
aren't documented somewhere else):

https://www.google.com/search?hl=en&q=site%3Adocs.oracle.com%2Fjavase%2F7%20%22u
ser.language%22

https://www.google.com/search?hl=en&q=site%3Adocs.oracle.com%2Fjavase%2F7%20%22u
ser.region%22

https://www.google.com/search?hl=en&q=site%3Adocs.oracle.com%2Fjavase%2F7%20%22u
ser.timezone%22

And as the requester's link shows, there's a higher-level interface for reading 
and writing the default locale. When is it preferable to access the property 
directly?

Original comment by cpov...@google.com on 30 Aug 2013 at 6:47

GoogleCodeExporter commented 9 years ago
I also found this:
http://www.mindspring.com/~mgrand/java-system-properties.htm

Doesn't look super "official" though...

Original comment by kak@google.com on 30 Aug 2013 at 6:49

GoogleCodeExporter commented 9 years ago
Some more links:

http://docs.oracle.com/javame/config/cdc/cdc-opt-impl/ojmeec/1.0/runtime/html/lo
calization.htm
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzaha%2
Fsysprop2.htm
http://docs.oracle.com/cd/E19102-01/n2.0.srvr/805-3076-10/6j2ugcgv6/index.html
http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.
websphere.iseries.doc/info/ae/ae/adrtz.htm

Personally, I use "user.language" for testing l10n of clients:

-Duser.language=de => German language
-Duser.language=ar => Arabic language for BIDI testing 
http://googletesting.blogspot.de/2010/11/test-your-app-from-right-to-left.html
-Duser.language=tr => for the Turkey test 
http://www.codinghorror.com/blog/2008/03/whats-wrong-with-turkey.html

To force an application server to use UTC regardless of system settings one can 
use:

-Duser.timezone=Etc/UTC

Original comment by sebastia...@gmail.com on 30 Aug 2013 at 6:59

GoogleCodeExporter commented 9 years ago
The question ends up being what we'll consider "standard." So far, we've 
defined that as "listed in the System.getProperties Javadoc." It's less clear 
what we should do with properties specific to J2ME, IBM (maybe?), JavaOS, or 
WebSphere. I lean toward just leaving them out. StandardSystemProperty is a 
pretty thin wrapper over System.getProperties, so it's easy to work around any 
properties that we leave out.

Original comment by cpov...@google.com on 30 Aug 2013 at 7:06

GoogleCodeExporter commented 9 years ago
Here are some more "standard" properties:

http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html

I'm fine with only using the ones defined in:

http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#getProperties()

Original comment by sebastia...@gmail.com on 31 Aug 2013 at 10:21

GoogleCodeExporter commented 9 years ago
Let's just have the ones in System.getProperties().

Original comment by kak@google.com on 25 Jan 2014 at 12:29

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08