Onde o Cygwin configura a localidade ($ LANG env var)?

3

Eu sei que posso usar a ferramenta locale e export LANG=... para definir minha localidade no Cygwin.

No entanto, mesmo que eu não tenha %LANG% definido no Windows, quando executo bash --login , observo que $LANG já está afetado a fr_CH.UTF-8 , onde eu quero que ele seja en_US.UTF-8 .

$LANG é definido antes de /etc/lang.sh e mesmo antes de /etc/profile .

Onde é definido? Como posso alterá-lo corretamente?

    
por nowox 14.01.2015 / 13:25

1 resposta

4

Onde o Cygwin configura a localidade ($ LANG env var)?

At application startup, the application's locale is set to the default "C" or "POSIX" locale. Under Cygwin 1.7.2 and later, this locale defaults to the ASCII character set on the application level.

...

Como definir a localidade

Assume that you've set one of the aforementioned environment variables to some valid POSIX locale value, other than "C" and "POSIX". Assume further that you're living in Japan. You might want to use the language code "ja" and the territory "JP", thus setting, say, LANG to "ja_JP".

You didn't set a character set, so what will Cygwin use now? Starting with Cygwin 1.7.2, the default character set is determined by the default Windows ANSI codepage for this language and territory. Cygwin uses a character set which is the typical Unix-equivalent to the Windows ANSI codepage.

You don't want to use the default character set? In that case you have to specify the charset explicitly. For instance, assume you're from Japan and don't want to use the japanese default charset EUC-JP, but the Windows default charset SJIS.

What you can do, for instance, is to set the LANG variable in the mintty Cygwin Terminal in the "Text" section of its "Options" dialog.

Ifyou'restartingyourCygwinsessionviaabatchfileorashortcuttoabatchfile,youcanalsojustsetLANGthere:

@echooffC:chdirC:\cygwin\binsetLANG=ja_JP.SJISbash--login-i

Fonte Capítulo 2. Configurando o Cygwin - Internacionalização

    
por 14.01.2015 / 13:55

Tags