Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-25 Thread Anish P
Just an update on the same. Even the library from "Jibber-Jabber" seems to
be returning only empty string values.

Forced to set this as an ENVIRONMENT_VARIABLE for the time being and moving
on.

Cheers
Anish

On Sat, Feb 17, 2018 at 8:05 PM, Anish P 
wrote:

> Thanks for the details. Had a look earlier at the code mentioned by 
> Jibber-Jabber
> as you mentioned. Will post the status as soon as I try this out.
>
> Cheers
> Anish
>
> On Sat, Feb 17, 2018 at 9:55 AM,  wrote:
>
>> 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/jdk
>> 8u/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 a topic in the
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/golang-nuts/8xC2c_VcSAQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.


Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-17 Thread Anish P
Thanks for the details. Had a look earlier at the code mentioned by
Jibber-Jabber
as you mentioned. Will post the status as soon as I try this out.

Cheers
Anish

On Sat, Feb 17, 2018 at 9:55 AM,  wrote:

> 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 a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/golang-nuts/8xC2c_VcSAQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.


Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-16 Thread uwe . dauernheim
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.


Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-16 Thread Anish P
My bad.

I was referring to the same.Something which is packaged in go giving a
standard locale ID as q_AL, ar_DZ

Cheers
Anish

On Fri, Feb 16, 2018 at 10:08 PM, Ian Lance Taylor  wrote:

> On Fri, Feb 16, 2018 at 8:21 AM, Anish P
>  wrote:
> >
> > I'm looking to fetch the IANA timezone.
>
> For what it's worth, I don't usually call the timezone a "locale".  In
> programming, "locale" usually refers to language related issues.  See
> https://en.wikipedia.org/wiki/Locale_(computer_software) .
>
> To get the timezone name, see https://golang.org/pkg/time/#Time.Zone .
>
> Ian
>

-- 
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.


Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-16 Thread Ian Lance Taylor
On Fri, Feb 16, 2018 at 8:21 AM, Anish P
 wrote:
>
> I'm looking to fetch the IANA timezone.

For what it's worth, I don't usually call the timezone a "locale".  In
programming, "locale" usually refers to language related issues.  See
https://en.wikipedia.org/wiki/Locale_(computer_software) .

To get the timezone name, see https://golang.org/pkg/time/#Time.Zone .

Ian

-- 
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.


Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-16 Thread Anish P
I'm looking to fetch the IANA timezone.

Cheers
Anish


Thanks and Regards
Anish Prabhakaran
+91-9901159770

On Fri, Feb 16, 2018 at 9:40 PM, Ian Lance Taylor  wrote:

> On Fri, Feb 16, 2018 at 7:46 AM,   wrote:
> >
> > The intention is basically to send out translations from the deployed
> shard.
> > Hence,we are trying to find the locale of the server locale. Because of
> some
> > reason, we cannot extract this as an environment variable on the shard or
> > get it from the client.
>
> What operating system?
>
> What format do you want for the locale?
>
> Ian
>
>
> > On Wednesday, 14 February 2018 20:21:05 UTC+5:30, Ian Lance Taylor wrote:
> >>
> >> On Tue, Feb 13, 2018 at 11:19 PM,   wrote:
> >> >
> >> >   I'm a newbee to Golang and am trying to fetch the default server
> >> > locale.
> >> > Can you help me how I can fetch the default server locale in golang?
> >> >
> >> > In other words, I'm looking for the Java equivalent code in golang i.e
> >> > 'Locale.getDefault()'
> >>
> >> Go doesn't use locales in the same way that Java does.  If you tell us
> >> what you want to do with that information, we may be able to help.
> >> You may want to look at https://godoc.org/golang.org/x/text .
> >>
> >> Ian
> >
> > --
> > 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.
>

-- 
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.


Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-16 Thread Ian Lance Taylor
On Fri, Feb 16, 2018 at 7:46 AM,   wrote:
>
> The intention is basically to send out translations from the deployed shard.
> Hence,we are trying to find the locale of the server locale. Because of some
> reason, we cannot extract this as an environment variable on the shard or
> get it from the client.

What operating system?

What format do you want for the locale?

Ian


> On Wednesday, 14 February 2018 20:21:05 UTC+5:30, Ian Lance Taylor wrote:
>>
>> On Tue, Feb 13, 2018 at 11:19 PM,   wrote:
>> >
>> >   I'm a newbee to Golang and am trying to fetch the default server
>> > locale.
>> > Can you help me how I can fetch the default server locale in golang?
>> >
>> > In other words, I'm looking for the Java equivalent code in golang i.e
>> > 'Locale.getDefault()'
>>
>> Go doesn't use locales in the same way that Java does.  If you tell us
>> what you want to do with that information, we may be able to help.
>> You may want to look at https://godoc.org/golang.org/x/text .
>>
>> Ian
>
> --
> 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.

-- 
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.


Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-16 Thread prabhakaran . anish1986
The intention is basically to send out translations from the deployed 
shard. Hence,we are trying to find the locale of the server locale. Because 
of some reason, we cannot extract this as an environment variable on the 
shard or get it from the client.

Best
Anish  

On Wednesday, 14 February 2018 20:21:05 UTC+5:30, Ian Lance Taylor wrote:
>
> On Tue, Feb 13, 2018 at 11:19 PM,   
> wrote: 
> > 
> >   I'm a newbee to Golang and am trying to fetch the default server 
> locale. 
> > Can you help me how I can fetch the default server locale in golang? 
> > 
> > In other words, I'm looking for the Java equivalent code in golang i.e 
> > 'Locale.getDefault()' 
>
> Go doesn't use locales in the same way that Java does.  If you tell us 
> what you want to do with that information, we may be able to help. 
> You may want to look at https://godoc.org/golang.org/x/text . 
>
> Ian 
>

-- 
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.


Re: [go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-14 Thread Ian Lance Taylor
On Tue, Feb 13, 2018 at 11:19 PM,   wrote:
>
>   I'm a newbee to Golang and am trying to fetch the default server locale.
> Can you help me how I can fetch the default server locale in golang?
>
> In other words, I'm looking for the Java equivalent code in golang i.e
> 'Locale.getDefault()'

Go doesn't use locales in the same way that Java does.  If you tell us
what you want to do with that information, we may be able to help.
You may want to look at https://godoc.org/golang.org/x/text .

Ian

-- 
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.


[go-nuts] How can I fetch the default locale (server locale not from the request) in Golang

2018-02-14 Thread prabhakaran . anish1986
Hello All,
  I'm a newbee to Golang and am trying to fetch the default server locale. 
Can you help me how I can fetch the default server locale in golang?

In other words, I'm looking for the Java equivalent code in golang i.e '
Locale.getDefault()'

Thanks
Anish


-- 
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.