Java’s Locale.getDefault returns (if not overridden) the values from the system 
property “user.language” and “user.region”. If these are not set, it simply 
returns “en”. See 
http://hg.openjdk.java.net/jdk8u/jdk8u60/jdk/file/935758609767/src/share/classes/java/util/Locale.java

For Linux: These system properties (if not overridden) are set on Linux by 
interpreting the environment variable “LANG”. See 
https://docs.oracle.com/javame/config/cdc/cdc-opt-impl/ojmeec/1.0/runtime/html/localization.htm

Thus the equivalent code in Go would be to access this environment variable. 
Thus a simple `locale = os.Getenv("LANG")` or as Jibber-Jabber does it:

```
locale = os.Getenv("LC_ALL")
        if locale == "" {
                locale = os.Getenv("LANG")
        }
```

If it is correct that, as you stated, that you have no access to environment 
variables, you won’t be able to conclude more than “en” to be compatible with 
Java’s behavior.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to