cli icon indicating copy to clipboard operation
cli copied to clipboard

cf ignores LANG env on windows and uses platform language on windows

Open ArthurHlt opened this issue 12 years ago • 17 comments

Under windows 7 installed with FR locale, cf seems to ignore the LANG env and always display localized output on the native platform language.

Not clear whether there is a misconfiguration in my environment that may explain this, and how I could further troubleshooting it. Hope this may help others experiencing the same issue.

Under plain windows shell:

C:\Users\XPBP8114>set | grep -i LANG

C:\Users\XPBP8114>set LANG=en_us

C:\Users\XPBP8114>cf
NOM:
   cf - Un outil de ligne de commande pour interagir avec Cloud Foundry

UTILISATION:
   [variables d'environnement] cf [options globales] commande [arguments...] [op
tions de commande]

VERSION:
   6.2.0-c9d4aaa-2014-06-19T22:04:01+00:00

TEMPS DE CONSTRUIRE:
   2014-06-27 15:22:15.9885671 +0200 CEST

MISE EN ROUTE:
   login, l                           Connexion utilisateur
   logout, lo                         Déconnexion utilisateur

On cygwin fronted with https://github.com/cbucher/console

xpbp8114@EB-OR7011591 /cygdrive/c/My Program Files/wamp/www/arthurh
$ LANG=en_US  CF_trace= cf --version
C:\My Program Files\CloudFoundry\cf.exe version 6.2.0-c9d4aaa-2014-06-19T22:04:01+00:00

xpbp8114@EB-OR7011591 /cygdrive/c/My Program Files/wamp/www/arthurh
$ LANG=en_US  CF_trace= cf logs arthurh --recent
Connecté, le dumping journaux récents pour application arthurh en org bercheg-org / espace development comme [email protected]...

RATÉ
Get https://loggregator.run.pivotal.io:4443/recent?app=c8804964-81a0-4831-b2f3-013b6b6c6230: dial tcp: GetAddrInfoW: No such host is known.

$ env | grep -i LANG

xpbp8114@EB-OR7011591 /cygdrive/c/My Program Files/wamp/www/arthurh
$ cf --version
C:\My Program Files\CloudFoundry\cf.exe version 6.2.0-c9d4aaa-2014-06-19T22:04:01+00:00


xpbp8114@EB-OR7011591 /cygdrive/c/My Program Files/wamp/www/arthurh
$ cygcheck.exe --version
cygcheck (cygwin) 1.7.30
System Checker for Cygwin
Copyright (C) 1998 - 2014 Red Hat, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ArthurHlt avatar Jun 27 '14 13:06 ArthurHlt

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/74039780.

cf-gitbot avatar Jun 27 '14 13:06 cf-gitbot

The LANG environment variable is a Unix convention, not a Windows one. On Windows, the CLI conforms to configured language of the operating system.

Do you primarily use the CLI in cmd, PowerShell, or cygwin?

lcddave avatar Jun 27 '14 15:06 lcddave

oh ok I prefer to use cygwin

ArthurHlt avatar Jun 27 '14 15:06 ArthurHlt

Thanks for letting us know about your preference for cygwin. We know there's some issues with the CLI and cygwin right now. Unfortunately, we don't have the resources to fully support it yet. But your input can help change this.

I will close this issue for now.

lcddave avatar Jun 27 '14 15:06 lcddave

@lcddave It would be helpful to allow windows users to override the system language when using cf. Some use-case: in my company, if I change the system language to EN, it would break other local sensible legacy apps.

However, for the CF cli I'd like to use english (as I do with most programming tools, such as IDE and Java JVM).

For example the Java jvm accepts the java -Duser.language=fr option to do so, see http://www.oracle.com/technetwork/articles/javase/locale-140624.html

Do you feel looking up LANG env would be an issue? If so, what about reading from a CF_LANG instead ?

gberche-orange avatar Jun 30 '14 13:06 gberche-orange

I can't see any harm at all in allowing windows users to override the system language. My preference would be to allow LANG to override, since afaik it has no inherent meaning on windows.

Sent From A Very Small Keyboard

On Jun 30, 2014, at 6:55, Guillaume Berche [email protected] wrote:

@lcddave It would be helpful to allow windows users to override the system language when using cf. Some use-case: in my company, if I change the system language to EN, it would break other local sensible legacy apps.

However, for the CF cli I'd like to use english (as I do with most programming tools, such as IDE and Java JVM).

For example the Java jvm accepts the java -Duser.language=fr option to do so, see http://www.oracle.com/technetwork/articles/javase/locale-140624.html

Do you feel looking up LANG env would be an issue? Is so, what about reading from a CF_LANG instead ?

— Reply to this email directly or view it on GitHub.

tjarratt avatar Jun 30 '14 15:06 tjarratt

+1 for taking into account LANG env var on windows.

For the records, even after having changed the locale on windows (control panel -> region and language -> change display language ) the cli version 6.2.0-c9d4aaa always display messages in native os language (french in my case).

gberche-orange avatar Jul 01 '14 09:07 gberche-orange

i will also say +1 for taking into account LANG env var on windows. :) Thanks to take care about this

ArthurHlt avatar Jul 01 '14 09:07 ArthurHlt

even after having changed the locale on windows (control panel -> region and language -> change display language ) the cli ... always display messages in native os language

That's interesting. We had a hard time detecting the user's language on Windows until several changes had been made together in the region / language section of Control Panel. It's entirely possible that we're not detecting the user locale correctly on windows.

If anyone with some interest (and possibly some knowledge of syscalls on Windows) would be interested in reviewing this package we wrote to detect locale, we'd be quite grateful.

tjarratt avatar Jul 02 '14 07:07 tjarratt

Trying to recall why we didn't implement this with GetUserDefaultLocaleName. Perhaps @XenoPhex remembers?

tjarratt avatar Jul 02 '14 07:07 tjarratt

@lcddave this issue also affects users using plain cmd.exe (in addition to powershell and cygwin). Any chance to reopen it to reflect users pains with it ?

Reproduces with 6.3.0

gberche-orange avatar Jul 17 '14 10:07 gberche-orange

Yes, it affects anyone on Windows. The story we're going to do as a workaround is adding a language override to the configuration: https://www.pivotaltracker.com/story/show/74651616

Would that address your situation?

lcddave avatar Jul 17 '14 14:07 lcddave

Thanks @lcddave for your response and the pointer onto the story. Having users specify their preferred language into the config.json would certainly address my situation.

I have a preference for the cli to honors the standard LANG env on windows because it would feel natural to unix/cygwin users and most programmers, and require less work (not having to deal with understanding current config.json format or deal with future format changes)

gberche-orange avatar Jul 17 '14 15:07 gberche-orange

While it would be natural for users coming from Unix, it would not be natural to "native" Windows users.

As for cli on cygwin, we don't currently support it. However, should that day come, then yes, we would look into this matter and find the proper convention.

lcddave avatar Jul 17 '14 18:07 lcddave

Thanks a lot @lcddave and @christopherpiraino for this story!

Using cf config --locale en_US is saving me lots of frustrations I had with the native french outputs

gberche-orange avatar Sep 25 '14 09:09 gberche-orange

Sure thing, Guillaume. You might also be interested in https://www.pivotaltracker.com/story/show/78489056 which is in CLI v6.6.1

-Greg

On Thu, Sep 25, 2014 at 2:51 AM, Guillaume Berche [email protected] wrote:

Thanks a lot @lcddave https://github.com/lcddave and @christopherpiraino for this story!

Using cf config --locale en_US is saving me lots of frustrations I had with the native french outputs

— Reply to this email directly or view it on GitHub https://github.com/cloudfoundry/cli/issues/195#issuecomment-56797071.

goehmen avatar Sep 25 '14 16:09 goehmen